PersistenceManager is responsible for persisting all the data in a group. More...
#include <persistence_manager.hpp>
Public Member Functions | |
PersistenceManager (std::map< subgroup_id_t, std::reference_wrapper< ReplicatedObject >> &objects_map, const persistence_callback_t &_persistence_callback) | |
Constructor. More... | |
virtual | ~PersistenceManager () |
default Destructor More... | |
void | set_view_manager (ViewManager &view_manager) |
void | start () |
Start the persistent thread. More... | |
void | post_persist_request (const subgroup_id_t &subgroup_id, const persistent::version_t &version) |
post a persistence request More... | |
void | make_version (const subgroup_id_t &subgroup_id, const persistent::version_t &version, const HLC &mhlc) |
make a version More... | |
void | shutdown (bool wait) |
shutdown the thread - wait till the thread finished or not. More... | |
persistence_manager_callbacks_t | get_callbacks () |
get the persistence callbacks. More... | |
Private Attributes | |
std::thread | persist_thread |
Thread handle. More... | |
std::atomic< bool > | thread_shutdown |
A flag to singal the persistent thread to shutdown; set to true when the group is destroyed. More... | |
sem_t | persistence_request_sem |
The semaphore for persistence request the persistent thread. More... | |
std::queue< persistence_request_t > | persistence_request_queue |
a queue for the requests More... | |
std::atomic_flag | prq_lock = ATOMIC_FLAG_INIT |
lock for persistence request queue More... | |
persistence_callback_t | persistence_callback |
persistence callback More... | |
std::map< subgroup_id_t, std::reference_wrapper< ReplicatedObject > > & | objects_by_subgroup_id |
Replicated Objects handle: TODO:make it safer. More... | |
ViewManager * | view_manager |
View Manager pointer. More... | |
PersistenceManager is responsible for persisting all the data in a group.
Definition at line 28 of file persistence_manager.hpp.
derecho::PersistenceManager::PersistenceManager | ( | std::map< subgroup_id_t, std::reference_wrapper< ReplicatedObject >> & | objects_map, |
const persistence_callback_t & | _persistence_callback | ||
) |
Constructor.
objects_map | reference to the objects_by_subgroup_id from Group. |
Definition at line 13 of file persistence_manager.cpp.
|
virtual |
default Destructor
Definition at line 28 of file persistence_manager.cpp.
persistence_manager_callbacks_t derecho::PersistenceManager::get_callbacks | ( | ) |
get the persistence callbacks.
The multicast_group object will use this to notify the persistence thread about it.
Definition at line 136 of file persistence_manager.cpp.
void derecho::PersistenceManager::make_version | ( | const subgroup_id_t & | subgroup_id, |
const persistent::version_t & | version, | ||
const HLC & | mhlc | ||
) |
make a version
Definition at line 111 of file persistence_manager.cpp.
void derecho::PersistenceManager::post_persist_request | ( | const subgroup_id_t & | subgroup_id, |
const persistent::version_t & | version | ||
) |
post a persistence request
Definition at line 100 of file persistence_manager.cpp.
void derecho::PersistenceManager::set_view_manager | ( | ViewManager & | view_manager | ) |
Definition at line 32 of file persistence_manager.cpp.
void derecho::PersistenceManager::shutdown | ( | bool | wait | ) |
shutdown the thread - wait till the thread finished or not.
Definition at line 122 of file persistence_manager.cpp.
void derecho::PersistenceManager::start | ( | ) |
Start the persistent thread.
Definition at line 37 of file persistence_manager.cpp.
|
private |
Replicated Objects handle: TODO:make it safer.
Definition at line 44 of file persistence_manager.hpp.
|
private |
Thread handle.
Definition at line 31 of file persistence_manager.hpp.
|
private |
persistence callback
Definition at line 42 of file persistence_manager.hpp.
|
private |
a queue for the requests
Definition at line 37 of file persistence_manager.hpp.
|
private |
The semaphore for persistence request the persistent thread.
Definition at line 35 of file persistence_manager.hpp.
|
private |
lock for persistence request queue
Definition at line 39 of file persistence_manager.hpp.
|
private |
A flag to singal the persistent thread to shutdown; set to true when the group is destroyed.
Definition at line 33 of file persistence_manager.hpp.
|
private |
View Manager pointer.
Need to access the SST for the purpose of updating persisted_num
Definition at line 46 of file persistence_manager.hpp.