xrpld
Loading...
Searching...
No Matches
PeerReservationsList.cpp
1#include <xrpld/rpc/Context.h>
2#include <xrpld/rpc/handlers/Handlers.h>
3
4#include <xrpl/core/PeerReservationTable.h>
5#include <xrpl/json/json_value.h>
6#include <xrpl/protocol/jss.h>
7
8namespace xrpl {
9
10json::Value
12{
13 auto const& reservations = context.app.getPeerReservations().list();
14 // Enumerate the reservations in context.app.getPeerReservations()
15 // as a json::Value.
17 json::Value& jaReservations = result[jss::reservations] = json::ValueType::Array;
18 for (auto const& reservation : reservations)
19 {
20 jaReservations.append(reservation.toJson());
21 }
22 return result;
23}
24
25} // namespace xrpl
Represents a JSON value.
Definition json_value.h:117
Value & append(Value const &value)
Append value to array at the end.
std::vector< PeerReservation > list() const
virtual PeerReservationTable & getPeerReservations()=0
@ Array
array value (ordered list)
Definition json_value.h:28
@ Object
object value (collection of name/value pairs).
Definition json_value.h:29
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
json::Value doPeerReservationsList(rpc::JsonContext &context)
Application & app
Definition Context.h:29