Clio
develop
The XRP Ledger API server.
Theme:
Default
Round
Robot
Toggle main menu visibility
Loading...
Searching...
No Matches
LedgerIndex.hpp
1
#pragma once
2
3
#include "data/BackendInterface.hpp"
4
#include "rpc/common/SpecBackend.hpp"
5
#include "rpc/common/Types.hpp"
6
7
#include <boost/json/conversion.hpp>
8
#include <boost/json/value.hpp>
9
#include <rpcspec/handlers/ledger_index/Types.hpp>
10
11
#include <cstdint>
12
#include <memory>
13
#include <string>
14
#include <utility>
15
16
namespace
rpc
{
17
22
class
LedgerIndexHandler
:
public
rpc::HandlerFor
<rpc::spec::handlers::ledger_index::Input> {
23
std::shared_ptr<BackendInterface> sharedPtrBackend_;
24
25
public
:
29
struct
Output
{
30
uint32_t ledgerIndex{};
31
std::string ledgerHash;
32
std::string closeTimeIso;
33
};
34
35
using
Result =
HandlerReturnType<Output>
;
36
42
LedgerIndexHandler
(std::shared_ptr<BackendInterface> sharedPtrBackend)
43
: sharedPtrBackend_(std::move(sharedPtrBackend))
44
{
45
}
46
54
[[nodiscard]]
Result
55
process
(Input
const
& input,
Context
const
& ctx)
const
;
56
57
private
:
64
friend
void
65
tag_invoke
(boost::json::value_from_tag, boost::json::value& jv, Output
const
& output);
66
};
67
68
}
// namespace rpc
rpc::LedgerIndexHandler::tag_invoke
friend void tag_invoke(boost::json::value_from_tag, boost::json::value &jv, Output const &output)
Convert the Output to a JSON object.
Definition
LedgerIndex.cpp:73
rpc::LedgerIndexHandler::LedgerIndexHandler
LedgerIndexHandler(std::shared_ptr< BackendInterface > sharedPtrBackend)
Construct a new LedgerIndexHandler object.
Definition
LedgerIndex.hpp:42
rpc::LedgerIndexHandler::process
Result process(Input const &input, Context const &ctx) const
Process the LedgerIndex command.
Definition
LedgerIndex.cpp:24
rpc
This namespace contains all the RPC logic and handlers.
Definition
AMMHelpers.cpp:17
rpc::HandlerReturnType
std::expected< OutputType, Status > HandlerReturnType
Return type for each individual handler.
Definition
Types.hpp:61
rpc::HandlerFor
spec::HandlerFor< InputT, boost::json::value > HandlerFor
The spec-driven base every typed handler inherits.
Definition
SpecBackend.hpp:24
rpc::Context
Context of an RPC call.
Definition
Types.hpp:98
rpc::LedgerIndexHandler::Output
A struct to hold the output data of the command.
Definition
LedgerIndex.hpp:29
rpc::Result
Result type used to return responses or error statuses to the Webserver subsystem.
Definition
Types.hpp:109
src
rpc
handlers
LedgerIndex.hpp
Generated by
1.17.0