|
Clio
develop
The XRP Ledger API server.
|
Decides which node in the cluster should load the ledger cache. More...
#include <CacheLoaderDecider.hpp>
Public Member Functions | |
| CacheLoaderDecider (boost::asio::thread_pool &ctx, std::unique_ptr< data::LedgerCacheLoadingStateInterface > cacheLoadingState) | |
| Constructs a CacheLoaderDecider. | |
| void | onNewState (ClioNode::CUuid selfId, std::shared_ptr< Backend::ClusterData const > clusterData) |
| Handles cluster state changes and decides whether this node should load the cache. | |
Decides which node in the cluster should load the ledger cache.
This class monitors cluster state changes and determines whether the current node should begin loading the ledger cache from the backend. The decision is made by:
This ensures at most one node in the cluster loads the cache at a time.
| cluster::CacheLoaderDecider::CacheLoaderDecider | ( | boost::asio::thread_pool & | ctx, |
| std::unique_ptr< data::LedgerCacheLoadingStateInterface > | cacheLoadingState ) |
Constructs a CacheLoaderDecider.
| ctx | Thread pool for executing asynchronous operations |
| cacheLoadingState | Cache loading state interface for permitting cache load |
| void cluster::CacheLoaderDecider::onNewState | ( | ClioNode::CUuid | selfId, |
| std::shared_ptr< Backend::ClusterData const > | clusterData ) |
Handles cluster state changes and decides whether this node should load the cache.
This method is called when cluster state changes. It asynchronously:
| selfId | The UUID of the current node |
| clusterData | Shared pointer to current cluster data; may be empty if communication failed |