Derecho  0.9
Distributed systems toolkit for RDMA
Public Member Functions | Public Attributes | List of all members
persistent::PersistLog Class Referenceabstract

#include <PersistLog.hpp>

Inheritance diagram for persistent::PersistLog:
Inheritance graph
[legend]
Collaboration diagram for persistent::PersistLog:
Collaboration graph
[legend]

Public Member Functions

 PersistLog (const std::string &name) noexcept(true)
 
virtual ~PersistLog () noexcept(true)
 
virtual void append (const void *pdata, const uint64_t &size, const version_t &ver, const HLC &mhlc) noexcept(false)=0
 Persistent Append. More...
 
virtual void advanceVersion (const version_t &ver) noexcept(false)=0
 Advance the version number without appendding a log. More...
 
virtual int64_t getLength () noexcept(false)=0
 
virtual int64_t getEarliestIndex () noexcept(false)=0
 
virtual int64_t getLatestIndex () noexcept(false)=0
 
virtual int64_t getVersionIndex (const version_t &ver) noexcept(false)=0
 
virtual int64_t getHLCIndex (const HLC &hlc) noexcept(false)=0
 
virtual version_t getEarliestVersion () noexcept(false)=0
 
virtual version_t getLatestVersion () noexcept(false)=0
 
virtual const version_t getLastPersisted () noexcept(false)=0
 
virtual const void * getEntryByIndex (const int64_t &eno) noexcept(false)=0
 
virtual const void * getEntry (const version_t &ver) noexcept(false)=0
 
virtual const void * getEntry (const HLC &hlc) noexcept(false)=0
 
virtual const version_t persist (const bool preLocked=false) noexcept(false)=0
 Persist the log till specified version. More...
 
virtual void trimByIndex (const int64_t &idx) noexcept(false)=0
 Trim the log till entry number eno, inclusively. More...
 
virtual void trim (const version_t &ver) noexcept(false)=0
 Trim the log till version, inclusively. More...
 
virtual void trim (const HLC &hlc) noexcept(false)=0
 Trim the log till HLC clock, inclusively. More...
 
virtual size_t bytes_size (const version_t &ver)=0
 Calculate the byte size required for serialization ver - from which version the detal begins(tail log) INVALID_VERSION means to include all of the tail logs. More...
 
virtual size_t to_bytes (char *buf, const version_t &ver)=0
 Write the serialized log bytes to the given buffer buf - the buffer to receive serialized bytes ver - from which version the detal begins(tail log) INVALID_VERSION means to include all of the tail logs. More...
 
virtual void post_object (const std::function< void(char const *const, std::size_t)> &f, const version_t &ver)=0
 Post the serialized log bytes to a function f - the function to handle the serialzied bytes ver - from which version the detal begins(tail log) INVALID_VERSION means to include all of the tail logs. More...
 
virtual void applyLogTail (char const *v)=0
 Check/Merge the LogTail to the existing log. More...
 
virtual void truncate (const version_t &ver) noexcept(false)=0
 Truncate the log strictly newer than 'ver'. More...
 

Public Attributes

const std::string m_sName
 
std::set< hlc_index_entry, hlc_index_entry_comphidx
 

Detailed Description

Definition at line 57 of file PersistLog.hpp.

Constructor & Destructor Documentation

◆ PersistLog()

persistent::PersistLog::PersistLog ( const std::string &  name)
noexcept

Definition at line 7 of file PersistLog.cpp.

◆ ~PersistLog()

persistent::PersistLog::~PersistLog ( )
virtualnoexcept

Definition at line 10 of file PersistLog.cpp.

Member Function Documentation

◆ advanceVersion()

virtual void persistent::PersistLog::advanceVersion ( const version_t ver)
pure virtualnoexcept

Advance the version number without appendding a log.

This is useful to create gap between versions.

Implemented in persistent::FilePersistLog.

◆ append()

virtual void persistent::PersistLog::append ( const void *  pdata,
const uint64_t &  size,
const version_t ver,
const HLC mhlc 
)
pure virtualnoexcept

Persistent Append.

Parameters
pdata- serialized data to be append
size- length of the data
ver- version of the data, the implementation is responsible for making sure it grows monotonically.
mhlc- the hlc clock of the data, the implementation is responsible for making sure it grows monotonically. Note that the entry appended can only become persistent till the persist() is called on that entry.

Implemented in persistent::FilePersistLog.

◆ applyLogTail()

virtual void persistent::PersistLog::applyLogTail ( char const *  v)
pure virtual

Check/Merge the LogTail to the existing log.

dsm - deserialization manager v - serialized log bytes to be apllied

Implemented in persistent::FilePersistLog.

◆ bytes_size()

virtual size_t persistent::PersistLog::bytes_size ( const version_t ver)
pure virtual

