Loading...
Searching...
No Matches
resdb::CheckPointManager Class Reference

#include <checkpoint_manager.h>

Inheritance diagram for resdb::CheckPointManager:
resdb::CheckPoint resdb::MockCheckPointManager

Public Member Functions

 CheckPointManager (const ResDBConfig &config, ReplicaCommunicator *replica_communicator, SignatureVerifier *verifier)
 
virtual ~CheckPointManager ()
 
ChainState * GetTxnDB ()
 
uint64_t GetMaxTxnSeq ()
 
void AddCommitData (std::unique_ptr< Request > request)
 
int ProcessCheckPoint (std::unique_ptr< Context > context, std::unique_ptr< Request > request)
 
uint64_t GetStableCheckpoint () override
 
StableCheckPoint GetStableCheckpointWithVotes ()
 
bool IsValidCheckpointProof (const StableCheckPoint &stable_ckpt)
 
void SetTimeoutHandler (std::function< void()> timeout_handler)
 
virtual void UpdateStableCheckPointCallback (int64_t current_stable_checkpoint)
 
void Stop ()
 
void TimeoutHandler ()
 
void WaitSignal ()
 
std::unique_ptr< std::pair< uint64_t, std::string > > PopStableSeqHash ()
 
void SetExecutor (TransactionExecutor *executor)
 
uint64_t GetHighestPreparedSeq ()
 
void SetHighestPreparedSeq (uint64_t seq)
 
sem_t * CommitableSeqSignal ()
 
uint64_t GetCommittableSeq ()
 
- Public Member Functions inherited from resdb::CheckPoint
 CheckPoint ()=default
 
virtual ~CheckPoint ()=default
 

Protected Attributes

ResDBConfig config_
 
ReplicaCommunicator * replica_communicator_
 
std::unique_ptr< ChainState > txn_db_
 
std::thread checkpoint_thread_
 
std::thread stable_checkpoint_thread_
 
SignatureVerifier * verifier_
 
std::atomic< bool > stop_
 
std::map< std::pair< uint64_t, std::string >, std::set< uint32_t > > sender_ckpt_
 
std::map< std::pair< uint64_t, std::string >, std::vector< SignatureInfo > > sign_ckpt_
 
std::map< std::pair< uint64_t, std::string >, std::vector< std::string > > hash_ckpt_
 
std::atomic< uint64_t > current_stable_seq_
 
std::mutex mutex_
 
LockFreeQueue< Request > data_queue_
 
std::mutex cv_mutex_
 
std::condition_variable cv_
 
std::function< void()> timeout_handler_
 
StableCheckPoint stable_ckpt_
 
int new_data_ = 0
 
LockFreeQueue< std::pair< uint64_t, std::string > > stable_hash_queue_
 
std::condition_variable signal_
 
ResDBTxnAccessor txn_accessor_
 
std::mutex lt_mutex_
 
uint64_t last_seq_ = 0
 
TransactionExecutor * executor_
 
std::atomic< uint64_t > highest_prepared_seq_
 
uint64_t committable_seq_ = 0
 
std::string last_hash_
 
std::string committable_hash_
 
sem_t committable_seq_signal_
 

Detailed Description

Definition at line 37 of file checkpoint_manager.h.

Constructor & Destructor Documentation

◆ CheckPointManager()

resdb::CheckPointManager::CheckPointManager ( const ResDBConfig &  config,
ReplicaCommunicator *  replica_communicator,
SignatureVerifier *  verifier 
)

Definition at line 29 of file checkpoint_manager.cpp.

◆ ~CheckPointManager()

resdb::CheckPointManager::~CheckPointManager ( )
virtual

Definition at line 52 of file checkpoint_manager.cpp.

Member Function Documentation

◆ AddCommitData()

void resdb::CheckPointManager::AddCommitData ( std::unique_ptr< Request >  request)

Definition at line 82 of file checkpoint_manager.cpp.

◆ CommitableSeqSignal()

sem_t * resdb::CheckPointManager::CommitableSeqSignal ( )

