ledger-core
Public Member Functions | List of all members
ledger::core::api::DatabaseBlob Class Referenceabstract

#include <DatabaseBlob.hpp>

+ Inheritance diagram for ledger::core::api::DatabaseBlob:

Public Member Functions

virtual std::vector< uint8_t > read (int64_t offset, int64_t length)=0
 
virtual int64_t write (int64_t offset, const std::vector< uint8_t > &data)=0
 
virtual int64_t append (const std::vector< uint8_t > &data)=0
 
virtual int64_t trim (int64_t newLen)=0
 
virtual int64_t size ()=0
 

Detailed Description

A wrapper around SQL blob type. BLOB (Binary Large Object) is a builtin SQL type to store bytes.

Member Function Documentation

◆ append()

virtual int64_t ledger::core::api::DatabaseBlob::append ( const std::vector< uint8_t > &  data)
pure virtual

Append the given bytes to the BLOB.

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

Implemented in Blob.

◆ read()

virtual std::vector<uint8_t> ledger::core::api::DatabaseBlob::read ( int64_t  offset,
int64_t  length 
)
pure virtual

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

Implemented in Blob.

◆ size()

virtual int64_t ledger::core::api::DatabaseBlob::size ( )
pure virtual

Get the size of the BLOB.

Returns
the size of the BLOB in bytes.

Implemented in Blob.

◆ trim()

virtual int64_t ledger::core::api::DatabaseBlob::trim ( int64_t  newLen)
pure virtual

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

Implemented in Blob.

◆ write()

virtual int64_t ledger::core::api::DatabaseBlob::write ( int64_t  offset,
const std::vector< uint8_t > &  data 
)
pure virtual

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

Returns
The number of written bytes

Implemented in Blob.


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