|
Clio
develop
The XRP Ledger API server.
|
Decides which node in the cluster should be the writer based on cluster state. More...
#include <WriterDecider.hpp>
Public Member Functions | |
| WriterDecider (boost::asio::thread_pool &ctx, std::unique_ptr< etl::WriterStateInterface > writerState) | |
| Constructs a WriterDecider. | |
| void | onNewState (ClioNode::CUuid selfId, std::shared_ptr< Backend::ClusterData const > clusterData) |
| Handles cluster state changes and decides whether this node should be the writer. | |
Decides which node in the cluster should be the writer based on cluster state.
This class monitors cluster state changes and determines whether the current node should act as the writer to the database. The decision is made by:
This ensures only one node in the cluster actively writes to the database at a time.
| cluster::WriterDecider::WriterDecider | ( | boost::asio::thread_pool & | ctx, |
| std::unique_ptr< etl::WriterStateInterface > | writerState ) |
Constructs a WriterDecider.
| ctx | Thread pool for executing asynchronous operations |
| writerState | Writer state interface for controlling write operations |
| void cluster::WriterDecider::onNewState | ( | ClioNode::CUuid | selfId, |
| std::shared_ptr< Backend::ClusterData const > | clusterData ) |
Handles cluster state changes and decides whether this node should be the writer.
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 |