Definition at line 367 of file checkpoint_manager.cpp.

◆ GetCommittableSeq()

uint64_t resdb::CheckPointManager::GetCommittableSeq ( )

Definition at line 372 of file checkpoint_manager.cpp.

◆ GetHighestPreparedSeq()

uint64_t resdb::CheckPointManager::GetHighestPreparedSeq ( )

Definition at line 357 of file checkpoint_manager.cpp.

◆ GetMaxTxnSeq()

uint64_t resdb::CheckPointManager::GetMaxTxnSeq ( )

Definition at line 70 of file checkpoint_manager.cpp.

◆ GetStableCheckpoint()

uint64_t resdb::CheckPointManager::GetStableCheckpoint ( )
overridevirtual

Implements resdb::CheckPoint.

Definition at line 72 of file checkpoint_manager.cpp.

◆ GetStableCheckpointWithVotes()

StableCheckPoint resdb::CheckPointManager::GetStableCheckpointWithVotes ( )

Definition at line 77 of file checkpoint_manager.cpp.

◆ GetTxnDB()

ChainState * resdb::CheckPointManager::GetTxnDB ( )

Definition at line 68 of file checkpoint_manager.cpp.

◆ IsValidCheckpointProof()

bool resdb::CheckPointManager::IsValidCheckpointProof ( const StableCheckPoint &  stable_ckpt)

Definition at line 91 of file checkpoint_manager.cpp.

◆ PopStableSeqHash()

std::unique_ptr< std::pair< uint64_t, std::string > > resdb::CheckPointManager::PopStableSeqHash ( )

Definition at line 353 of file checkpoint_manager.cpp.

◆ ProcessCheckPoint()

int resdb::CheckPointManager::ProcessCheckPoint ( std::unique_ptr< Context >  context,
std::unique_ptr< Request >  request 
)

Definition at line 106 of file checkpoint_manager.cpp.

◆ SetExecutor()

void resdb::CheckPointManager::SetExecutor ( TransactionExecutor *  executor)
inline

Definition at line 66 of file checkpoint_manager.h.

◆ SetHighestPreparedSeq()

void resdb::CheckPointManager::SetHighestPreparedSeq ( uint64_t  seq)

Definition at line 362 of file checkpoint_manager.cpp.

◆ SetTimeoutHandler()

void resdb::CheckPointManager::SetTimeoutHandler ( std::function< void()>  timeout_handler)

Definition at line 279 of file checkpoint_manager.cpp.

◆ Stop()

void resdb::CheckPointManager::Stop ( )

Definition at line 54 of file checkpoint_manager.cpp.

◆ TimeoutHandler()

void resdb::CheckPointManager::TimeoutHandler ( )

Definition at line 284 of file checkpoint_manager.cpp.

◆ UpdateStableCheckPointCallback()

virtual void resdb::CheckPointManager::UpdateStableCheckPointCallback ( int64_t  current_stable_checkpoint)
inlinevirtual

Definition at line 56 of file checkpoint_manager.h.

◆ WaitSignal()

void resdb::CheckPointManager::WaitSignal ( )

Definition at line 347 of file checkpoint_manager.cpp.

Member Data Documentation

◆ checkpoint_thread_

std::thread resdb::CheckPointManager::checkpoint_thread_
protected

Definition at line 90 of file checkpoint_manager.h.

◆ committable_hash_

std::string resdb::CheckPointManager::committable_hash_
protected

Definition at line 114 of file checkpoint_manager.h.

◆ committable_seq_

uint64_t resdb::CheckPointManager::committable_seq_ = 0
protected

Definition at line 113 of file checkpoint_manager.h.

◆ committable_seq_signal_

sem_t resdb::CheckPointManager::committable_seq_signal_
protected

Definition at line 115 of file checkpoint_manager.h.

◆ config_

ResDBConfig resdb::CheckPointManager::config_
protected

Definition at line 87 of file checkpoint_manager.h.

◆ current_stable_seq_

