Cache for an entire ledger.
More...
#include <LedgerCacheInterface.hpp>
Cache for an entire ledger.
◆ get()
virtual std::optional< Blob > data::LedgerCacheInterface::get |
( |
ripple::uint256 const & | key, |
|
|
uint32_t | seq ) const |
|
pure virtual |
Fetch a cached object by its key and sequence number.
- Parameters
-
key | The key to fetch for |
seq | The sequence to fetch for |
- Returns
- If found in cache, will return the cached Blob; otherwise nullopt is returned
Implemented in data::LedgerCache.
◆ getDeleted()
virtual std::optional< Blob > data::LedgerCacheInterface::getDeleted |
( |
ripple::uint256 const & | key, |
|
|
uint32_t | seq ) const |
|
pure virtual |
Fetch a recently deleted object by its key and sequence number.
- Parameters
-
key | The key to fetch for |
seq | The sequence to fetch for |
- Returns
- If found in deleted cache, will return the cached Blob; otherwise nullopt is returned
Implemented in data::LedgerCache.
◆ getObjectHitRate()
virtual float data::LedgerCacheInterface::getObjectHitRate |
( |
| ) |
const |
|
pure virtual |
- Returns
- A number representing the success rate of hitting an object in the cache versus missing it.
Implemented in data::LedgerCache.
◆ getPredecessor()
virtual std::optional< LedgerObject > data::LedgerCacheInterface::getPredecessor |
( |
ripple::uint256 const & | key, |
|
|
uint32_t | seq ) const |
|
pure virtual |
Gets a cached predcessor.
Note: This function always returns std::nullopt when isFull() returns false.
- Parameters
-
key | The key to fetch for |
seq | The sequence to fetch for |
- Returns
- If found in cache, will return the cached predcessor; otherwise nullopt is returned
Implemented in data::LedgerCache.
◆ getSuccessor()
virtual std::optional< LedgerObject > data::LedgerCacheInterface::getSuccessor |
( |
ripple::uint256 const & | key, |
|
|
uint32_t | seq ) const |
|
pure virtual |
Gets a cached successor.
Note: This function always returns std::nullopt when isFull() returns false.
- Parameters
-
key | The key to fetch for |
seq | The sequence to fetch for |
- Returns
- If found in cache, will return the cached successor; otherwise nullopt is returned
Implemented in data::LedgerCache.
◆ getSuccessorHitRate()
virtual float data::LedgerCacheInterface::getSuccessorHitRate |
( |
| ) |
const |
|
pure virtual |
- Returns
- A number representing the success rate of hitting a successor in the cache versus missing it.
Implemented in data::LedgerCache.
◆ isDisabled()
virtual bool data::LedgerCacheInterface::isDisabled |
( |
| ) |
const |
|
pure virtual |
- Returns
- true if the cache is disabled; false otherwise
Implemented in data::LedgerCache.
◆ isFull()
virtual bool data::LedgerCacheInterface::isFull |
( |
| ) |
const |
|
pure virtual |
- Returns
- true if the cache has all data for the most recent ledger; false otherwise
Implemented in data::LedgerCache.
◆ latestLedgerSequence()
virtual uint32_t data::LedgerCacheInterface::latestLedgerSequence |
( |
| ) |
const |
|
pure virtual |
- Returns
- The latest ledger sequence for which cache is available.
Implemented in data::LedgerCache.
◆ setDisabled()
virtual void data::LedgerCacheInterface::setDisabled |
( |
| ) |
|
|
pure virtual |
◆ setFull()
virtual void data::LedgerCacheInterface::setFull |
( |
| ) |
|
|
pure virtual |
Sets the full flag to true.
This is used when cache loaded in its entirety at startup of the application. This can be either loaded from DB, populated together with initial ledger download (on first run) or downloaded from a peer node (specified in config).
Implemented in data::LedgerCache.
◆ size()
virtual size_t data::LedgerCacheInterface::size |
( |
| ) |
const |
|
pure virtual |
◆ update() [1/2]
virtual void data::LedgerCacheInterface::update |
( |
std::vector< etlng::model::Object > const & | objs, |
|
|
uint32_t | seq ) |
|
pure virtual |
Update the cache with new ledger objects.
- Parameters
-
objs | The ledger objects to update cache with |
seq | The sequence to update cache for |
Implemented in data::LedgerCache.
◆ update() [2/2]
virtual void data::LedgerCacheInterface::update |
( |
std::vector< LedgerObject > const & | objs, |
|
|
uint32_t | seq, |
|
|
bool | isBackground = false ) |
|
pure virtual |
Update the cache with new ledger objects.
- Parameters
-
objs | The ledger objects to update cache with |
seq | The sequence to update cache for |
isBackground | Should be set to true when writing old data from a background thread |
Implemented in data::LedgerCache.
◆ waitUntilCacheContainsSeq()
virtual void data::LedgerCacheInterface::waitUntilCacheContainsSeq |
( |
uint32_t | seq | ) |
|
|
pure virtual |
Waits until the cache contains a specific sequence.
- Parameters
-
seq | The sequence to wait for |
Implemented in data::LedgerCache.
The documentation for this class was generated from the following file: