20 #ifndef RIPPLE_APP_MISC_SHAMAPSTOREIMP_H_INCLUDED
21 #define RIPPLE_APP_MISC_SHAMAPSTOREIMP_H_INCLUDED
23 #include <ripple/app/ledger/LedgerMaster.h>
24 #include <ripple/app/misc/SHAMapStore.h>
25 #include <ripple/app/rdb/RelationalDatabase.h>
26 #include <ripple/app/rdb/State.h>
27 #include <ripple/core/DatabaseCon.h>
28 #include <ripple/nodestore/DatabaseRotating.h>
30 #include <ripple/nodestore/Scheduler.h>
191 template <
class CacheInstance>
197 for (
auto const& key : cache.getKeys())
Provides server functionality for clients.
LedgerIndex setCanDelete(LedgerIndex canDelete)
NodeStore::Scheduler & scheduler_
SHAMapStoreImp(Application &app, NodeStore::Scheduler &scheduler, beast::Journal journal)
std::shared_ptr< Ledger const > newLedger_
void onLedgerClosed(std::shared_ptr< Ledger const > const &ledger) override
Called by LedgerMaster every time a ledger validates.
static const std::uint32_t minimumDeletionInterval_
const std::string dbPrefix_
LedgerMaster * ledgerMaster_
Remembers which tree keys have all descendants resident.
std::unique_ptr< NodeStore::Database > makeNodeStore(int readThreads) override
LedgerIndex setCanDelete(LedgerIndex seq) override
Highest ledger that may be deleted.
const beast::Journal journal_
class to create database, launch online delete thread, and related SQLite database
const beast::Journal journal_
std::condition_variable cond_
LedgerIndex getCanDelete()
static constexpr auto nodeStoreName_
HealthResult healthWait()
static Sink & getNullSink()
Returns a Sink which does nothing.
bool copyNode(std::uint64_t &nodeCount, SHAMapTreeNode const &node)
NodeStore::DatabaseRotating * dbRotating_
std::uint32_t clampFetchDepth(std::uint32_t fetch_depth) const override
LedgerIndex getCanDelete() override
Highest ledger that may be deleted.
HealthResult
This is a health check for online deletion that waits until rippled is stable before returning.
void clearSql(LedgerIndex lastRotated, std::string const &TableName, std::function< std::optional< LedgerIndex >()> const &getMinSeq, std::function< void(LedgerIndex)> const &deleteBeforeSeq)
delete from sqlite table in batches to not lock the db excessively.
std::chrono::seconds recoveryWaitTime_
If the node is out of sync during an online_delete healthWait() call, sleep the thread for this time,...
bool advisoryDelete() const override
Whether advisory delete is enabled.
std::atomic< LedgerIndex > minimumOnline_
void setState(SavedState const &state)
TreeNodeCache * treeNodeCache_
std::atomic< bool > working_
std::uint32_t deleteInterval_
std::chrono::seconds ageThreshold_
void clearPrior(LedgerIndex lastRotated)
A generic endpoint for log messages.
Scheduling for asynchronous backend activity.
const std::uint64_t checkHealthInterval_
std::chrono::milliseconds backOff_
void init(BasicConfig const &config, std::string const &dbName)
const std::string dbName_
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
int fdRequired() const override
Returns the number of file descriptors that are needed.
void setLastRotated(LedgerIndex seq)
LedgerIndex getLastRotated() override
Maximum ledger that has been deleted, or will be deleted if currently in the act of online deletion.
std::atomic< LedgerIndex > canDelete_
static const std::uint32_t minimumDeletionIntervalSA_
std::uint32_t deleteBatch_
FullBelowCache * fullBelowCache_
std::optional< LedgerIndex > minimumOnline() const override
The minimum ledger to try and maintain in our database.
void clearCaches(LedgerIndex validatedSeq)
std::unique_ptr< NodeStore::Backend > makeBackendRotating(std::string path=std::string())
std::shared_ptr< NodeObject > fetchNodeObject(uint256 const &hash, std::uint32_t ledgerSeq=0, FetchType fetchType=FetchType::synchronous, bool duplicate=false)
Fetch a node object.
bool freshenCache(CacheInstance &cache)
Holds unparsed configuration information.
void rendezvous() const override
std::condition_variable rendezvous_