|
Clio
develop
The XRP Ledger API server.
|
Manages asynchronous saving of ledger cache to a file. More...
#include <LedgerCacheSaver.hpp>
Public Member Functions | |
| LedgerCacheSaver (util::config::ClioConfigDefinition const &config, LedgerCacheInterface const &cache) | |
| Constructs a LedgerCacheSaver instance. | |
| ~LedgerCacheSaver () | |
| Destructor that ensures the saving thread is properly joined. | |
| void | save () |
| Initiates an asynchronous save operation of the ledger cache. | |
| void | waitToFinish () |
| Waits for the saving thread to complete. | |
Manages asynchronous saving of ledger cache to a file.
This class provides functionality to save the ledger cache to a file in a separate thread, allowing the main application to continue without blocking. The file path is configured through the application's configuration system.
| data::LedgerCacheSaver::LedgerCacheSaver | ( | util::config::ClioConfigDefinition const & | config, |
| LedgerCacheInterface const & | cache ) |
Constructs a LedgerCacheSaver instance.
| config | The configuration object containing the cache file path setting |
| cache | Reference to the ledger cache interface to be saved |
| data::LedgerCacheSaver::~LedgerCacheSaver | ( | ) |
Destructor that ensures the saving thread is properly joined.
Waits for any ongoing save operation to complete before destruction.
| void data::LedgerCacheSaver::save | ( | ) |
Initiates an asynchronous save operation of the ledger cache.
Spawns a new thread that saves the ledger cache to the configured file path. If no file path is configured, the operation is skipped. Logs the progress and result of the save operation.
| void data::LedgerCacheSaver::waitToFinish | ( | ) |
Waits for the saving thread to complete.
Blocks until the saving operation finishes if a thread is currently active. Safe to call multiple times or when no save operation is in progress.