Clio
develop
The XRP Ledger API server.
Theme:
Default
Round
Robot
Toggle main menu visibility
Loading...
Searching...
No Matches
ETLState.hpp
1
#pragma once
2
3
#include "data/BackendInterface.hpp"
4
#include "rpc/JS.hpp"
5
6
#include <boost/json.hpp>
7
#include <boost/json/conversion.hpp>
8
#include <boost/json/object.hpp>
9
#include <boost/json/value.hpp>
10
#include <boost/json/value_to.hpp>
11
#include <xrpl/protocol/jss.h>
12
13
#include <cstdint>
14
#include <optional>
15
16
namespace
etl
{
17
22
struct
ETLState
{
30
uint32_t
networkID
{0};
31
38
template
<
typename
Forward>
39
static
std::optional<ETLState>
40
fetchETLStateFromSource
(Forward& source)
noexcept
41
{
42
auto
const
serverInfoRippled =
43
data::synchronous
([&source](
auto
yield) -> std::optional<boost::json::object> {
44
if
(
auto
result = source.forwardToRippled(
45
{{
"command"
,
"server_info"
}}, std::nullopt, {}, yield
46
)) {
47
return
std::move(result).value();
48
}
49
return
std::nullopt;
50
});
51
52
if
(serverInfoRippled && not serverInfoRippled->contains(JS(error))) {
53
return
boost::json::value_to<ETLState>(boost::json::value(*serverInfoRippled));
54
}
55
56
return
std::nullopt;
57
}
58
};
59
66
ETLState
67
tag_invoke
(boost::json::value_to_tag<ETLState>, boost::json::value
const
& jv);
68
69
}
// namespace etl
cluster::tag_invoke
void tag_invoke(boost::json::value_from_tag, boost::json::value &jv, ClioNode const &node)
Convert a ClioNode to a JSON object.
Definition
ClioNode.cpp:66
data::synchronous
auto synchronous(FnType &&func)
Synchronously executes the given function object inside a coroutine.
Definition
BackendInterface.hpp:169
etl
This namespace contains everything to do with the ETL and ETL sources.
Definition
AmendmentBlockHandlerInterface.hpp:6
etl::ETLState
This class is responsible for fetching and storing the state of the ETL information,...
Definition
ETLState.hpp:22
etl::ETLState::fetchETLStateFromSource
static std::optional< ETLState > fetchETLStateFromSource(Forward &source) noexcept
Fetch the ETL state from the rippled server.
Definition
ETLState.hpp:40
etl::ETLState::networkID
uint32_t networkID
The network ID reported by the rippled server.
Definition
ETLState.hpp:30
src
etl
ETLState.hpp
Generated by
1.17.0