xrpld
Loading...
Searching...
No Matches
xrpl::rpc::LedgerHandler Class Reference

Handles the ledger RPC method. More...

#include <Ledger.h>

Inheritance diagram for xrpl::rpc::LedgerHandler:
Collaboration diagram for xrpl::rpc::LedgerHandler:

Classes

struct  Output
 The data a ledger request produces, written out by writeResult(). More...

Public Member Functions

 LedgerHandler (JsonContext &context)
 Construct a handler for a single request.
std::expected< Output, ::rpc::Status > process (Input const &input)
 Process the request.
void writeResult (json::Value &value, Output const &output) const
 Write the output of process() into the response.

Private Attributes

std::reference_wrapper< JsonContext > context_

Detailed Description

Handles the ledger RPC method.

The request is parsed by ::rpc::spec::handlers::ledger.

Definition at line 34 of file src/xrpld/rpc/handlers/ledger/Ledger.h.

Constructor & Destructor Documentation

◆ LedgerHandler()

xrpl::rpc::LedgerHandler::LedgerHandler ( JsonContext & context)
explicit

Construct a handler for a single request.

Parameters
contextThe context of the request being handled.

Definition at line 39 of file xrpld/rpc/handlers/ledger/Ledger.cpp.

Member Function Documentation

◆ process()

std::expected< LedgerHandler::Output,::rpc::Status > xrpl::rpc::LedgerHandler::process ( Input const & input)
nodiscard

Process the request.

Parameters
inputThe request, parsed and validated by the spec.
Returns
The output to write, or the status of the error.

Definition at line 44 of file xrpld/rpc/handlers/ledger/Ledger.cpp.

◆ writeResult()

void xrpl::rpc::LedgerHandler::writeResult ( json::Value & value,
Output const & output ) const

Write the output of process() into the response.

Parameters
valueThe response to write into.
outputThe output process() returned.

Definition at line 89 of file xrpld/rpc/handlers/ledger/Ledger.cpp.

Member Data Documentation

◆ context_

std::reference_wrapper<JsonContext> xrpl::rpc::LedgerHandler::context_
private

Definition at line 73 of file src/xrpld/rpc/handlers/ledger/Ledger.h.