CCF
Loading...
Searching...
No Matches
Public Member Functions | List of all members
asynchost::LedgerFile Class Reference

#include <ledger.h>

Public Member Functions

 LedgerFile (const fs::path &dir, size_t start_idx, bool recovery=false)
 
 LedgerFile (const std::string &dir, const std::string &file_name_, bool from_existing_file_=false)
 
 ~LedgerFile ()
 
size_t get_start_idx () const
 
size_t get_last_idx () const
 
size_t get_current_size () const
 
bool is_committed () const
 
bool is_complete () const
 
bool is_recovery () const
 
std::pair< size_t, bool > write_entry (const uint8_t *data, size_t size, bool committable)
 
std::pair< size_t, size_t > entries_size (size_t from, size_t to, std::optional< size_t > max_size=std::nullopt) const
 
std::optional< LedgerReadResultread_entries (size_t from, size_t to, std::optional< size_t > max_size=std::nullopt)
 
bool truncate (size_t idx, bool remove_file_if_empty=true)
 
void complete ()
 
bool rename (const std::string &new_file_name)
 
void open ()
 
bool commit (size_t idx)
 

Constructor & Destructor Documentation

◆ LedgerFile() [1/2]

asynchost::LedgerFile::LedgerFile ( const fs::path &  dir,
size_t  start_idx,
bool  recovery = false 
)
inline

◆ LedgerFile() [2/2]

asynchost::LedgerFile::LedgerFile ( const std::string &  dir,
const std::string &  file_name_,
bool  from_existing_file_ = false 
)
inline

◆ ~LedgerFile()

asynchost::LedgerFile::~LedgerFile ( )
inline

Member Function Documentation

◆ commit()

bool asynchost::LedgerFile::commit ( size_t  idx)
inline

◆ complete()

void asynchost::LedgerFile::complete ( )
inline

◆ entries_size()

std::pair< size_t, size_t > asynchost::LedgerFile::entries_size ( size_t  from,
size_t  to,
std::optional< size_t >  max_size = std::nullopt 
) const
inline

◆ get_current_size()

size_t asynchost::LedgerFile::get_current_size ( ) const
inline

◆ get_last_idx()

size_t asynchost::LedgerFile::get_last_idx ( ) const
inline

◆ get_start_idx()

size_t asynchost::LedgerFile::get_start_idx ( ) const
inline

◆ is_committed()

bool asynchost::LedgerFile::is_committed ( ) const
inline

◆ is_complete()

bool asynchost::LedgerFile::is_complete ( ) const
inline

◆ is_recovery()

bool asynchost::LedgerFile::is_recovery ( ) const
inline

◆ open()

void asynchost::LedgerFile::open ( )
inline

◆ read_entries()

std::optional< LedgerReadResult > asynchost::LedgerFile::read_entries ( size_t  from,
size_t  to,
std::optional< size_t >  max_size = std::nullopt 
)
inline

◆ rename()

bool asynchost::LedgerFile::rename ( const std::string &  new_file_name)
inline

◆ truncate()

bool asynchost::LedgerFile::truncate ( size_t  idx,
bool  remove_file_if_empty = true 
)
inline

◆ write_entry()

std::pair< size_t, bool > asynchost::LedgerFile::write_entry ( const uint8_t *  data,
size_t  size,
bool  committable 
)
inline

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