MADARA  3.2.3
madara::knowledge::CheckpointSettings Class Reference

Holds settings for checkpoints to load or save. More...

#include <CheckpointSettings.h>

Public Member Functions

 CheckpointSettings ()
 Constructor. More...
 
 CheckpointSettings (size_t t_buffer_size, bool t_clear_knowledge, std::string t_filename="", uint64_t t_initial_timestamp=0, uint64_t t_last_timestamp=0, uint64_t t_initial_lamport_clock=0, uint64_t t_last_lamport_clock=0, std::string t_originator="", const std::vector< std::string > &t_prefixes={}, uint64_t t_states=0, std::string t_version="", bool t_override_timestamp=false, bool t_override_lamport=false, bool t_keep_open=false, uint64_t t_initial_state=0, uint64_t t_last_state=(uint64_t)-1, bool t_reset_checkpoint=true)
 Constructor. More...
 
 CheckpointSettings (const CheckpointSettings &rhs)
 Copy constructor. More...
 
 ~CheckpointSettings ()
 Destructor. More...
 
int decode (unsigned char *source, int size, int max_size) const
 Calls decode on the the buffer filter chain. More...
 
int encode (unsigned char *source, int size, int max_size) const
 Calls encode on the the buffer filter chain. More...
 

Public Attributes

filters::BufferFilters buffer_filters
 buffer filters. More...
 
size_t buffer_size
 the size of the buffer needed for the checkpoint More...
 
bool clear_knowledge
 If true, during loads, clear the KnowledgeBase first. More...
 
std::string filename
 path to files More...
 
uint64_t initial_lamport_clock
 initial lamport clock saved in the checkpoint More...
 
uint64_t initial_state
 the initial state number of interest (useful for loading ranges of checkpoint states). More...
 
uint64_t initial_timestamp
 initial wallclock time saved in the checkpoint More...
 
bool keep_open
 if true, keep the file open to avoid open/close overhead when programmatically iterating through checkpoints. More...
 
uint64_t last_lamport_clock
 final lamport clock saved in the checkpoint More...
 
