Clio develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
LedgerRange.hpp
1//------------------------------------------------------------------------------
2/*
3 This file is part of clio: https://github.com/XRPLF/clio
4 Copyright (c) 2023, 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 "data/BackendInterface.hpp"
23#include "data/Types.hpp"
24#include "rpc/common/Types.hpp"
25
26#include <boost/json.hpp>
27#include <boost/json/conversion.hpp>
28#include <boost/json/value.hpp>
29
30#include <memory>
31
32namespace rpc {
33
40 std::shared_ptr<BackendInterface> sharedPtrBackend_;
41
42public:
46 struct Output {
48 };
49
50 using Result = HandlerReturnType<Output>;
51
57 LedgerRangeHandler(std::shared_ptr<BackendInterface> const& sharedPtrBackend) : sharedPtrBackend_(sharedPtrBackend)
58 {
59 }
60
67 Result
68 process(Context const& ctx) const;
69
70private:
77 friend void
78 tag_invoke(boost::json::value_from_tag, boost::json::value& jv, Output const& output);
79};
80} // namespace rpc
The ledger_range command returns the index number of the earliest and latest ledgers that the server ...
Definition LedgerRange.hpp:39
LedgerRangeHandler(std::shared_ptr< BackendInterface > const &sharedPtrBackend)
Construct a new LedgerRangeHandler object.
Definition LedgerRange.hpp:57
friend void tag_invoke(boost::json::value_from_tag, boost::json::value &jv, Output const &output)
Convert the Output to a JSON object.
Definition LedgerRange.cpp:42
Result process(Context const &ctx) const
Process the LedgerRange command.
Definition LedgerRange.cpp:35
This namespace contains all the RPC logic and handlers.
Definition AMMHelpers.cpp:36
std::expected< OutputType, Status > HandlerReturnType
Return type for each individual handler.
Definition Types.hpp:81
Stores a range of sequences as a min and max pair.
Definition Types.hpp:247
Context of an RPC call.
Definition Types.hpp:118
A struct to hold the output data of the command.
Definition LedgerRange.hpp:46
Result type used to return responses or error statuses to the Webserver subsystem.
Definition Types.hpp:129