20 #include <ripple/app/ledger/LedgerToJson.h>
21 #include <ripple/ledger/ReadView.h>
22 #include <ripple/protocol/ErrorCodes.h>
23 #include <ripple/protocol/LedgerFormats.h>
24 #include <ripple/protocol/jss.h>
25 #include <ripple/rpc/Context.h>
26 #include <ripple/rpc/GRPCHandlers.h>
27 #include <ripple/rpc/Role.h>
28 #include <ripple/rpc/impl/GRPCHelpers.h>
29 #include <ripple/rpc/impl/RPCHelpers.h>
30 #include <ripple/rpc/impl/Tuning.h>
49 auto const& params = context.
params;
55 bool const isMarker = params.isMember(jss::marker);
64 bool const isBinary = params[jss::binary].asBool();
67 if (params.isMember(jss::limit))
73 limit = jLimit.
asInt();
77 if ((limit < 0) || ((limit > maxLimit) && (!
isUnlimited(context.
role))))
81 jvResult[jss::ledger_index] = lpLedger->
info().
seq;
87 *lpLedger, &context, isBinary ? LedgerFill::Options::binary : 0));
94 rpcStatus.inject(jvResult);
111 if (type ==
ltANY || sle->getType() == type)
117 entry[jss::index] =
to_string(sle->key());
123 entry[jss::index] =
to_string(sle->key());
135 org::xrpl::rpc::v1::GetLedgerDataRequest& request = context.
params;
136 org::xrpl::rpc::v1::GetLedgerDataResponse response;
137 grpc::Status status = grpc::Status::OK;
142 grpc::Status errorStatus;
145 errorStatus = grpc::Status(
146 grpc::StatusCode::INVALID_ARGUMENT, status.message());
151 grpc::Status(grpc::StatusCode::NOT_FOUND, status.message());
153 return {response, errorStatus};
161 else if (request.marker().size() != 0)
163 grpc::Status errorStatus{
164 grpc::StatusCode::INVALID_ARGUMENT,
"marker malformed"};
165 return {response, errorStatus};
173 else if (request.end_marker().size() != 0)
175 grpc::Status errorStatus{
176 grpc::StatusCode::INVALID_ARGUMENT,
"end marker malformed"};
177 return {response, errorStatus};
190 response.set_marker(k.data(), k.size());
193 auto stateObject = response.mutable_ledger_objects()->add_objects();
197 stateObject->set_key(sle->key().data(), sle->key().size());
199 return {response, status};