uint64_t last_state
 the last state number of interest (useful for loading ranges of checkpoint states. More...
 
uint64_t last_timestamp
 final wallclock time saved in the checkpoint More...
 
std::string originator
 the originator id of the checkpoint More...
 
bool override_lamport
 use the lamport clocks in this class instead of KB clock when writing context or checkpoints More...
 
bool override_timestamp
 use the timestamps in this class instead of current wallclock time when writing context or checkpoints More...
 
std::vector< std::string > prefixes
 A list of prefixes to save/load. More...
 
bool reset_checkpoint
 If true, resets the checkpoint to start a new diff from this point forward. More...
 
uint64_t states
 the number of states checkpointed in the file stream More...
 
friend ThreadSafeContext
 Allow for ThreadSafeContext to update private data members. More...
 
std::string version
 the MADARA version More...
 

Private Attributes

std::shared_ptr< FILE > checkpoint_file
 a thread-safe ref-counted file handle for quick access to an open checkpoint binary file More...
 

Detailed Description

Holds settings for checkpoints to load or save.

Most of the data members are "smart" data members. For loads, many of the fields are essentially pass-by-reference and fill with the related data.

Definition at line 35 of file CheckpointSettings.h.

Constructor & Destructor Documentation

madara::knowledge::CheckpointSettings::CheckpointSettings ( )
inline

Constructor.

Definition at line 47 of file CheckpointSettings.h.

madara::knowledge::CheckpointSettings::CheckpointSettings ( size_t  t_buffer_size,
bool  t_clear_knowledge,
std::string  t_filename = "",
uint64_t  t_initial_timestamp = 0,
uint64_t  t_last_timestamp = 0,
uint64_t  t_initial_lamport_clock = 0,
uint64_t  t_last_lamport_clock = 0,
std::string  t_originator = "",
const std::vector< std::string > &  t_prefixes = {},
uint64_t  t_states = 0,
std::string  t_version = "",
bool  t_override_timestamp = false,
bool  t_override_lamport = false,
bool  t_keep_open = false,
uint64_t  t_initial_state = 0,
uint64_t  t_last_state = (uint64_t)-1,
bool  t_reset_checkpoint = true 
)
inline

Constructor.

Parameters
t_buffer_sizesize in bytes to allocate for a buffer
t_clear_knowledgeif true, during loads, clear knowledge
t_filenamethe filename, including path to load/save
t_originatorthe originator id
t_initial_timestampthe wallclock time the checkpoint started
t_last_timestampthe wallclock time the checkpoint ended
t_initial_lamport_clockthe clock when checkpoint started
t_last_lamport_clockthe clock when checkpoint ended
t_prefixesthe prefixes to save or load (empty = all)
t_statesnumber of states in checkpoint
t_versionthe version of the checkpoint
t_override_timestampoverride the timestamps
t_override_lamportoverride the lamport clocks
t_keep_openattempt to keep the file open for later
t_initial_statethe initial state to query/save
t_last_statethe last state to query/save
t_reset_checkpointreset the checkpoint modifieds

Definition at line 84 of file CheckpointSettings.h.

madara::knowledge::CheckpointSettings::CheckpointSettings ( const CheckpointSettings rhs)
inline

Copy constructor.

Parameters
rhssettings instance to copy

Definition at line 125 of file CheckpointSettings.h.

madara::knowledge::CheckpointSettings::~CheckpointSettings ( )
inline

Destructor.

Definition at line 152 of file CheckpointSettings.h.

Member Function Documentation

int madara::knowledge::CheckpointSettings::decode ( unsigned char *  source,
int  size,
int  max_size 
) const
inline

Calls decode on the the buffer filter chain.

Parameters
sourcethe source and destination buffer
sizethe amount of data in the buffer in bytes
max_sizethe amount of bytes the buffer can hold
Returns
the new size after encoding

Definition at line 184 of file CheckpointSettings.h.

int madara::knowledge::CheckpointSettings::encode ( unsigned char *  source,
int  size,
int  max_size 
) const
inline

Calls encode on the the buffer filter chain.

Parameters
sourcethe source and destination buffer
sizethe amount of data in the buffer in bytes
max_sizethe amount of bytes the buffer can hold
Returns
the new size after encoding

Definition at line 163 of file CheckpointSettings.h.

Member Data Documentation

filters::BufferFilters madara::knowledge::CheckpointSettings::buffer_filters

buffer filters.

Note that the user must clean up memory of all filters

Definition at line 268 of file CheckpointSettings.h.

size_t madara::knowledge::CheckpointSettings::buffer_size

the size of the buffer needed for the checkpoint

Definition at line 200 of file CheckpointSettings.h.

std::shared_ptr<FILE> madara::knowledge::CheckpointSettings::checkpoint_file
private

a thread-safe ref-counted file handle for quick access to an open checkpoint binary file

Definition at line 302 of file CheckpointSettings.h.

bool madara::knowledge::CheckpointSettings::clear_knowledge

If true, during loads, clear the KnowledgeBase first.

Definition at line 205 of file CheckpointSettings.h.

std::string madara::knowledge::CheckpointSettings::filename

path to files

Definition at line 210 of file CheckpointSettings.h.

uint64_t madara::knowledge::CheckpointSettings::initial_lamport_clock

initial lamport clock saved in the checkpoint

Definition at line 225 of file CheckpointSettings.h.

uint64_t madara::knowledge::CheckpointSettings::initial_state

the initial state number of interest (useful for loading ranges of checkpoint states).

This is an inclusive identifier, so 0 means to load from initial context/checkpoint save

Definition at line 282 of file CheckpointSettings.h.

uint64_t madara::knowledge::CheckpointSettings::initial_timestamp

initial wallclock time saved in the checkpoint

Definition at line 215 of file CheckpointSettings.h.

bool madara::knowledge::CheckpointSettings::keep_open

if true, keep the file open to avoid open/close overhead when programmatically iterating through checkpoints.

This is sort of useful with save_checkpoint

Definition at line 275 of file CheckpointSettings.h.

uint64_t madara::knowledge::CheckpointSettings::last_lamport_clock

final lamport clock saved in the checkpoint

Definition at line 230 of file CheckpointSettings.h.

uint64_t madara::knowledge::CheckpointSettings::last_state

the last state number of interest (useful for loading ranges of checkpoint states.

This is an inclusive identifier. If last_state >= states, it will essentially indicate the last valid state.

Definition at line 289 of file CheckpointSettings.h.

uint64_t madara::knowledge::CheckpointSettings::last_timestamp

final wallclock time saved in the checkpoint

Definition at line 220 of file CheckpointSettings.h.

std::string madara::knowledge::CheckpointSettings::originator

the originator id of the checkpoint

Definition at line 235 of file CheckpointSettings.h.

bool madara::knowledge::CheckpointSettings::override_lamport

use the lamport clocks in this class instead of KB clock when writing context or checkpoints

Definition at line 263 of file CheckpointSettings.h.

bool madara::knowledge::CheckpointSettings::override_timestamp

use the timestamps in this class instead of current wallclock time when writing context or checkpoints

Definition at line 256 of file CheckpointSettings.h.

std::vector<std::string> madara::knowledge::CheckpointSettings::prefixes

A list of prefixes to save/load.

If empty, all prefixes are valid.

Definition at line 240 of file CheckpointSettings.h.

bool madara::knowledge::CheckpointSettings::reset_checkpoint

If true, resets the checkpoint to start a new diff from this point forward.

Definition at line 295 of file CheckpointSettings.h.

uint64_t madara::knowledge::CheckpointSettings::states

the number of states checkpointed in the file stream

Definition at line 245 of file CheckpointSettings.h.

friend madara::knowledge::CheckpointSettings::ThreadSafeContext

Allow for ThreadSafeContext to update private data members.

Definition at line 42 of file CheckpointSettings.h.

std::string madara::knowledge::CheckpointSettings::version

the MADARA version

Definition at line 250 of file CheckpointSettings.h.


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