Calculate the byte size required for serialization ver - from which version the detal begins(tail log) INVALID_VERSION means to include all of the tail logs.

Implemented in persistent::FilePersistLog.

◆ getEarliestIndex()

virtual int64_t persistent::PersistLog::getEarliestIndex ( )
pure virtualnoexcept

Implemented in persistent::FilePersistLog.

◆ getEarliestVersion()

virtual version_t persistent::PersistLog::getEarliestVersion ( )
pure virtualnoexcept

Implemented in persistent::FilePersistLog.

◆ getEntry() [1/2]

virtual const void* persistent::PersistLog::getEntry ( const version_t ver)
pure virtualnoexcept

Implemented in persistent::FilePersistLog.

◆ getEntry() [2/2]

virtual const void* persistent::PersistLog::getEntry ( const HLC hlc)
pure virtualnoexcept

Implemented in persistent::FilePersistLog.

◆ getEntryByIndex()

virtual const void* persistent::PersistLog::getEntryByIndex ( const int64_t &  eno)
pure virtualnoexcept

Implemented in persistent::FilePersistLog.

◆ getHLCIndex()

virtual int64_t persistent::PersistLog::getHLCIndex ( const HLC hlc)
pure virtualnoexcept

Implemented in persistent::FilePersistLog.

◆ getLastPersisted()

virtual const version_t persistent::PersistLog::getLastPersisted ( )
pure virtualnoexcept

Implemented in persistent::FilePersistLog.

◆ getLatestIndex()

virtual int64_t persistent::PersistLog::getLatestIndex ( )
pure virtualnoexcept

Implemented in persistent::FilePersistLog.

◆ getLatestVersion()

virtual version_t persistent::PersistLog::getLatestVersion ( )
pure virtualnoexcept

Implemented in persistent::FilePersistLog.

◆ getLength()

virtual int64_t persistent::PersistLog::getLength ( )
pure virtualnoexcept

Implemented in persistent::FilePersistLog.

◆ getVersionIndex()

virtual int64_t persistent::PersistLog::getVersionIndex ( const version_t ver)
pure virtualnoexcept

Implemented in persistent::FilePersistLog.

◆ persist()

virtual const version_t persistent::PersistLog::persist ( const bool  preLocked = false)
pure virtualnoexcept

Persist the log till specified version.

Returns
- the version till which has been persisted. Note that the return value could be higher than the the version asked is lower than the log that has been actually persisted.

Implemented in persistent::FilePersistLog.

◆ post_object()

virtual void persistent::PersistLog::post_object ( const std::function< void(char const *const, std::size_t)> &  f,
const version_t ver 
)
pure virtual

Post the serialized log bytes to a function f - the function to handle the serialzied bytes ver - from which version the detal begins(tail log) INVALID_VERSION means to include all of the tail logs.

Implemented in persistent::FilePersistLog.

◆ to_bytes()

virtual size_t persistent::PersistLog::to_bytes ( char *  buf,
const version_t ver 
)
pure virtual

Write the serialized log bytes to the given buffer buf - the buffer to receive serialized bytes ver - from which version the detal begins(tail log) INVALID_VERSION means to include all of the tail logs.

Implemented in persistent::FilePersistLog.

◆ trim() [1/2]

virtual void persistent::PersistLog::trim ( const version_t ver)
pure virtualnoexcept

Trim the log till version, inclusively.

Parameters
ver- all log entry before ver will be trimmed.

Implemented in persistent::FilePersistLog.

◆ trim() [2/2]

virtual void persistent::PersistLog::trim ( const HLC hlc)
pure virtualnoexcept

Trim the log till HLC clock, inclusively.

Parameters
hlc- all log entry before hlc will be trimmed.

Implemented in persistent::FilePersistLog.

◆ trimByIndex()

virtual void persistent::PersistLog::trimByIndex ( const int64_t &  idx)
pure virtualnoexcept

Trim the log till entry number eno, inclusively.

For exmaple, there is a log: [7,8,9,4,5,6]. After trim(3), it becomes [5,6]

Parameters
eno- the log number to be trimmed

Implemented in persistent::FilePersistLog.

◆ truncate()

virtual void persistent::PersistLog::truncate ( const version_t ver)
pure virtualnoexcept

Truncate the log strictly newer than 'ver'.

Parameters
ver- all log entry strict after ver will be truncated.

Implemented in persistent::FilePersistLog.

Member Data Documentation

◆ hidx

std::set<hlc_index_entry, hlc_index_entry_comp> persistent::PersistLog::hidx

Definition at line 62 of file PersistLog.hpp.

◆ m_sName

const std::string persistent::PersistLog::m_sName

Definition at line 60 of file PersistLog.hpp.


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