|
Clio
develop
The XRP Ledger API server.
|
Cache for an entire ledger. More...
#include <LedgerCache.hpp>


Classes | |
| struct | CacheEntry |
| An entry of the cache. More... | |
Public Types | |
| using | CacheMap = std::map<ripple::uint256, CacheEntry> |
Public Member Functions | |
| void | update (std::vector< LedgerObject > const &objs, uint32_t seq, bool isBackground) override |
| Update the cache with new ledger objects. | |
| void | update (std::vector< etl::model::Object > const &objs, uint32_t seq) override |
| Update the cache with new ledger objects. | |
| std::optional< Blob > | get (ripple::uint256 const &key, uint32_t seq) const override |
| Fetch a cached object by its key and sequence number. | |
| std::optional< Blob > | getDeleted (ripple::uint256 const &key, uint32_t seq) const override |
| Fetch a recently deleted object by its key and sequence number. | |
| std::optional< LedgerObject > | getSuccessor (ripple::uint256 const &key, uint32_t seq) const override |
| Gets a cached successor. | |
| std::optional< LedgerObject > | getPredecessor (ripple::uint256 const &key, uint32_t seq) const override |
| Gets a cached predcessor. | |
| void | setDisabled () override |
| Disables the cache. | |
| bool | isDisabled () const override |
| void | setFull () override |
| Sets the full flag to true. | |
| uint32_t | latestLedgerSequence () const override |
| bool | isFull () const override |
| size_t | size () const override |
| float | getObjectHitRate () const override |
| float | getSuccessorHitRate () const override |
| void | waitUntilCacheContainsSeq (uint32_t seq) override |
| Waits until the cache contains a specific sequence. | |
| std::expected< void, std::string > | saveToFile (std::string const &path) const |
| Save the cache to file. | |
| std::expected< void, std::string > | loadFromFile (std::string const &path, uint32_t minLatestSequence) override |
| Load the cache from file. | |
| Public Member Functions inherited from data::LedgerCacheInterface | |
| LedgerCacheInterface (LedgerCacheInterface &&)=delete | |
| LedgerCacheInterface (LedgerCacheInterface const &)=delete | |
| LedgerCacheInterface & | operator= (LedgerCacheInterface &&)=delete |
| LedgerCacheInterface & | operator= (LedgerCacheInterface const &)=delete |
Cache for an entire ledger.
|
overridevirtual |
Fetch a cached object by its key and sequence number.
| key | The key to fetch for |
| seq | The sequence to fetch for |
Implements data::LedgerCacheInterface.
|
overridevirtual |
Fetch a recently deleted object by its key and sequence number.
| key | The key to fetch for |
| seq | The sequence to fetch for |
Implements data::LedgerCacheInterface.
|
overridevirtual |
Implements data::LedgerCacheInterface.
|
overridevirtual |
Gets a cached predcessor.
Note: This function always returns std::nullopt when isFull() returns false.
| key | The key to fetch for |
| seq | The sequence to fetch for |
Implements data::LedgerCacheInterface.
|
overridevirtual |
Gets a cached successor.
Note: This function always returns std::nullopt when isFull() returns false.
| key | The key to fetch for |
| seq | The sequence to fetch for |
Implements data::LedgerCacheInterface.
|
overridevirtual |
Implements data::LedgerCacheInterface.
|
overridevirtual |
Implements data::LedgerCacheInterface.
|
overridevirtual |
Implements data::LedgerCacheInterface.
|
overridevirtual |
Implements data::LedgerCacheInterface.
|
overridevirtual |
Load the cache from file.
| path | The file path to load data from |
| minLatestSequence | The minimum allowed value of the latestLedgerSequence in cache file |
Implements data::LedgerCacheInterface.
| std::expected< void, std::string > data::LedgerCache::saveToFile | ( | std::string const & | path | ) | const |
Save the cache to file.
| path | The file path to save the cache to |
|
overridevirtual |
Disables the cache.
Implements data::LedgerCacheInterface.
|
overridevirtual |
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).
Implements data::LedgerCacheInterface.
|
overridevirtual |
Implements data::LedgerCacheInterface.
|
overridevirtual |
Update the cache with new ledger objects.
| objs | The ledger objects to update cache with |
| seq | The sequence to update cache for |
Implements data::LedgerCacheInterface.
|
overridevirtual |
Update the cache with new ledger objects.
| 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 |
Implements data::LedgerCacheInterface.
|
overridevirtual |
Waits until the cache contains a specific sequence.
| seq | The sequence to wait for |
Implements data::LedgerCacheInterface.