Clio  develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
etl::WriterStateInterface Class Referenceabstract

Interface for managing writer state in the ETL subsystem. More...

#include <WriterState.hpp>

Inheritance diagram for etl::WriterStateInterface:

Public Member Functions

virtual bool isReadOnly () const =0
 Check if the ETL process is in strict read-only mode.
virtual bool isWriting () const =0
 Check if the ETL process is currently writing to the database.
virtual void startWriting ()=0
 Request to start writing to the database.
virtual void giveUpWriting ()=0
 Request to stop writing to the database.
virtual bool isFallback () const =0
 Check if the cluster is using the fallback writer decision mechanism.
virtual bool isFallbackRecovery () const =0
 Check if this node is in fallback recovery mode.
virtual void setFallbackRecovery (bool newValue)=0
 Set or clear the fallback recovery flag.
virtual void setWriterDecidingFallback ()=0
 Switch the cluster to the fallback writer decision mechanism.
virtual bool isEtlStarted () const =0
 Whether the ETL monitor has started and the node is ready to become a writer.
virtual bool isCacheFull () const =0
 Whether the ledger cache is fully loaded.
virtual std::unique_ptr< WriterStateInterfaceclone () const =0
 Create a clone of this writer state.

Detailed Description

Interface for managing writer state in the ETL subsystem.

This interface provides methods to query and control whether the ETL process is actively writing to the database. Implementations should coordinate with the ETL system state to manage write responsibilities.

Member Function Documentation

◆ clone()

virtual std::unique_ptr< WriterStateInterface > etl::WriterStateInterface::clone ( ) const
nodiscardpure virtual

Create a clone of this writer state.

Creates a new instance of the writer state with the same underlying system state. This is used when spawning operations that need their own writer state instance while sharing the same system state.

Returns
A unique pointer to the cloned writer state.

Implemented in etl::WriterState.

◆ giveUpWriting()

virtual void etl::WriterStateInterface::giveUpWriting ( )
pure virtual

Request to stop writing to the database.

This method signals that the process should give up writing responsibilities. The actual transition from writing state may not be immediate.

Implemented in etl::WriterState.

◆ isCacheFull()

virtual bool etl::WriterStateInterface::isCacheFull ( ) const
nodiscardpure virtual

Whether the ledger cache is fully loaded.

Returns
true if the cache is full, false otherwise.

Implemented in etl::WriterState.

◆ isEtlStarted()

virtual bool etl::WriterStateInterface::isEtlStarted ( ) const
nodiscardpure virtual

Whether the ETL monitor has started and the node is ready to become a writer.

Returns
true if ETL has started the monitor loop, false otherwise.

Implemented in etl::WriterState.

◆ isFallback()

virtual bool etl::WriterStateInterface::isFallback ( ) const
nodiscardpure virtual

Check if the cluster is using the fallback writer decision mechanism.

Returns
true if the cluster has switched to fallback mode, false otherwise

Implemented in etl::WriterState.

◆ isFallbackRecovery()

virtual bool etl::WriterStateInterface::isFallbackRecovery ( ) const
nodiscardpure virtual

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.

Returns
true if the node is in fallback recovery mode, false otherwise

Implemented in etl::WriterState.

◆ isReadOnly()

virtual bool etl::WriterStateInterface::isReadOnly ( ) const
nodiscardpure virtual

Check if the ETL process is in strict read-only mode.

Returns
true if the process is in strict read-only mode, false otherwise

Implemented in etl::WriterState.

◆ isWriting()

virtual bool etl::WriterStateInterface::isWriting ( ) const
nodiscardpure virtual

Check if the ETL process is currently writing to the database.

Returns
true if the process is writing, false otherwise

Implemented in etl::WriterState.

◆ setFallbackRecovery()

virtual void etl::WriterStateInterface::setFallbackRecovery ( bool newValue)
pure virtual

Set or clear the fallback recovery flag.

When newValue is true, the node enters fallback recovery mode:

  • isFallbackRecovery returns true
  • The plain fallback flag (isFallback) is cleared so the node no longer publishes 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.

Parameters
newValuetrue to enter recovery mode, false to leave it

Implemented in etl::WriterState.

◆ setWriterDecidingFallback()

virtual void etl::WriterStateInterface::setWriterDecidingFallback ( )
pure virtual

Switch the cluster to the fallback writer decision mechanism.

This method is called when the cluster needs to transition from the cluster communication mechanism to the slower but more reliable fallback mechanism. Once set, this flag propagates to all nodes in the cluster through the ClioNode DbRole::Fallback state.

Also clears the fallback recovery flag (isFallbackRecovery) because entering a fresh fallback period cancels any in-progress recovery attempt.

Implemented in etl::WriterState.

◆ startWriting()

virtual void etl::WriterStateInterface::startWriting ( )
pure virtual

Request to start writing to the database.

This method signals that the process should take over writing responsibilities. The actual transition to writing state may not be immediate.

Implemented in etl::WriterState.


The documentation for this class was generated from the following file: