Clio  develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
Context.hpp
1#pragma once
2
3#include "data/Types.hpp"
4#include "util/Taggable.hpp"
5#include "util/log/Logger.hpp"
6#include "web/SubscriptionContextInterface.hpp"
7
8#include <boost/asio/spawn.hpp>
9#include <boost/json.hpp>
10#include <boost/json/object.hpp>
11
12#include <cstdint>
13#include <string>
14#include <utility>
15
16namespace web {
17
23 boost::asio::yield_context yield;
24 std::string method;
25 std::uint32_t apiVersion;
26 boost::json::object params;
29 std::string clientIp;
30 bool isAdmin;
31
46 boost::asio::yield_context yield,
47 std::string command,
48 std::uint32_t apiVersion,
49 boost::json::object params,
50 SubscriptionContextPtr subscriptionContext,
51 util::TagDecoratorFactory const& tagFactory,
52 data::LedgerRange const& range,
53 std::string clientIp,
54 bool isAdmin
55 )
56 : Taggable(tagFactory)
57 , yield(std::move(yield))
58 , method(std::move(command))
59 , apiVersion(apiVersion)
60 , params(std::move(params))
61 , session(std::move(subscriptionContext))
62 , range(range)
63 , clientIp(std::move(clientIp))
64 , isAdmin(isAdmin)
65 {
66 static util::Logger const log{"Performance"}; // NOLINT(readability-identifier-naming)
67 LOG(log.debug()) << tag() << "new Context created";
68 }
69
70 Context(Context&&) = default;
71 Context&
72 operator=(Context&&) = default;
73};
74
75} // namespace web
A simple thread-safe logger for the channel specified in the constructor.
Definition Logger.hpp:77
Pump debug(SourceLocationType const &loc=CURRENT_SRC_LOCATION) const
Interface for logging at Severity::DBG severity.
Definition Logger.cpp:483
A factory for TagDecorator instantiation.
Definition Taggable.hpp:165
A base class that allows attaching a tag decorator to a subclass.
Definition Taggable.hpp:236
BaseTagDecorator const & tag() const
Getter for tag decorator.
Definition Taggable.hpp:264
Taggable(util::TagDecoratorFactory const &tagFactory)
New Taggable from a specified factory.
Definition Taggable.hpp:246
This namespace implements the web server and related components.
Definition Types.hpp:24
std::shared_ptr< SubscriptionContextInterface > SubscriptionContextPtr
An alias for shared pointer to a SubscriptionContextInterface.
Definition SubscriptionContextInterface.hpp:64
Stores a range of sequences as a min and max pair.
Definition Types.hpp:243
Context that is used by the Webserver to pass around information about an incoming request.
Definition Context.hpp:22
Context(boost::asio::yield_context yield, std::string command, std::uint32_t apiVersion, boost::json::object params, SubscriptionContextPtr subscriptionContext, util::TagDecoratorFactory const &tagFactory, data::LedgerRange const &range, std::string clientIp, bool isAdmin)
Create a new Context instance.
Definition Context.hpp:45