1 #ifndef _MADARA_KNOWLEDGE_CHECKPOINTSETTINGS_H_ 2 #define _MADARA_KNOWLEDGE_CHECKPOINTSETTINGS_H_ 27 class ThreadSafeContext;
76 bool t_clear_knowledge,
78 uint64_t t_initial_timestamp = 0,
79 uint64_t t_last_timestamp = 0,
80 uint64_t t_initial_lamport_clock = 0,
81 uint64_t t_last_lamport_clock = 0,
83 const std::vector <std::string> & t_prefixes = {},
84 uint64_t t_states = 0,
86 bool t_override_timestamp =
false,
87 bool t_override_lamport =
false,
88 bool t_keep_open =
false,
89 uint64_t t_initial_state = 0,
90 uint64_t t_last_state = (uint64_t)-1,
91 bool t_reset_checkpoint =
true)
155 unsigned char * source,
int size,
int max_size)
const 158 for (filters::BufferFilters::const_iterator i =
buffer_filters.begin ();
161 size = (*i)->encode (source, size, max_size);
176 unsigned char * source,
int size,
int max_size)
const 179 for (filters::BufferFilters::const_reverse_iterator i =
buffer_filters.rbegin ();
182 size = (*i)->decode (source, size, max_size);
297 #endif //_MADARA_KNOWLEDGE_CHECKPOINTSETTINGS_H_ uint64_t initial_lamport_clock
initial lamport clock saved in the checkpoint
std::string version
the MADARA version
size_t buffer_size
the size of the buffer needed for the checkpoint
MADARA_Export std::string get_version(void)
Gets the MADARA version number.
bool keep_open
if true, keep the file open to avoid open/close overhead when programmatically iterating through chec...
uint64_t last_state
the last state number of interest (useful for loading ranges of checkpoint states.
int encode(unsigned char *source, int size, int max_size) const
Calls encode on the the buffer filter chain.
filters::BufferFilters buffer_filters
buffer filters.
int decode(unsigned char *source, int size, int max_size) const
Calls decode on the the buffer filter chain.
Holds settings for checkpoints to load or save.
std::string originator
the originator id of the checkpoint
~CheckpointSettings()
Destructor.
std::string filename
path to files
uint64_t initial_state
the initial state number of interest (useful for loading ranges of checkpoint states).
uint64_t last_lamport_clock
final lamport clock saved in the checkpoint
std::vector< std::string > prefixes
A list of prefixes to save/load.
CheckpointSettings(const CheckpointSettings &rhs)
Copy constructor.
CheckpointSettings()
Constructor.
bool override_timestamp
use the timestamps in this class instead of current wallclock time when writing context or checkpoint...
uint64_t initial_timestamp
initial wallclock time saved in the checkpoint
std::shared_ptr< FILE > checkpoint_file
a thread-safe ref-counted file handle for quick access to an open checkpoint binary file ...
friend ThreadSafeContext
Allow for ThreadSafeContext to update private data members.
bool clear_knowledge
If true, during loads, clear the KnowledgeBase first.
Provides utility functions and classes for common tasks and needs.
std::list< BufferFilter * > BufferFilters
Provides functions and classes for the distributed knowledge base.
uint64_t states
the number of states checkpointed in the file stream
uint64_t last_timestamp
final wallclock time saved in the checkpoint
bool override_lamport
use the lamport clocks in this class instead of KB clock when writing context or checkpoints ...
CheckpointSettings(bool 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.
Copyright (c) 2015 Carnegie Mellon University.
bool reset_checkpoint
If true, resets the checkpoint to start a new diff from this point forward.