rippled
|
Keeps track of which ledgers haven't been fully saved. More...
Public Member Functions | |
bool | startWork (LedgerIndex seq) |
Start working on a ledger. More... | |
void | finishWork (LedgerIndex seq) |
Finish working on a ledger. More... | |
bool | pending (LedgerIndex seq) |
Return true if a ledger is in the progress of being saved. More... | |
bool | shouldWork (LedgerIndex seq, bool isSynchronous) |
Check if a ledger should be dispatched. More... | |
std::map< LedgerIndex, bool > | getSnapshot () const |
Get a snapshot of the pending saves. More... | |
Private Attributes | |
std::mutex | mutex_ |
std::map< LedgerIndex, bool > | map_ |
std::condition_variable | await_ |
Keeps track of which ledgers haven't been fully saved.
During the ledger building process this collection will keep track of those ledgers that are being built but have not yet been completely written.
Definition at line 36 of file PendingSaves.h.
bool ripple::PendingSaves::startWork | ( | LedgerIndex | seq | ) |
Start working on a ledger.
This is called prior to updating the SQLite indexes.
Definition at line 51 of file PendingSaves.h.
void ripple::PendingSaves::finishWork | ( | LedgerIndex | seq | ) |
Finish working on a ledger.
This is called after updating the SQLite indexes. The tracking of the work in progress is removed and threads awaiting completion are notified.
Definition at line 74 of file PendingSaves.h.
bool ripple::PendingSaves::pending | ( | LedgerIndex | seq | ) |
Return true
if a ledger is in the progress of being saved.
Definition at line 84 of file PendingSaves.h.
bool ripple::PendingSaves::shouldWork | ( | LedgerIndex | seq, |
bool | isSynchronous | ||
) |
Check if a ledger should be dispatched.
Called to determine whether work should be done or dispatched. If work is already in progress and the call is synchronous, wait for work to be completed.
Definition at line 99 of file PendingSaves.h.
std::map<LedgerIndex, bool> ripple::PendingSaves::getSnapshot | ( | ) | const |
Get a snapshot of the pending saves.
Each entry in the returned map corresponds to a ledger that is in progress or dispatched. The boolean indicates whether work is currently in progress.
Definition at line 137 of file PendingSaves.h.
|
mutableprivate |
Definition at line 39 of file PendingSaves.h.
|
private |
Definition at line 40 of file PendingSaves.h.
|
private |
Definition at line 41 of file PendingSaves.h.