Clio develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
MonitorInterface.hpp
1//------------------------------------------------------------------------------
2/*
3 This file is part of clio: https://github.com/XRPLF/clio
4 Copyright (c) 2025, the clio developers.
5
6 Permission to use, copy, modify, and distribute this software for any
7 purpose with or without fee is hereby granted, provided that the above
8 copyright notice and this permission notice appear in all copies.
9
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17*/
18//==============================================================================
19
20#pragma once
21
22#include <boost/signals2/connection.hpp>
23#include <boost/signals2/signal.hpp>
24#include <boost/signals2/variadic_signal.hpp>
25
26#include <chrono>
27#include <cstdint>
28
29namespace etlng {
30
37public:
38 static constexpr auto kDEFAULT_REPEAT_INTERVAL = std::chrono::seconds{1};
39 using SignalType = boost::signals2::signal<void(uint32_t)>;
40
41 virtual ~MonitorInterface() = default;
42
49 [[nodiscard]] virtual boost::signals2::scoped_connection
50 subscribe(SignalType::slot_type const& subscriber) = 0;
51
57 virtual void
58 run(std::chrono::steady_clock::duration repeatInterval = kDEFAULT_REPEAT_INTERVAL) = 0;
59
63 virtual void
64 stop() = 0;
65};
66
67} // namespace etlng
An interface for the monitor service An implementation of this service is responsible for periodicall...
Definition MonitorInterface.hpp:36
virtual void run(std::chrono::steady_clock::duration repeatInterval=kDEFAULT_REPEAT_INTERVAL)=0
Run the monitor service.
virtual void stop()=0
Stops the monitor service.
virtual boost::signals2::scoped_connection subscribe(SignalType::slot_type const &subscriber)=0
Allows clients to get notified when a new ledger becomes available in Clio's database.