libfoedus-core
FOEDUS Core Library
|
Snapshot manager that atomically and durably writes out a snapshot file. More...
Snapshot manager that atomically and durably writes out a snapshot file.
Definition at line 31 of file snapshot_manager.hpp.
#include <snapshot_manager.hpp>
Public Member Functions | |
SnapshotManager (Engine *engine) | |
~SnapshotManager () | |
SnapshotManager ()=delete | |
SnapshotManager (const SnapshotManager &)=delete | |
SnapshotManager & | operator= (const SnapshotManager &)=delete |
ErrorStack | initialize () override |
Acquires resources in this object, usually called right after constructor. More... | |
bool | is_initialized () const override |
Returns whether the object has been already initialized or not. More... | |
ErrorStack | uninitialize () override |
An idempotent method to release all resources of this object, if any. More... | |
Epoch | get_snapshot_epoch () const |
Returns the most recently snapshot-ed epoch, all logs upto this epoch is safe to delete. More... | |
Epoch | get_snapshot_epoch_weak () const |
Non-atomic version. More... | |
SnapshotId | get_previous_snapshot_id () const |
Returns the most recent snapshot's ID. More... | |
SnapshotId | get_previous_snapshot_id_weak () const |
Non-atomic version. More... | |
ErrorStack | read_snapshot_metadata (SnapshotId snapshot_id, SnapshotMetadata *out) |
Read the snapshot metadata file that contains storages as of the snapshot. More... | |
void | trigger_snapshot_immediate (bool wait_completion, Epoch suggested_snapshot_epoch=INVALID_EPOCH) |
Immediately take a snapshot. More... | |
SnapshotManagerPimpl * | get_pimpl () |
Do not use this unless you know what you are doing. More... | |
![]() | |
virtual | ~Initializable () |
|
explicit |
Definition at line 22 of file snapshot_manager.cpp.
foedus::snapshot::SnapshotManager::~SnapshotManager | ( | ) |
Definition at line 25 of file snapshot_manager.cpp.
|
delete |
|
delete |
|
inline |
Do not use this unless you know what you are doing.
Definition at line 79 of file snapshot_manager.hpp.
Referenced by foedus::restart::RestartManagerPimpl::recover(), and foedus::restart::RestartManagerPimpl::uninitialize_once().
SnapshotId foedus::snapshot::SnapshotManager::get_previous_snapshot_id | ( | ) | const |
Returns the most recent snapshot's ID.
kNullSnapshotId if no snapshot is taken.
Definition at line 39 of file snapshot_manager.cpp.
References foedus::snapshot::SnapshotManagerPimpl::get_previous_snapshot_id().
SnapshotId foedus::snapshot::SnapshotManager::get_previous_snapshot_id_weak | ( | ) | const |
Non-atomic version.
Definition at line 43 of file snapshot_manager.cpp.
References foedus::snapshot::SnapshotManagerPimpl::get_previous_snapshot_id_weak().
Epoch foedus::snapshot::SnapshotManager::get_snapshot_epoch | ( | ) | const |
Returns the most recently snapshot-ed epoch, all logs upto this epoch is safe to delete.
If not snapshot has been taken, invalid epoch.
Definition at line 34 of file snapshot_manager.cpp.
References foedus::snapshot::SnapshotManagerPimpl::get_snapshot_epoch().
Referenced by foedus::restart::RestartManagerPimpl::recover().
Epoch foedus::snapshot::SnapshotManager::get_snapshot_epoch_weak | ( | ) | const |
Non-atomic version.
Definition at line 35 of file snapshot_manager.cpp.
References foedus::snapshot::SnapshotManagerPimpl::get_snapshot_epoch_weak().
|
overridevirtual |
Acquires resources in this object, usually called right after constructor.
If and only if the return value was not an error, is_initialized() will return TRUE. This method is usually not idempotent, but some implementation can choose to be. In that case, the implementation class should clarify that it's idempotent. This method is responsible for releasing all acquired resources when initialization fails. This method itself is NOT thread-safe. Do not call this in a racy situation.
Implements foedus::Initializable.
Definition at line 30 of file snapshot_manager.cpp.
References foedus::DefaultInitializable::initialize().
|
overridevirtual |
Returns whether the object has been already initialized or not.
Implements foedus::Initializable.
Definition at line 31 of file snapshot_manager.cpp.
References foedus::DefaultInitializable::is_initialized().
|
delete |
ErrorStack foedus::snapshot::SnapshotManager::read_snapshot_metadata | ( | SnapshotId | snapshot_id, |
SnapshotMetadata * | out | ||
) |
Read the snapshot metadata file that contains storages as of the snapshot.
This is used only when the engine starts up.
Definition at line 47 of file snapshot_manager.cpp.
References foedus::snapshot::SnapshotManagerPimpl::read_snapshot_metadata().
Referenced by foedus::storage::StorageManagerPimpl::initialize_read_latest_snapshot().
void foedus::snapshot::SnapshotManager::trigger_snapshot_immediate | ( | bool | wait_completion, |
Epoch | suggested_snapshot_epoch = INVALID_EPOCH |
||
) |
Immediately take a snapshot.
[in] | wait_completion | whether to block until the completion of entire snapshotting |
[in] | suggested_snapshot_epoch | the epoch up to which we will snapshot. Must be a durable epoch that is after the previous snapshot epoch. If not specified, the latest durable epoch is used, which is in most cases what you want. |
This method is used to immediately take snapshot for either recovery or memory-saving purpose.
Definition at line 52 of file snapshot_manager.cpp.
References foedus::snapshot::SnapshotManagerPimpl::trigger_snapshot_immediate().
|
overridevirtual |
An idempotent method to release all resources of this object, if any.
After this method, is_initialized() will return FALSE. Whether this method encounters an error or not, the implementation should make the best effort to release as many resources as possible. In other words, Do not leak all resources because of one issue. This method itself is NOT thread-safe. Do not call this in a racy situation.
Implements foedus::Initializable.
Definition at line 32 of file snapshot_manager.cpp.
References foedus::DefaultInitializable::uninitialize().