Clio  develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
cluster::ClioNode Struct Reference

Represents a node in the cluster. More...

#include <ClioNode.hpp>

Public Types

enum class  DbRole {
  ReadOnly = 0 , NotWriter = 1 , Writer = 2 , Fallback = 3 ,
  FallbackRecovery = 4 , Max = 4
}
 Database role of a node in the cluster. More...
using Uuid = std::shared_ptr<boost::uuids::uuid>
using CUuid = std::shared_ptr<boost::uuids::uuid const>

Static Public Member Functions

static ClioNode from (Uuid uuid, etl::WriterStateInterface const &writerState, data::LedgerCacheLoadingStateInterface const &cacheLoadingState)
 Create a ClioNode from writer state and cache loading state.

Public Attributes

Uuid uuid
 The UUID of the node.
std::chrono::system_clock::time_point updateTime
 The time the data about the node was last updated.
DbRole dbRole
 The database role of the node.
bool etlStarted
 Whether the ETL monitor has started on this node.
bool cacheIsFull
 Whether the ledger cache is fully loaded on this node.
bool cacheIsCurrentlyLoading
 Whether this node is currently loading the ledger cache.

Static Public Attributes

static constexpr char const * kTIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
 The format of the time to store in the database.

Detailed Description

Represents a node in the cluster.

Member Enumeration Documentation

◆ DbRole

enum class cluster::ClioNode::DbRole
strong

Database role of a node in the cluster.

Roles are used to coordinate which node writes to the database:

  • ReadOnly: Node is configured to never write (strict read-only mode).
  • NotWriter: Node can write but is currently not the designated writer.
  • Writer: Node is actively writing to the database.
  • Fallback: Node is using the fallback writer decision mechanism (slower but reliable database-based write-conflict detection). When any non-ReadOnly node in the cluster is in this role, the entire cluster switches to fallback mode.
  • FallbackRecovery: Node has been in Fallback long enough to attempt returning to election-based writer selection. The node continues participating in the fallback write-race while coordinating with peers. Once all non-ReadOnly nodes reach this role (or have already returned to election mode), the cluster exits fallback and performs a normal election.

Member Function Documentation

◆ from()

ClioNode cluster::ClioNode::from ( ClioNode::Uuid uuid,
etl::WriterStateInterface const & writerState,
data::LedgerCacheLoadingStateInterface const & cacheLoadingState )
static

Create a ClioNode from writer state and cache loading state.

Parameters
uuidThe UUID of the node
writerStateThe writer state to determine the node's database role
cacheLoadingStateThe cache loading state to determine if cache is being loaded
Returns
A ClioNode with the current time and role derived from writerState

The documentation for this struct was generated from the following files:
  • /__w/clio/clio/src/cluster/ClioNode.hpp
  • /__w/clio/clio/src/cluster/ClioNode.cpp