rippled
|
Classes | |
struct | AcquireInfo |
class | Count |
struct | StoreLedgerResult |
Store a ledger. More... | |
Public Member Functions | |
Shard (Shard const &)=delete | |
Copy constructor (disallowed) More... | |
Shard (Shard &&)=delete | |
Move constructor (disallowed) More... | |
Shard & | operator= (Shard const &)=delete |
Shard & | operator= (Shard &&)=delete |
Shard (Application &app, DatabaseShard const &db, std::uint32_t index, boost::filesystem::path const &dir, beast::Journal j) | |
Shard (Application &app, DatabaseShard const &db, std::uint32_t index, beast::Journal j) | |
~Shard () | |
bool | init (Scheduler &scheduler, nudb::context &context) |
Initialize shard. More... | |
bool | isOpen () const |
Returns true if the database are open. More... | |
bool | tryClose () |
Try to close databases if not in use. More... | |
void | stop () noexcept |
Notify shard to prepare for shutdown. More... | |
std::optional< std::uint32_t > | prepare () |
bool | storeNodeObject (std::shared_ptr< NodeObject > const &nodeObject) |
std::shared_ptr< NodeObject > | fetchNodeObject (uint256 const &hash, FetchReport &fetchReport) |
StoreLedgerResult | storeLedger (std::shared_ptr< Ledger const > const &srcLedger, std::shared_ptr< Ledger const > const &next) |
bool | setLedgerStored (std::shared_ptr< Ledger const > const &ledger) |
bool | containsLedger (std::uint32_t ledgerSeq) const |
std::uint32_t | index () const noexcept |
boost::filesystem::path const & | getDir () const noexcept |
std::chrono::steady_clock::time_point | getLastUse () const |
std::pair< std::uint64_t, std::uint32_t > | getFileInfo () const |
Returns a pair where the first item describes the storage space utilized and the second item is the number of file descriptors required. More... | |
ShardState | getState () const noexcept |
std::uint32_t | getPercentProgress () const noexcept |
Returns a percent signifying how complete the current state of the shard is. More... | |
std::int32_t | getWriteLoad () |
bool | isLegacy () const |
Returns true if shard is older, without final key data. More... | |
bool | finalize (bool writeSQLite, std::optional< uint256 > const &referenceHash) |
Finalize shard by walking its ledgers, verifying each Merkle tree and creating a deterministic backend. More... | |
void | removeOnDestroy () noexcept |
Enables removal of the shard directory on destruction. More... | |
std::string | getStoredSeqs () |
template<typename... Args> | |
bool | callForLedgerSQL (std::function< bool(Args... args)> const &callback) |
Invoke a callback on the ledger SQLite db. More... | |
template<typename... Args> | |
bool | callForTransactionSQL (std::function< bool(Args... args)> const &callback) |
Invoke a callback on the transaction SQLite db. More... | |
Static Public Attributes | |
static constexpr std::uint32_t | version {2} |
static const uint256 | finalKey {0} |
Private Member Functions | |
GUARDED_BY(mutex_) std GUARDED_BY(mutex_) std std::unique_ptr< Backend > backend_ | GUARDED_BY (mutex_) |
std::unique_ptr< DatabaseCon > lgrSQLiteDB_ | GUARDED_BY (mutex_) |
std::unique_ptr< DatabaseCon > txSQLiteDB_ | GUARDED_BY (mutex_) |
std::unique_ptr< AcquireInfo > acquireInfo_ | GUARDED_BY (mutex_) |
GUARDED_BY (mutex_) bool legacy_ | |
std::chrono::steady_clock::time_point lastAccess_ | GUARDED_BY (mutex_) |
bool | open (std::lock_guard< std::mutex > const &lock) REQUIRES(mutex_) |
bool | initSQLite (std::lock_guard< std::mutex > const &) REQUIRES(mutex_) |
bool | storeSQLite (std::shared_ptr< Ledger const > const &ledger) |
void | setFileStats (std::lock_guard< std::mutex > const &) REQUIRES(mutex_) |
bool | verifyLedger (std::shared_ptr< Ledger const > const &ledger, std::shared_ptr< Ledger const > const &next, std::shared_ptr< DeterministicShard > const &dShard) const |
std::shared_ptr< NodeObject > | verifyFetch (uint256 const &hash) const |
Shard::Count | makeBackendCount () |
template<typename... Args> | |
bool | callForSQL (std::function< bool(Args... args)> const &callback, LockedSociSession &&db) |
bool | doCallForSQL (std::function< bool(soci::session &session)> const &callback, LockedSociSession &&db) |
bool | doCallForSQL (std::function< bool(soci::session &session, std::uint32_t shardIndex)> const &callback, LockedSociSession &&db) |
Private Attributes | |
Application & | app_ |
const beast::Journal | j_ |
std::mutex | mutex_ |
std::mutex | storedMutex_ |
const std::uint32_t | index_ |
const std::uint32_t | firstSeq_ |
const std::uint32_t | lastSeq_ |
const std::uint32_t | maxLedgers_ |
const boost::filesystem::path | dir_ |
std::atomic< std::uint32_t > | backendCount_ {0} |
std::atomic< bool > | stop_ {false} |
std::atomic< bool > | busy_ {false} |
std::atomic< ShardState > | state_ {ShardState::acquire} |
std::atomic< std::uint32_t > | progress_ {0} |
std::atomic< bool > | removeOnDestroy_ {false} |
Definition at line 55 of file nodestore/impl/Shard.h.
|
delete |
Copy constructor (disallowed)
|
delete |
Move constructor (disallowed)
ripple::NodeStore::Shard::Shard | ( | Application & | app, |
DatabaseShard const & | db, | ||
std::uint32_t | index, | ||
boost::filesystem::path const & | dir, | ||
beast::Journal | j | ||
) |
Definition at line 44 of file nodestore/impl/Shard.cpp.
ripple::NodeStore::Shard::Shard | ( | Application & | app, |
DatabaseShard const & | db, | ||
std::uint32_t | index, | ||
beast::Journal | j | ||
) |
Definition at line 35 of file nodestore/impl/Shard.cpp.
ripple::NodeStore::Shard::~Shard | ( | ) |
Definition at line 60 of file nodestore/impl/Shard.cpp.
bool ripple::NodeStore::Shard::init | ( | Scheduler & | scheduler, |
nudb::context & | context | ||
) |
Initialize shard.
scheduler | The scheduler to use for performing asynchronous tasks. |
context | The context to use for the backend. |
Definition at line 95 of file nodestore/impl/Shard.cpp.
bool ripple::NodeStore::Shard::isOpen | ( | ) | const |
Returns true if the database are open.
Definition at line 127 of file nodestore/impl/Shard.cpp.
bool ripple::NodeStore::Shard::tryClose | ( | ) |
Try to close databases if not in use.
Definition at line 140 of file nodestore/impl/Shard.cpp.
|
noexcept |
Notify shard to prepare for shutdown.
Definition at line 110 of file nodestore/impl/Shard.h.
std::optional< std::uint32_t > ripple::NodeStore::Shard::prepare | ( | ) |
Definition at line 184 of file nodestore/impl/Shard.cpp.
bool ripple::NodeStore::Shard::storeNodeObject | ( | std::shared_ptr< NodeObject > const & | nodeObject | ) |
Definition at line 207 of file nodestore/impl/Shard.cpp.
std::shared_ptr< NodeObject > ripple::NodeStore::Shard::fetchNodeObject | ( | uint256 const & | hash, |
FetchReport & | fetchReport | ||
) |
Definition at line 241 of file nodestore/impl/Shard.cpp.
Shard::StoreLedgerResult ripple::NodeStore::Shard::storeLedger | ( | std::shared_ptr< Ledger const > const & | srcLedger, |
std::shared_ptr< Ledger const > const & | next | ||
) |
Definition at line 290 of file nodestore/impl/Shard.cpp.
bool ripple::NodeStore::Shard::setLedgerStored | ( | std::shared_ptr< Ledger const > const & | ledger | ) |
Definition at line 416 of file nodestore/impl/Shard.cpp.
bool ripple::NodeStore::Shard::containsLedger | ( | std::uint32_t | ledgerSeq | ) | const |
Definition at line 507 of file nodestore/impl/Shard.cpp.
|
noexcept |
Definition at line 149 of file nodestore/impl/Shard.h.
|
noexcept |
Definition at line 155 of file nodestore/impl/Shard.h.
std::chrono::steady_clock::time_point ripple::NodeStore::Shard::getLastUse | ( | ) | const |
Definition at line 525 of file nodestore/impl/Shard.cpp.
std::pair< std::uint64_t, std::uint32_t > ripple::NodeStore::Shard::getFileInfo | ( | ) | const |
Returns a pair where the first item describes the storage space utilized and the second item is the number of file descriptors required.
Definition at line 532 of file nodestore/impl/Shard.cpp.
|
noexcept |
Definition at line 170 of file nodestore/impl/Shard.h.
|
noexcept |
Returns a percent signifying how complete the current state of the shard is.
Definition at line 179 of file nodestore/impl/Shard.h.
std::int32_t ripple::NodeStore::Shard::getWriteLoad | ( | ) |
Definition at line 539 of file nodestore/impl/Shard.cpp.
bool ripple::NodeStore::Shard::isLegacy | ( | ) | const |
Returns true
if shard is older, without final key data.
Definition at line 549 of file nodestore/impl/Shard.cpp.
bool ripple::NodeStore::Shard::finalize | ( | bool | writeSQLite, |
std::optional< uint256 > const & | referenceHash | ||
) |
Finalize shard by walking its ledgers, verifying each Merkle tree and creating a deterministic backend.
writeSQLite | If true, SQLite entries will be rewritten using verified backend data. |
referenceHash | If present, this hash must match the hash of the last ledger in the shard. |
Definition at line 556 of file nodestore/impl/Shard.cpp.
|
noexcept |
Enables removal of the shard directory on destruction.
Definition at line 206 of file nodestore/impl/Shard.h.
std::string ripple::NodeStore::Shard::getStoredSeqs | ( | ) |
Definition at line 212 of file nodestore/impl/Shard.h.
bool ripple::NodeStore::Shard::callForLedgerSQL | ( | std::function< bool(Args... args)> const & | callback | ) |
Invoke a callback on the ledger SQLite db.
callback | Callback function to call. |
Definition at line 228 of file nodestore/impl/Shard.h.
bool ripple::NodeStore::Shard::callForTransactionSQL | ( | std::function< bool(Args... args)> const & | callback | ) |
Invoke a callback on the transaction SQLite db.
callback | Callback function to call. |
Definition at line 240 of file nodestore/impl/Shard.h.
|
private |
|
private |
|
private |
|
private |
|
private |
Definition at line 344 of file nodestore/impl/Shard.h.
|
private |
|
private |
Definition at line 831 of file nodestore/impl/Shard.cpp.
|
private |
Definition at line 958 of file nodestore/impl/Shard.cpp.
|
private |
Definition at line 1034 of file nodestore/impl/Shard.cpp.
|
private |
Definition at line 1081 of file nodestore/impl/Shard.cpp.
|
private |
Definition at line 1106 of file nodestore/impl/Shard.cpp.
|
private |
Definition at line 1192 of file nodestore/impl/Shard.cpp.
|
private |
Definition at line 1231 of file nodestore/impl/Shard.cpp.
|
private |
Definition at line 402 of file nodestore/impl/Shard.h.
|
private |
Definition at line 1254 of file nodestore/impl/Shard.cpp.
|
private |
Definition at line 1262 of file nodestore/impl/Shard.cpp.
|
staticconstexpr |
Definition at line 246 of file nodestore/impl/Shard.h.
|
static |
Definition at line 251 of file nodestore/impl/Shard.h.
|
private |
Definition at line 299 of file nodestore/impl/Shard.h.
|
private |
Definition at line 300 of file nodestore/impl/Shard.h.
|
mutableprivate |
Definition at line 301 of file nodestore/impl/Shard.h.
|
mutableprivate |
Definition at line 302 of file nodestore/impl/Shard.h.
|
private |
Definition at line 305 of file nodestore/impl/Shard.h.
|
private |
Definition at line 308 of file nodestore/impl/Shard.h.
|
private |
Definition at line 311 of file nodestore/impl/Shard.h.
|
private |
Definition at line 315 of file nodestore/impl/Shard.h.
|
private |
Definition at line 318 of file nodestore/impl/Shard.h.
|
private |
Definition at line 329 of file nodestore/impl/Shard.h.
|
private |
Definition at line 347 of file nodestore/impl/Shard.h.
|
private |
Definition at line 350 of file nodestore/impl/Shard.h.
|
private |
Definition at line 353 of file nodestore/impl/Shard.h.
|
private |
Definition at line 356 of file nodestore/impl/Shard.h.
|
private |
Definition at line 359 of file nodestore/impl/Shard.h.