std::atomic<uint64_t> resdb::CheckPointManager::current_stable_seq_
protected

Definition at line 98 of file checkpoint_manager.h.

◆ cv_

std::condition_variable resdb::CheckPointManager::cv_
protected

Definition at line 102 of file checkpoint_manager.h.

◆ cv_mutex_

std::mutex resdb::CheckPointManager::cv_mutex_
protected

Definition at line 101 of file checkpoint_manager.h.

◆ data_queue_

LockFreeQueue<Request> resdb::CheckPointManager::data_queue_
protected

Definition at line 100 of file checkpoint_manager.h.

◆ executor_

TransactionExecutor* resdb::CheckPointManager::executor_
protected

Definition at line 111 of file checkpoint_manager.h.

◆ hash_ckpt_

std::map<std::pair<uint64_t, std::string>, std::vector<std::string> > resdb::CheckPointManager::hash_ckpt_
protected

Definition at line 97 of file checkpoint_manager.h.

◆ highest_prepared_seq_

std::atomic<uint64_t> resdb::CheckPointManager::highest_prepared_seq_
protected

Definition at line 112 of file checkpoint_manager.h.

◆ last_hash_

std::string resdb::CheckPointManager::last_hash_
protected

Definition at line 114 of file checkpoint_manager.h.

◆ last_seq_

uint64_t resdb::CheckPointManager::last_seq_ = 0
protected

Definition at line 110 of file checkpoint_manager.h.

◆ lt_mutex_

std::mutex resdb::CheckPointManager::lt_mutex_
protected

Definition at line 109 of file checkpoint_manager.h.

◆ mutex_

std::mutex resdb::CheckPointManager::mutex_
protected

Definition at line 99 of file checkpoint_manager.h.

◆ new_data_

int resdb::CheckPointManager::new_data_ = 0
protected

Definition at line 105 of file checkpoint_manager.h.

◆ replica_communicator_

ReplicaCommunicator* resdb::CheckPointManager::replica_communicator_
protected

Definition at line 88 of file checkpoint_manager.h.

◆ sender_ckpt_

std::map<std::pair<uint64_t, std::string>, std::set<uint32_t> > resdb::CheckPointManager::sender_ckpt_
protected

Definition at line 93 of file checkpoint_manager.h.

◆ sign_ckpt_

std::map<std::pair<uint64_t, std::string>, std::vector<SignatureInfo> > resdb::CheckPointManager::sign_ckpt_
protected

Definition at line 95 of file checkpoint_manager.h.

◆ signal_

std::condition_variable resdb::CheckPointManager::signal_
protected

Definition at line 107 of file checkpoint_manager.h.

◆ stable_checkpoint_thread_

std::thread resdb::CheckPointManager::stable_checkpoint_thread_
protected

Definition at line 90 of file checkpoint_manager.h.

◆ stable_ckpt_

StableCheckPoint resdb::CheckPointManager::stable_ckpt_
protected

Definition at line 104 of file checkpoint_manager.h.

◆ stable_hash_queue_

LockFreeQueue<std::pair<uint64_t, std::string> > resdb::CheckPointManager::stable_hash_queue_
protected

Definition at line 106 of file checkpoint_manager.h.

◆ stop_

std::atomic<bool> resdb::CheckPointManager::stop_
protected

Definition at line 92 of file checkpoint_manager.h.

◆ timeout_handler_

std::function<void()> resdb::CheckPointManager::timeout_handler_
protected

Definition at line 103 of file checkpoint_manager.h.

◆ txn_accessor_

ResDBTxnAccessor resdb::CheckPointManager::txn_accessor_
protected

Definition at line 108 of file checkpoint_manager.h.

◆ txn_db_

std::unique_ptr<ChainState> resdb::CheckPointManager::txn_db_
protected

Definition at line 89 of file checkpoint_manager.h.

◆ verifier_

SignatureVerifier* resdb::CheckPointManager::verifier_
protected

Definition at line 91 of file checkpoint_manager.h.