Clio
develop
The XRP Ledger API server.
Theme:
Default
Round
Robot
Toggle main menu visibility
Loading...
Searching...
No Matches
NetworkValidatedLedgers.hpp
1
#pragma once
2
3
#include "
etl/NetworkValidatedLedgersInterface.hpp
"
4
5
#include <boost/signals2/connection.hpp>
6
#include <boost/signals2/signal.hpp>
7
#include <boost/signals2/variadic_signal.hpp>
8
9
#include <condition_variable>
10
#include <cstdint>
11
#include <memory>
12
#include <mutex>
13
#include <optional>
14
15
namespace
etl {
16
26
class
NetworkValidatedLedgers
:
public
NetworkValidatedLedgersInterface
{
27
std::optional<uint32_t> latest_;
// currently known latest sequence validated by network
28
29
mutable
std::mutex mtx_;
30
std::condition_variable cv_;
31
32
SignalType notificationChannel_;
33
34
public
:
40
static
std::shared_ptr<NetworkValidatedLedgers>
41
makeValidatedLedgers
();
42
48
void
49
push
(uint32_t idx)
final
;
50
60
std::optional<uint32_t>
61
getMostRecent
()
final
;
62
72
bool
73
waitUntilValidatedByNetwork
(uint32_t sequence, std::optional<uint32_t> maxWaitMs = {})
final
;
74
75
boost::signals2::scoped_connection
76
subscribe
(SignalType::slot_type
const
& subscriber)
override
;
77
};
78
79
}
// namespace etl
NetworkValidatedLedgersInterface.hpp
etl::NetworkValidatedLedgersInterface
An interface for NetworkValidatedLedgers.
Definition
NetworkValidatedLedgersInterface.hpp:16
etl::NetworkValidatedLedgers
This datastructure is used to keep track of the sequence of the most recent ledger validated by the n...
Definition
NetworkValidatedLedgers.hpp:26
etl::NetworkValidatedLedgers::push
void push(uint32_t idx) final
Notify the datastructure that idx has been validated by the network.
Definition
NetworkValidatedLedgers.cpp:19
etl::NetworkValidatedLedgers::waitUntilValidatedByNetwork
bool waitUntilValidatedByNetwork(uint32_t sequence, std::optional< uint32_t > maxWaitMs={}) final
Waits for the sequence to be validated by the network.
Definition
NetworkValidatedLedgers.cpp:38
etl::NetworkValidatedLedgers::makeValidatedLedgers
static std::shared_ptr< NetworkValidatedLedgers > makeValidatedLedgers()
A factory function for NetworkValidatedLedgers.
Definition
NetworkValidatedLedgers.cpp:13
etl::NetworkValidatedLedgers::getMostRecent
std::optional< uint32_t > getMostRecent() final
Get most recently validated sequence.
Definition
NetworkValidatedLedgers.cpp:30
etl::NetworkValidatedLedgers::subscribe
boost::signals2::scoped_connection subscribe(SignalType::slot_type const &subscriber) override
Allows clients to get notified when a new validated ledger becomes known to Clio.
Definition
NetworkValidatedLedgers.cpp:54
src
etl
NetworkValidatedLedgers.hpp
Generated by
1.17.0