libfoedus-core
FOEDUS Core Library
|
Represents the data in one snapshot metadata file. More...
Represents the data in one snapshot metadata file.
One snapshot metadata file is written for each snapshotting as an xml file. It contains metadata of all storages and a few other global things.
We write it out as part of snapshotting. We read it at restart.
Definition at line 44 of file snapshot_metadata.hpp.
#include <snapshot_metadata.hpp>
Public Member Functions | |
void | clear () |
storage::Metadata * | get_metadata (storage::StorageId id) |
ErrorStack | load (tinyxml2::XMLElement *element) override |
Reads the content of this object from the given XML element. More... | |
ErrorStack | save (tinyxml2::XMLElement *element) const override |
Writes the content of this object to the given XML element. More... | |
const char * | get_tag_name () const override |
Returns an XML tag name for this object as a root element. More... | |
void | assign (const foedus::externalize::Externalizable *other) override |
Polymorphic assign operator. More... | |
![]() | |
ErrorStack | load_from_string (const std::string &xml) |
Load the content of this object from the given XML string. More... | |
void | save_to_stream (std::ostream *ptr) const |
Invokes save() and directs the resulting XML text to the given stream. More... | |
ErrorStack | load_from_file (const fs::Path &path) |
Load the content of this object from the specified XML file. More... | |
ErrorStack | save_to_file (const fs::Path &path) const |
Atomically and durably writes out this object to the specified XML file. More... | |
Public Attributes | |
SnapshotId | id_ |
Equivalent to Snapshot::id_. More... | |
Epoch::EpochInteger | base_epoch_ |
Equivalent to Snapshot::base_epoch_. More... | |
Epoch::EpochInteger | valid_until_epoch_ |
Equivalent to Snapshot::valid_until_epoch_. More... | |
storage::StorageId | largest_storage_id_ |
The largest StorageId we so far observed. More... | |
storage::StorageControlBlock * | storage_control_blocks_ |
control block of all storages. More... | |
memory::AlignedMemory | storage_control_blocks_memory_ |
Memory backing storage_control_blocks_. More... | |
Additional Inherited Members | |
![]() | |
static ErrorStack | insert_comment (tinyxml2::XMLElement *element, const std::string &comment) |
static ErrorStack | append_comment (tinyxml2::XMLElement *parent, const std::string &comment) |
static ErrorStack | create_element (tinyxml2::XMLElement *parent, const std::string &name, tinyxml2::XMLElement **out) |
template<typename T > | |
static ErrorStack | add_element (tinyxml2::XMLElement *parent, const std::string &tag, const std::string &comment, T value) |
Only declaration in header. More... | |
template<uint MAXLEN, typename CHAR > | |
static ErrorStack | add_element (tinyxml2::XMLElement *parent, const std::string &tag, const std::string &comment, const assorted::FixedString< MAXLEN, CHAR > &value) |
template<typename T > | |
static ErrorStack | add_element (tinyxml2::XMLElement *parent, const std::string &tag, const std::string &comment, const std::vector< T > &value) |
vector version More... | |
template<typename ENUM > | |
static ErrorStack | add_enum_element (tinyxml2::XMLElement *parent, const std::string &tag, const std::string &comment, ENUM value) |
enum version More... | |
static ErrorStack | add_child_element (tinyxml2::XMLElement *parent, const std::string &tag, const std::string &comment, const Externalizable &child) |
child Externalizable version More... | |
template<typename T > | |
static ErrorStack | get_element (tinyxml2::XMLElement *parent, const std::string &tag, T *out, bool optional=false, T value=0) |
Only declaration in header. More... | |
static ErrorStack | get_element (tinyxml2::XMLElement *parent, const std::string &tag, std::string *out, bool optional=false, const char *value="") |
string type is bit special. More... | |
template<uint MAXLEN, typename CHAR > | |
static ErrorStack | get_element (tinyxml2::XMLElement *parent, const std::string &tag, assorted::FixedString< MAXLEN, CHAR > *out, bool optional=false, const assorted::FixedString< MAXLEN, CHAR > &value=assorted::FixedString< MAXLEN, CHAR >()) |
template<typename ENUM > | |
static ErrorStack | get_enum_element (tinyxml2::XMLElement *parent, const std::string &tag, ENUM *out, bool optional=false, ENUM default_value=static_cast< ENUM >(0)) |
enum version More... | |
template<typename T > | |
static ErrorStack | get_element (tinyxml2::XMLElement *parent, const std::string &tag, std::vector< T > *out, bool optional=false) |
vector version. More... | |
static ErrorStack | get_child_element (tinyxml2::XMLElement *parent, const std::string &tag, Externalizable *child, bool optional=false) |
child Externalizable version More... | |
|
overridevirtual |
Polymorphic assign operator.
This should invoke operator= of the derived class.
[in] | other | assigned value. It must be dynamic-castable to the assignee class. |
Implements foedus::externalize::Externalizable.
Definition at line 100 of file snapshot_metadata.cpp.
References ASSERT_ND.
void foedus::snapshot::SnapshotMetadata::clear | ( | ) |
Definition at line 33 of file snapshot_metadata.cpp.
References base_epoch_, id_, foedus::Epoch::kEpochInvalid, foedus::snapshot::kNullSnapshotId, largest_storage_id_, foedus::memory::AlignedMemory::release_block(), storage_control_blocks_, storage_control_blocks_memory_, and valid_until_epoch_.
Referenced by load().
|
inline |
Definition at line 46 of file snapshot_metadata.hpp.
References foedus::storage::StorageControlBlock::meta_, and storage_control_blocks_.
Referenced by foedus::snapshot::SnapshotManagerPimpl::snapshot_metadata().
|
inlineoverridevirtual |
Returns an XML tag name for this object as a root element.
We might want to give a different name for same externalizable objects, so this is used only when it is the root element of xml.
Implements foedus::externalize::Externalizable.
Definition at line 52 of file snapshot_metadata.hpp.
|
overridevirtual |
Reads the content of this object from the given XML element.
[in] | element | the XML element that represents this object |
Expect errors due to missing-elements, out-of-range values, etc.
Implements foedus::externalize::Externalizable.
Definition at line 42 of file snapshot_metadata.cpp.
References foedus::memory::AlignedMemory::alloc(), base_epoch_, CHECK_ERROR, clear(), EXTERNALIZE_LOAD_ELEMENT, foedus::memory::AlignedMemory::get_block(), foedus::memory::AlignedMemory::get_size(), id_, foedus::memory::AlignedMemory::kNumaAllocOnnode, foedus::kRetOk, foedus::soc::GlobalMemoryAnchors::kStorageMemorySize, largest_storage_id_, foedus::storage::MetadataSerializer::load_all_storages_from_xml(), storage_control_blocks_, storage_control_blocks_memory_, and valid_until_epoch_.
|
overridevirtual |
Writes the content of this object to the given XML element.
[in] | element | the XML element that represents this object |
Expect only out-of-memory error. We receive the XML element this object will represent, so this method does not determine the XML element name of itself. The parent object determines children's tag names because one parent object might have multiple child objects of the same type with different XML element name.
Implements foedus::externalize::Externalizable.
Definition at line 76 of file snapshot_metadata.cpp.
References base_epoch_, CHECK_ERROR, CHECK_OUTOFMEMORY, EXTERNALIZE_SAVE_ELEMENT, id_, foedus::externalize::Externalizable::insert_comment(), foedus::kRetOk, largest_storage_id_, foedus::storage::MetadataSerializer::save_all_storages_to_xml(), storage_control_blocks_, and valid_until_epoch_.
Epoch::EpochInteger foedus::snapshot::SnapshotMetadata::base_epoch_ |
Equivalent to Snapshot::base_epoch_.
Definition at line 59 of file snapshot_metadata.hpp.
Referenced by clear(), load(), save(), and foedus::snapshot::SnapshotManagerPimpl::snapshot_metadata().
SnapshotId foedus::snapshot::SnapshotMetadata::id_ |
Equivalent to Snapshot::id_.
Definition at line 56 of file snapshot_metadata.hpp.
Referenced by clear(), load(), foedus::snapshot::SnapshotManagerPimpl::read_snapshot_metadata(), save(), and foedus::snapshot::SnapshotManagerPimpl::snapshot_metadata().
storage::StorageId foedus::snapshot::SnapshotMetadata::largest_storage_id_ |
The largest StorageId we so far observed.
Definition at line 65 of file snapshot_metadata.hpp.
Referenced by clear(), foedus::storage::StorageManagerPimpl::clone_all_storage_metadata(), foedus::storage::StorageManagerPimpl::initialize_read_latest_snapshot(), load(), save(), and foedus::snapshot::SnapshotManagerPimpl::snapshot_metadata().
storage::StorageControlBlock* foedus::snapshot::SnapshotMetadata::storage_control_blocks_ |
control block of all storages.
This is a copy of the shared memory, so no need to delete.
Definition at line 72 of file snapshot_metadata.hpp.
Referenced by clear(), foedus::storage::StorageManagerPimpl::clone_all_storage_metadata(), get_metadata(), foedus::storage::StorageManagerPimpl::initialize_read_latest_snapshot(), load(), save(), and foedus::snapshot::SnapshotManagerPimpl::snapshot_metadata().
memory::AlignedMemory foedus::snapshot::SnapshotMetadata::storage_control_blocks_memory_ |
Memory backing storage_control_blocks_.
Definition at line 75 of file snapshot_metadata.hpp.
Referenced by clear(), foedus::storage::StorageManagerPimpl::clone_all_storage_metadata(), and load().
Epoch::EpochInteger foedus::snapshot::SnapshotMetadata::valid_until_epoch_ |
Equivalent to Snapshot::valid_until_epoch_.
Definition at line 62 of file snapshot_metadata.hpp.
Referenced by clear(), load(), save(), and foedus::snapshot::SnapshotManagerPimpl::snapshot_metadata().