PersistentRegistry is a book for all the Persistent<T> or Volatile<T> variables. More...
#include <Persistent.hpp>
Public Member Functions | |
PersistentRegistry (ITemporalQueryFrontierProvider *tqfp, const std::type_index &subgroup_type, uint32_t subgroup_index, uint32_t shard_num) | |
virtual | ~PersistentRegistry () |
void | makeVersion (const int64_t &ver, const HLC &mhlc) noexcept(false) |
Make a new version capturing the current state of the object. More... | |
const int64_t | persist () noexcept(false) |
(attempt to) Persist all existing versions More... | |
void | trim (const int64_t &earliest_version) noexcept(false) |
Trims the log of all versions earlier than the argument. More... | |
const int64_t | getMinimumLatestPersistedVersion () noexcept(false) |
Returns the minimum of the latest persisted versions among all Persistent fields. More... | |
void | truncate (const int64_t &last_version) |
Truncates the log, deleting all versions newer than the provided argument. More... | |
void | registerPersist (const char *obj_name, const VersionFunc &vf, const PersistFunc &pf, const TrimFunc &tf, const LatestPersistedGetterFunc &lpgf, const TruncateFunc &tcf) noexcept(false) |
set the latest version for serialization register a Persistent<T> along with its lambda More... | |
void | unregisterPersist (const char *obj_name) noexcept(false) |
deregister More... | |
const HLC | getFrontier () |
get temporal query frontier More... | |
void | updateTemporalFrontierProvider (ITemporalQueryFrontierProvider *tqfp) |
update temporal query frontier we didn't use a lock on this becuase we assume this is only updated object construction. More... | |
PersistentRegistry (PersistentRegistry &&)=default | |
Enable move constructor. More... | |
PersistentRegistry (const PersistentRegistry &)=delete | |
Disable copy constructor. More... | |
const char * | get_subgroup_prefix () |
Get prefix for subgroup, this will appear in the file name of Persistent<T> More... | |
Public Member Functions inherited from mutils::RemoteDeserializationContext | |
RemoteDeserializationContext (const RemoteDeserializationContext &)=delete | |
RemoteDeserializationContext (const RemoteDeserializationContext &&)=delete | |
virtual | ~RemoteDeserializationContext () |
RemoteDeserializationContext () | |
Static Public Member Functions | |
static void | setEarliestVersionToSerialize (const int64_t &ver) noexcept(true) |
Set the earliest version for serialization, exclusive. More... | |
static void | resetEarliestVersionToSerialize () noexcept(true) |
Reset the earliest version for serialization to an invalid "uninitialized" state. More... | |
static int64_t | getEarliestVersionToSerialize () noexcept(true) |
Returns the earliest version for serialization. More... | |
static std::string | generate_prefix (const std::type_index &subgroup_type, uint32_t subgroup_index, uint32_t shard_num) noexcept(true) |
prefix generator prefix format: [hex of subgroup_type]-[subgroup_index]-[shard_num] More... | |
static bool | match_prefix (const std::string str, const std::type_index &subgroup_type, uint32_t subgroup_index, uint32_t shard_num) noexcept(true) |
match prefix More... | |
Protected Member Functions | |
template<int funcIdx, typename... Args> | |
void | callFunc (Args... args) |
Helper function I. More... | |
template<int funcIdx, typename ReturnType , typename... Args> | |
ReturnType | callFuncMin (Args... args) |
Helper function II. More... | |
Protected Attributes | |
const std::string | _subgroup_prefix |
this appears in the first part of storage file for persistent<T> More... | |
ITemporalQueryFrontierProvider * | _temporal_query_frontier_provider |
Pointer to an entity providing TemporalQueryFrontier service. More... | |
std::map< std::size_t, std::tuple< VersionFunc, PersistFunc, TrimFunc, LatestPersistedGetterFunc, TruncateFunc > > | _registry |
Callback registry. More... | |
Static Protected Attributes | |
static thread_local int64_t | earliest_version_to_serialize = INVALID_VERSION |
Set the earliest version to serialize for recovery. More... | |
PersistentRegistry is a book for all the Persistent<T> or Volatile<T> variables.
Replicated<T> class should maintain such a registry to perform the following operations:
Definition at line 81 of file Persistent.hpp.
persistent::PersistentRegistry::PersistentRegistry | ( | ITemporalQueryFrontierProvider * | tqfp, |
const std::type_index & | subgroup_type, | ||
uint32_t | subgroup_index, | ||
uint32_t | shard_num | ||
) |
Definition at line 13 of file Persistent.cpp.
|
virtual |
Definition at line 22 of file Persistent.cpp.
|
default |
Enable move constructor.
|
delete |
Disable copy constructor.
|
protected |
Helper function I.
Definition at line 21 of file Persistent_impl.hpp.
|
protected |
Helper function II.
Definition at line 29 of file Persistent_impl.hpp.
|
staticnoexcept |
prefix generator prefix format: [hex of subgroup_type]-[subgroup_index]-[shard_num]
subgroup_type,the | type information of a subgroup |
subgroup_index,the | index of a subgroup |
shard_num,the | shard number of a subgroup |
Definition at line 88 of file Persistent.cpp.
const char * persistent::PersistentRegistry::get_subgroup_prefix | ( | ) |
Get prefix for subgroup, this will appear in the file name of Persistent<T>
Definition at line 84 of file Persistent.cpp.
|
staticnoexcept |
Returns the earliest version for serialization.
Definition at line 50 of file Persistent.cpp.
|
inline |
get temporal query frontier
Definition at line 146 of file Persistent.hpp.
|
noexcept |
Returns the minimum of the latest persisted versions among all Persistent fields.
Definition at line 38 of file Persistent.cpp.
|
noexcept |
Make a new version capturing the current state of the object.
Definition at line 26 of file Persistent.cpp.
|
staticnoexcept |
match prefix
str,a | string begin with a prefix like [hex64 of subgroup_type]-[subgroup_index]-[shard_num]- |
subgroup_type,the | type information of a subgroup |
subgroup_index,the | index of a subgroup |
shard_num,the | shard number of a subgroup |
Definition at line 102 of file Persistent.cpp.
|
noexcept |
(attempt to) Persist all existing versions
Definition at line 30 of file Persistent.cpp.
|
noexcept |
set the latest version for serialization register a Persistent<T> along with its lambda
Definition at line 58 of file Persistent.cpp.
|
staticnoexcept |
Reset the earliest version for serialization to an invalid "uninitialized" state.
Definition at line 46 of file Persistent.cpp.
|
staticnoexcept |
Set the earliest version for serialization, exclusive.
This version will be stored in a thread-local variable. When to_bytes() is next called on Persistent<T>, it will serialize the logs starting after that version (so the serialized logs exclude version ver).
ver | The version after which to begin serializing logs |
Definition at line 42 of file Persistent.cpp.
|
noexcept |
Trims the log of all versions earlier than the argument.
Definition at line 34 of file Persistent.cpp.
void persistent::PersistentRegistry::truncate | ( | const int64_t & | last_version | ) |
Truncates the log, deleting all versions newer than the provided argument.
Since this throws away recently-used data, it should only be used during failure recovery when those versions must be rolled back.
Definition at line 54 of file Persistent.cpp.
|
noexcept |
deregister
Definition at line 75 of file Persistent.cpp.
void persistent::PersistentRegistry::updateTemporalFrontierProvider | ( | ITemporalQueryFrontierProvider * | tqfp | ) |
update temporal query frontier we didn't use a lock on this becuase we assume this is only updated object construction.
please use this when you are sure there is no concurrent threads relying on it.
Definition at line 80 of file Persistent.cpp.
|
protected |
Callback registry.
Definition at line 217 of file Persistent.hpp.
|
protected |
this appears in the first part of storage file for persistent<T>
Definition at line 207 of file Persistent.hpp.
|
protected |
Pointer to an entity providing TemporalQueryFrontier service.
Definition at line 212 of file Persistent.hpp.
|
staticprotected |
Set the earliest version to serialize for recovery.
Definition at line 234 of file Persistent.hpp.