Derecho  0.9
Distributed systems toolkit for RDMA
Public Member Functions | Private Attributes | List of all members
derecho::PersistenceManager Class Reference

PersistenceManager is responsible for persisting all the data in a group. More...

#include <persistence_manager.hpp>

Collaboration diagram for derecho::PersistenceManager:
Collaboration graph
[legend]

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_tpersistence_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...
 
ViewManagerview_manager
 View Manager pointer. More...
 

Detailed Description

PersistenceManager is responsible for persisting all the data in a group.

Definition at line 28 of file persistence_manager.hpp.

Constructor & Destructor Documentation

◆ PersistenceManager()

derecho::PersistenceManager::PersistenceManager ( std::map< subgroup_id_t, std::reference_wrapper< ReplicatedObject >> &  objects_map,
const persistence_callback_t _persistence_callback 
)

Constructor.

Parameters
objects_mapreference to the objects_by_subgroup_id from Group.

Definition at line 13 of file persistence_manager.cpp.

◆ ~PersistenceManager()

derecho::PersistenceManager::~PersistenceManager ( )
virtual

default Destructor

Definition at line 28 of file persistence_manager.cpp.

Member Function Documentation

◆ get_callbacks()

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.

◆ make_version()

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.

◆ post_persist_request()

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.

◆ set_view_manager()

void derecho::PersistenceManager::set_view_manager ( ViewManager view_manager)

Definition at line 32 of file persistence_manager.cpp.

◆ shutdown()

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.

◆ start()

void derecho::PersistenceManager::start ( )

Start the persistent thread.

Definition at line 37 of file persistence_manager.cpp.

Member Data Documentation

◆ objects_by_subgroup_id

std::map<subgroup_id_t, std::reference_wrapper<ReplicatedObject> >& derecho::PersistenceManager::objects_by_subgroup_id
private

Replicated Objects handle: TODO:make it safer.

Definition at line 44 of file persistence_manager.hpp.

◆ persist_thread

std::thread derecho::PersistenceManager::persist_thread
private

Thread handle.

Definition at line 31 of file persistence_manager.hpp.

◆ persistence_callback

persistence_callback_t derecho::PersistenceManager::persistence_callback
private

persistence callback

Definition at line 42 of file persistence_manager.hpp.

◆ persistence_request_queue

std::queue<persistence_request_t> derecho::PersistenceManager::persistence_request_queue
private

a queue for the requests

Definition at line 37 of file persistence_manager.hpp.

◆ persistence_request_sem

sem_t derecho::PersistenceManager::persistence_request_sem
private

The semaphore for persistence request the persistent thread.

Definition at line 35 of file persistence_manager.hpp.

◆ prq_lock

std::atomic_flag derecho::PersistenceManager::prq_lock = ATOMIC_FLAG_INIT
private

lock for persistence request queue

Definition at line 39 of file persistence_manager.hpp.

◆ thread_shutdown

std::atomic<bool> derecho::PersistenceManager::thread_shutdown
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.

◆ view_manager

ViewManager* derecho::PersistenceManager::view_manager
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.


The documentation for this class was generated from the following files: