ledger-core
Public Member Functions | List of all members
Blob Class Reference
+ Inheritance diagram for Blob:
+ Collaboration diagram for Blob:

Public Member Functions

 Blob (const std::vector< uint8_t > &buffer)
 
std::vector< uint8_t > read (int64_t offset, int64_t length) override
 
int64_t write (int64_t offset, const std::vector< uint8_t > &data) override
 
int64_t append (const std::vector< uint8_t > &data) override
 
int64_t trim (int64_t newLen) override
 
int64_t size () override
 
const std::vector< uint8_t > & getBuffer () const
 

Member Function Documentation

◆ append()

int64_t Blob::append ( const std::vector< uint8_t > &  data)
inlineoverridevirtual

Append the given bytes to the BLOB.

Parameters
Thedata to append to the BLOB
Returns
the number of bytes written

Implements ledger::core::api::DatabaseBlob.

◆ read()

std::vector<uint8_t> Blob::read ( int64_t  offset,
int64_t  length 
)
inlineoverridevirtual

Reads bytes from the blob at the given offset and of the a given length and return them in a byte array.

Parameters
offsetStart to read bytes from the blob at offset value.
lengthMaximum number of byte read from the blob

Implements ledger::core::api::DatabaseBlob.

◆ size()

int64_t Blob::size ( )
inlineoverridevirtual

Get the size of the BLOB.

Returns
the size of the BLOB in bytes.

Implements ledger::core::api::DatabaseBlob.

◆ trim()

int64_t Blob::trim ( int64_t  newLen)
inlineoverridevirtual

Truncate the BLOB to the length given by the newLen parameter (in bytes).

Parameters
newLenThe final size of the BLOB
Returns
The number of byte truncated

Implements ledger::core::api::DatabaseBlob.

◆ write()

int64_t Blob::write ( int64_t  offset,
const std::vector< uint8_t > &  data 
)
inlineoverridevirtual

Write the given bytes at the given offset in the BLOB.

Returns
The number of written bytes

Implements ledger::core::api::DatabaseBlob.


The documentation for this class was generated from the following file: