MADARA
3.4.1
|
Holds settings for checkpoints to load or save. More...
#include <CheckpointSettings.h>
Public Member Functions | |
CheckpointSettings () | |
Constructor. More... | |
CheckpointSettings (const CheckpointSettings &rhs)=default | |
Copy 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, bool t_ignore_header_check=false, VariablesLister *t_variables_lister=nullptr, size_t t_max_buffer_size=2000000000) | |
Constructor. More... | |
~CheckpointSettings ()=default | |
Destructor. More... | |
int | decode (char *source, int size, int max_size) const |
Calls decode on the the buffer filter chain. More... | |
int | encode (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... | |
bool | ignore_header_check |
If true, do not perform a header check. 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... | |
size_t | max_buffer_size = 2000000000 |
the max size the buffer can grow to 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... | |
bool | playback_simtime = false |
If true, update simtime during playback to match recorded TOI. 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... | |
VariablesLister * | variables_lister = nullptr |
Object which will be used to extract variables for checkpoint saving. 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... | |
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.
|
inline |
Constructor.
Definition at line 46 of file CheckpointSettings.h.
|
inline |
Constructor.
t_buffer_size | size in bytes to allocate for a buffer |
t_clear_knowledge | if true, during loads, clear knowledge |
t_filename | the filename, including path to load/save |
t_originator | the originator id |
t_initial_timestamp | the wallclock time the checkpoint started |
t_last_timestamp | the wallclock time the checkpoint ended |
t_initial_lamport_clock | the clock when checkpoint started |
t_last_lamport_clock | the clock when checkpoint ended |
t_prefixes | the prefixes to save or load (empty = all) |
t_states | number of states in checkpoint |
t_version | the version of the checkpoint |
t_override_timestamp | override the timestamps |
t_override_lamport | override the lamport clocks |
t_keep_open | attempt to keep the file open for later |
t_initial_state | the initial state to query/save |
t_last_state | the last state to query/save |
t_reset_checkpoint | reset the checkpoint modifieds |
t_ignore_header_check | if true, ignore header checks |
t_max_buffer_size | the max size in bytes for buffer growth |
t_variables_lister | a custom list of variables to print |
Definition at line 89 of file CheckpointSettings.h.
|
default |
Copy constructor.
rhs | settings instance to copy |
|
default |
Destructor.
|
inline |
Calls decode on the the buffer filter chain.
source | the source and destination buffer |
size | the amount of data in the buffer in bytes |
max_size | the amount of bytes the buffer can hold |
Definition at line 223 of file CheckpointSettings.h.
|
inline |
Calls encode on the the buffer filter chain.
source | the source and destination buffer |
size | the amount of data in the buffer in bytes |
max_size | the amount of bytes the buffer can hold |
Definition at line 164 of file CheckpointSettings.h.
filters::BufferFilters madara::knowledge::CheckpointSettings::buffer_filters |
buffer filters.
Note that the user must clean up memory of all filters
Definition at line 419 of file CheckpointSettings.h.
size_t madara::knowledge::CheckpointSettings::buffer_size |
the size of the buffer needed for the checkpoint
Definition at line 352 of file CheckpointSettings.h.
|
private |
a thread-safe ref-counted file handle for quick access to an open checkpoint binary file
Definition at line 480 of file CheckpointSettings.h.
bool madara::knowledge::CheckpointSettings::clear_knowledge |
If true, during loads, clear the KnowledgeBase first.
Definition at line 357 of file CheckpointSettings.h.
std::string madara::knowledge::CheckpointSettings::filename |
path to files
Definition at line 362 of file CheckpointSettings.h.
bool madara::knowledge::CheckpointSettings::ignore_header_check |
If true, do not perform a header check.
This is useful if you are loading an arbitrary text file with no buffer filters
Definition at line 452 of file CheckpointSettings.h.
uint64_t madara::knowledge::CheckpointSettings::initial_lamport_clock |
initial lamport clock saved in the checkpoint
Definition at line 377 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 433 of file CheckpointSettings.h.
uint64_t madara::knowledge::CheckpointSettings::initial_timestamp |
initial wallclock time saved in the checkpoint
Definition at line 367 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 426 of file CheckpointSettings.h.
uint64_t madara::knowledge::CheckpointSettings::last_lamport_clock |
final lamport clock saved in the checkpoint
Definition at line 382 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 440 of file CheckpointSettings.h.
uint64_t madara::knowledge::CheckpointSettings::last_timestamp |
final wallclock time saved in the checkpoint
Definition at line 372 of file CheckpointSettings.h.
size_t madara::knowledge::CheckpointSettings::max_buffer_size = 2000000000 |
the max size the buffer can grow to
Definition at line 473 of file CheckpointSettings.h.
std::string madara::knowledge::CheckpointSettings::originator |
the originator id of the checkpoint
Definition at line 387 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 414 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 408 of file CheckpointSettings.h.
bool madara::knowledge::CheckpointSettings::playback_simtime = false |
If true, update simtime during playback to match recorded TOI.
Only operable if MADARA_FEATURE_SIMTIME macro is defined.
Definition at line 458 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 392 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 446 of file CheckpointSettings.h.
uint64_t madara::knowledge::CheckpointSettings::states |
the number of states checkpointed in the file stream
Definition at line 397 of file CheckpointSettings.h.
friend madara::knowledge::CheckpointSettings::ThreadSafeContext |
Allow for ThreadSafeContext to update private data members.
Definition at line 41 of file CheckpointSettings.h.
VariablesLister* madara::knowledge::CheckpointSettings::variables_lister = nullptr |
Object which will be used to extract variables for checkpoint saving.
By default (if left nullptr), use a default implementation which uses ThreadSaveContext::get_local_modified
This object is not owned, so must exist as long as this settings obejct exists
Definition at line 468 of file CheckpointSettings.h.
std::string madara::knowledge::CheckpointSettings::version |
the MADARA version
Definition at line 402 of file CheckpointSettings.h.