Clio  develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
MonitorInterface.hpp
1#pragma once
2
3#include <boost/signals2/connection.hpp>
4#include <boost/signals2/signal.hpp>
5#include <boost/signals2/variadic_signal.hpp>
6
7#include <chrono>
8#include <cstdint>
9
10namespace etl {
11
18public:
22 static constexpr auto kDefaultRepeatInterval = std::chrono::seconds{1};
26 using NewSequenceSignalType = boost::signals2::signal<void(uint32_t)>;
30 using DbStalledSignalType = boost::signals2::signal<void()>;
31
32 virtual ~MonitorInterface() = default;
33
38 virtual void
39 notifySequenceLoaded(uint32_t seq) = 0;
40
45 virtual void
46 notifyWriteConflict(uint32_t seq) = 0;
47
54 [[nodiscard]] virtual boost::signals2::scoped_connection
55 subscribeToNewSequence(NewSequenceSignalType::slot_type const& subscriber) = 0;
56
64 [[nodiscard]] virtual boost::signals2::scoped_connection
65 subscribeToDbStalled(DbStalledSignalType::slot_type const& subscriber) = 0;
66
72 virtual void
73 run(std::chrono::steady_clock::duration repeatInterval = kDefaultRepeatInterval) = 0;
74
78 virtual void
79 stop() = 0;
80};
81
82} // namespace etl
An interface for the monitor service An implementation of this service is responsible for periodicall...
Definition MonitorInterface.hpp:17
virtual boost::signals2::scoped_connection subscribeToNewSequence(NewSequenceSignalType::slot_type const &subscriber)=0
Allows clients to get notified when a new ledger becomes available in Clio's database.
virtual boost::signals2::scoped_connection subscribeToDbStalled(DbStalledSignalType::slot_type const &subscriber)=0
Allows clients to get notified when no database update is detected for a configured period.
boost::signals2::signal< void(uint32_t)> NewSequenceSignalType
Signal fired with the sequence of each new ledger found in the database.
Definition MonitorInterface.hpp:26
static constexpr auto kDefaultRepeatInterval
Default interval between checks of the database for new ledgers.
Definition MonitorInterface.hpp:22
virtual void notifySequenceLoaded(uint32_t seq)=0
Allows the loading process to notify of a freshly committed ledger.
virtual void notifyWriteConflict(uint32_t seq)=0
Notifies the monitor of a write conflict.
virtual void stop()=0
Stops the monitor service.
virtual void run(std::chrono::steady_clock::duration repeatInterval=kDefaultRepeatInterval)=0
Run the monitor service.
boost::signals2::signal< void()> DbStalledSignalType
Signal fired when no database update is detected for a configured period.
Definition MonitorInterface.hpp:30
This namespace contains everything to do with the ETL and ETL sources.
Definition AmendmentBlockHandlerInterface.hpp:6