22#include "data/LedgerCacheInterface.hpp"
23#include "etl/SystemState.hpp"
24#include "util/prometheus/Bool.hpp"
25#include "util/prometheus/Label.hpp"
26#include "util/prometheus/Prometheus.hpp"
48 [[nodiscard]]
virtual bool
55 [[nodiscard]]
virtual bool
81 [[nodiscard]]
virtual bool
94 [[nodiscard]]
virtual bool
133 [[nodiscard]]
virtual bool
141 [[nodiscard]]
virtual bool
153 [[nodiscard]]
virtual std::unique_ptr<WriterStateInterface>
166 std::shared_ptr<SystemState>
168 std::reference_wrapper<data::LedgerCacheInterface const> cache_;
179 "etl_writing_deciding_fallback_recovery",
181 "Whether clio is in recovery from the fallback writer decision mechanism"
261 std::unique_ptr<WriterStateInterface>
262 clone()
const override;
static util::prometheus::Bool boolMetric(std::string name, util::prometheus::Labels labels, std::optional< std::string > description=std::nullopt)
Get a bool based metric. It will be created if it doesn't exist.
Definition Prometheus.cpp:220
Cache for an entire ledger.
Definition LedgerCacheInterface.hpp:40
Interface for managing writer state in the ETL subsystem.
Definition WriterState.hpp:40
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 isFallback() const =0
Check if the cluster is using the fallback writer decision mechanism.
virtual void giveUpWriting()=0
Request to stop writing to the database.
virtual bool isWriting() const =0
Check if the ETL process is currently writing to the database.
virtual std::unique_ptr< WriterStateInterface > clone() const =0
Create a clone of this writer state.
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 startWriting()=0
Request to start writing to the database.
virtual bool isReadOnly() const =0
Check if the ETL process is in strict read-only mode.
virtual bool isCacheFull() const =0
Whether the ledger cache is fully loaded.
WriterState(std::shared_ptr< SystemState > state, data::LedgerCacheInterface const &cache)
Construct a WriterState with the given system state and cache.
Definition WriterState.cpp:30
bool isFallbackRecovery() const override
Check if this node is in fallback recovery mode.
Definition WriterState.cpp:82
bool isFallback() const override
Check if the cluster is using the fallback writer decision mechanism.
Definition WriterState.cpp:76
void startWriting() override
Request to start writing to the database.
Definition WriterState.cpp:51
void setFallbackRecovery(bool newValue) override
Set or clear the fallback recovery flag.
Definition WriterState.cpp:88
bool isCacheFull() const override
Whether the ledger cache is fully loaded.
Definition WriterState.cpp:103
bool isEtlStarted() const override
Whether the ETL monitor has started and the node is ready to become a writer.
Definition WriterState.cpp:97
void giveUpWriting() override
Request to stop writing to the database.
Definition WriterState.cpp:60
void setWriterDecidingFallback() override
Switch the cluster to the fallback writer decision mechanism.
Definition WriterState.cpp:69
bool isWriting() const override
Check if the ETL process is currently writing to the database.
Definition WriterState.cpp:45
std::unique_ptr< WriterStateInterface > clone() const override
Create a clone of this writer state.
Definition WriterState.cpp:109
bool isReadOnly() const override
Check if the ETL process is in strict read-only mode.
Definition WriterState.cpp:39
Class representing a collection of Prometheus labels.
Definition Label.hpp:60