|
Clio
develop
The XRP Ledger API server.
|
Implementation of WriterStateInterface that manages ETL writer state. More...
#include <WriterState.hpp>


Public Member Functions | |
| WriterState (std::shared_ptr< SystemState > state, data::LedgerCacheInterface const &cache) | |
| Construct a WriterState with the given system state and cache. | |
| bool | isReadOnly () const override |
| Check if the ETL process is in strict read-only mode. | |
| bool | isWriting () const override |
| Check if the ETL process is currently writing to the database. | |
| void | startWriting () override |
| Request to start writing to the database. | |
| void | giveUpWriting () override |
| Request to stop writing to the database. | |
| void | setWriterDecidingFallback () override |
| Switch the cluster to the fallback writer decision mechanism. | |
| bool | isFallback () const override |
| Check if the cluster is using the fallback writer decision mechanism. | |
| bool | isFallbackRecovery () const override |
| Check if this node is in fallback recovery mode. | |
| void | setFallbackRecovery (bool newValue) override |
| Set or clear the fallback recovery flag. | |
| bool | isEtlStarted () const override |
| Whether the ETL monitor has started and the node is ready to become a writer. | |
| bool | isCacheFull () const override |
| Whether the ledger cache is fully loaded. | |
| std::unique_ptr< WriterStateInterface > | clone () const override |
| Create a clone of this writer state. | |
Implementation of WriterStateInterface that manages ETL writer state.
This class coordinates with SystemState to manage whether the ETL process is actively writing to the database. It provides methods to query the current writing state and request transitions between writing and non-writing states.
| etl::WriterState::WriterState | ( | std::shared_ptr< SystemState > | state, |
| data::LedgerCacheInterface const & | cache ) |
Construct a WriterState with the given system state and cache.
| state | Shared pointer to the system state for coordination |
| cache | The ledger cache used to report cache fullness |
|
overridevirtual |
Create a clone of this writer state.
Creates a new WriterState instance sharing the same system state.
Implements etl::WriterStateInterface.
|
overridevirtual |
Request to stop writing to the database.
If not currently writing, this method does nothing. Otherwise, it sets the shouldGiveUpWriter flag in the system state to signal the request.
Implements etl::WriterStateInterface.
|
overridevirtual |
Whether the ledger cache is fully loaded.
Implements etl::WriterStateInterface.
|
overridevirtual |
Whether the ETL monitor has started and the node is ready to become a writer.
Implements etl::WriterStateInterface.
|
overridevirtual |
Check if the cluster is using the fallback writer decision mechanism.
Implements etl::WriterStateInterface.
|
overridevirtual |
Check if this node is in fallback recovery mode.
Fallback recovery is an intermediate state entered when the node has been in fallback mode long enough to attempt returning to election-based writer selection. In this state the node continues participating in the fallback write-race while coordinating with other nodes to exit fallback together.
Implements etl::WriterStateInterface.
|
overridevirtual |
Check if the ETL process is in strict read-only mode.
Implements etl::WriterStateInterface.
|
overridevirtual |
Check if the ETL process is currently writing to the database.
Implements etl::WriterStateInterface.
|
overridevirtual |
Set or clear the fallback recovery flag.
When newValue is true, the node enters fallback recovery mode:
DbRole::Fallback; it publishes DbRole::FallbackRecovery instead.When newValue is false, the recovery flag is cleared without touching the plain fallback flag. This is used when the recovery coordination completes and the node transitions back to election mode.
| newValue | true to enter recovery mode, false to leave it |
Implements etl::WriterStateInterface.
|
overridevirtual |
Switch the cluster to the fallback writer decision mechanism.
Sets the isWriterDecidingFallback flag in the system state, which will be propagated to other nodes in the cluster through the ClioNode DbRole::Fallback state.
Implements etl::WriterStateInterface.
|
overridevirtual |
Request to start writing to the database.
If already writing, this method does nothing. Otherwise, it sets the shouldTakeoverWriting flag in the system state to signal the request.
Implements etl::WriterStateInterface.