Clio  develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
etl::WriterState Class Reference

Implementation of WriterStateInterface that manages ETL writer state. More...

#include <WriterState.hpp>

Inheritance diagram for etl::WriterState:
Collaboration diagram for etl::WriterState:

Public Member Functions

 WriterState (std::shared_ptr< SystemState > state)
 Construct a WriterState with the given system state.
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 isLoadingCache () const override
 Whether clio is still loading cache after startup.
std::unique_ptr< WriterStateInterfaceclone () const override
 Create a clone of this writer state.

Detailed Description

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.

Constructor & Destructor Documentation

◆ WriterState()

etl::WriterState::WriterState ( std::shared_ptr< SystemState > state)

Construct a WriterState with the given system state.

Parameters
stateShared pointer to the system state for coordination

Member Function Documentation

◆ clone()

std::unique_ptr< WriterStateInterface > etl::WriterState::clone ( ) const
overridevirtual

Create a clone of this writer state.

Creates a new WriterState instance sharing the same system state.

Returns
A unique pointer to the cloned writer state.

Implements etl::WriterStateInterface.

◆ giveUpWriting()

void etl::WriterState::giveUpWriting ( )
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.

◆ isFallback()

bool etl::WriterState::isFallback ( ) const
overridevirtual

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

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

Implements etl::WriterStateInterface.

◆ isLoadingCache()

bool etl::WriterState::isLoadingCache ( ) const
overridevirtual

Whether clio is still loading cache after startup.

Returns
true if clio is still loading cache, false otherwise.

Implements etl::WriterStateInterface.

◆ isReadOnly()

bool etl::WriterState::isReadOnly ( ) const
overridevirtual

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

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

Implements etl::WriterStateInterface.

◆ isWriting()

bool etl::WriterState::isWriting ( ) const
overridevirtual

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

Returns
true if the process is writing, false otherwise

Implements etl::WriterStateInterface.

◆ setWriterDecidingFallback()

void etl::WriterState::setWriterDecidingFallback ( )
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.

◆ startWriting()

void etl::WriterState::startWriting ( )
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.


The documentation for this class was generated from the following files:
  • /__w/clio/clio/src/etl/WriterState.hpp
  • /__w/clio/clio/src/etl/WriterState.cpp