CCF
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
consensus::LedgerEnclave Class Reference

#include <ledger_enclave.h>

Public Member Functions

 LedgerEnclave (ringbuffer::AbstractWriterFactory &writer_factory_)
 
void put_entry (const std::vector< uint8_t > &entry, bool globally_committable, ccf::kv::Term term, ccf::kv::Version index)
 
void put_entry (const uint8_t *data, size_t size, bool globally_committable, ccf::kv::Term term, ccf::kv::Version index)
 
void truncate (Index idx)
 
void commit (Index idx)
 
void init (Index idx=0, Index recovery_start_idx=0)
 

Static Public Member Functions

static std::vector< uint8_t > get_entry (const uint8_t *&data, size_t &size)
 
static void skip_entry (const uint8_t *&data, size_t &size)
 

Static Public Attributes

static constexpr size_t FRAME_SIZE = sizeof(uint32_t)
 

Constructor & Destructor Documentation

◆ LedgerEnclave()

consensus::LedgerEnclave::LedgerEnclave ( ringbuffer::AbstractWriterFactory writer_factory_)
inline

Member Function Documentation

◆ commit()

void consensus::LedgerEnclave::commit ( Index  idx)
inline

Commit the ledger at a given index.

Parameters
idxIndex to commit at

◆ get_entry()

static std::vector< uint8_t > consensus::LedgerEnclave::get_entry ( const uint8_t *&  data,
size_t &  size 
)
inlinestatic

Retrieve a single entry, advancing offset to the next entry.

Parameters
dataSerialised entries
sizeSize of overall serialised entries
Returns
Raw entry as a vector

◆ init()

void consensus::LedgerEnclave::init ( Index  idx = 0,
Index  recovery_start_idx = 0 
)
inline

Initialise ledger at a given index (e.g. after a snapshot)

Parameters
idxIndex to start ledger from
recovery_start_idxIndex at which the recovery starts

◆ put_entry() [1/2]

void consensus::LedgerEnclave::put_entry ( const std::vector< uint8_t > &  entry,
bool  globally_committable,
ccf::kv::Term  term,
ccf::kv::Version  index 
)
inline

Put a single entry to be written to the ledger, when primary.

Parameters
entrySerialised entry
globally_committableTrue if entry is signature transaction
termConsensus term of entry
indexIndex (seqno) of entry

◆ put_entry() [2/2]

void consensus::LedgerEnclave::put_entry ( const uint8_t *  data,
size_t  size,
bool  globally_committable,
ccf::kv::Term  term,
ccf::kv::Version  index 
)
inline

Put a single entry to be written the ledger, when primary.

Parameters
dataSerialised entry start
sizeSerialised entry size
globally_committableTrue if entry is signature transaction
termConsensus term of entry
indexIndex (seqno) of entry

Note: The entry should already contain its own header.

◆ skip_entry()

static void consensus::LedgerEnclave::skip_entry ( const uint8_t *&  data,
size_t &  size 
)
inlinestatic

Skip a single entry, when backup.

Does not write any entry to the legder.

Parameters
dataSerialised entries
sizeSize of overall serialised entries

◆ truncate()

void consensus::LedgerEnclave::truncate ( Index  idx)
inline

Truncate the ledger at a given index.

Parameters
idxIndex to truncate from

Member Data Documentation

◆ FRAME_SIZE

constexpr size_t consensus::LedgerEnclave::FRAME_SIZE = sizeof(uint32_t)
staticconstexpr

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