3#include "data/BackendInterface.hpp"
5#include "rpc/common/SpecBackend.hpp"
6#include "rpc/common/Types.hpp"
7#include "util/log/Logger.hpp"
9#include <boost/json/array.hpp>
10#include <boost/json/conversion.hpp>
11#include <boost/json/object.hpp>
12#include <boost/json/value.hpp>
13#include <rpcspec/handlers/ledger_data/Types.hpp>
14#include <xrpl/basics/base_uint.h>
15#include <xrpl/protocol/LedgerFormats.h>
34 std::shared_ptr<BackendInterface> sharedPtrBackend_;
42 static constexpr auto kLimitBinary = rpc::spec::handlers::ledger_data::kLimitBinary;
46 static constexpr auto kLimitJson = rpc::spec::handlers::ledger_data::kLimitJson;
57 std::optional<boost::json::object>
header;
79 : sharedPtrBackend_(std::move(sharedPtrBackend))
101 tag_invoke(boost::json::value_from_tag, boost::json::value& jv, Output
const& output);
Result process(Input const &input, Context const &ctx) const
Process the LedgerData command.
Definition LedgerData.cpp:37
HandlerReturnType< Output > Result
The result type of the command: either the Output or an error status.
Definition LedgerData.hpp:71
static constexpr auto kLimitBinary
Maximum number of objects returned per page in binary mode.
Definition LedgerData.hpp:42
static constexpr auto kLimitJson
Maximum number of objects returned per page in JSON mode.
Definition LedgerData.hpp:46
LedgerDataHandler(std::shared_ptr< BackendInterface > sharedPtrBackend)
Construct a new LedgerDataHandler object.
Definition LedgerData.hpp:78
friend void tag_invoke(boost::json::value_from_tag, boost::json::value &jv, Output const &output)
Convert the Output to a JSON object.
Definition LedgerData.cpp:158
A simple thread-safe logger for the channel specified in the constructor.
Definition Logger.hpp:110
This namespace contains all the RPC logic and handlers.
Definition AMMHelpers.cpp:17
std::expected< OutputType, Status > HandlerReturnType
Return type for each individual handler.
Definition Types.hpp:63
spec::HandlerFor< InputT, boost::json::value > HandlerFor
The spec-driven base every typed handler inherits.
Definition SpecBackend.hpp:24
Context of an RPC call.
Definition Types.hpp:102
A struct to hold the output data of the command.
Definition LedgerData.hpp:51
bool validated
Whether the ledger is validated.
Definition LedgerData.hpp:65
std::optional< boost::json::object > header
Ledger header, only included in the first page.
Definition LedgerData.hpp:57
std::optional< std::string > marker
Hex object key to resume from, if more pages remain.
Definition LedgerData.hpp:59
std::string ledgerHash
Hash of the ledger used.
Definition LedgerData.hpp:53
std::optional< uint32_t > diffMarker
Ledger sequence to resume from when paging out of order.
Definition LedgerData.hpp:63
uint32_t ledgerIndex
Sequence of the ledger used.
Definition LedgerData.hpp:52
std::optional< bool > cacheFull
Whether the ledger cache is fully loaded.
Definition LedgerData.hpp:64
boost::json::array states
Ledger objects in this page.
Definition LedgerData.hpp:58
Result type used to return responses or error statuses to the Webserver subsystem.
Definition Types.hpp:132