rippled
Loading...
Searching...
No Matches
PathRequestManager.h
1#pragma once
2
3#include <xrpld/app/main/Application.h>
4#include <xrpld/rpc/detail/PathRequest.h>
5#include <xrpld/rpc/detail/RippleLineCache.h>
6
7#include <atomic>
8#include <mutex>
9#include <vector>
10
11namespace xrpl {
12
14{
15public:
18 Application& app,
19 beast::Journal journal,
20 beast::insight::Collector::ptr const& collector)
21 : app_(app), mJournal(journal), mLastIdentifier(0)
22 {
23 mFast = collector->make_event("pathfind_fast");
24 mFull = collector->make_event("pathfind_full");
25 }
26
31 void
33
34 bool
35 requestsPending() const;
36
38 getLineCache(std::shared_ptr<ReadView const> const& ledger, bool authoritative);
39
40 // Create a new-style path request that pushes
41 // updates to a subscriber
44 std::shared_ptr<InfoSub> const& subscriber,
46 Json::Value const& request);
47
48 // Create an old-style path request that is
49 // managed by a coroutine and updated by
50 // the path engine
54 std::function<void(void)> completion,
55 Resource::Consumer& consumer,
56 std::shared_ptr<ReadView const> const& inLedger,
57 Json::Value const& request);
58
59 // Execute an old-style path request immediately
60 // with the ledger specified by the caller
63 Resource::Consumer& consumer,
64 std::shared_ptr<ReadView const> const& inLedger,
65 Json::Value const& request);
66
67 void
72
73 void
78
79private:
80 void
82
85
88
89 // Track all requests
91
92 // Use a RippleLineCache
94
96
98};
99
100} // namespace xrpl
Represents a JSON value.
Definition json_value.h:130
A generic endpoint for log messages.
Definition Journal.h:40
A metric for reporting event timing.
Definition Event.h:21
void notify(std::chrono::duration< Rep, Period > const &value) const
Push an event notification.
Definition Event.h:44
std::atomic< int > mLastIdentifier
std::vector< PathRequest::wptr > requests_
std::shared_ptr< RippleLineCache > getLineCache(std::shared_ptr< ReadView const > const &ledger, bool authoritative)
Get the current RippleLineCache, updating it if necessary.
void reportFull(std::chrono::milliseconds ms)
beast::insight::Event mFast
void updateAll(std::shared_ptr< ReadView const > const &ledger)
Update all of the contained PathRequest instances.
void reportFast(std::chrono::milliseconds ms)
Json::Value makePathRequest(std::shared_ptr< InfoSub > const &subscriber, std::shared_ptr< ReadView const > const &ledger, Json::Value const &request)
std::weak_ptr< RippleLineCache > lineCache_
Json::Value doLegacyPathRequest(Resource::Consumer &consumer, std::shared_ptr< ReadView const > const &inLedger, Json::Value const &request)
void insertPathRequest(PathRequest::pointer const &)
std::recursive_mutex mLock
PathRequestManager(Application &app, beast::Journal journal, beast::insight::Collector::ptr const &collector)
A collection of all PathRequest instances.
beast::insight::Event mFull
Json::Value makeLegacyPathRequest(PathRequest::pointer &req, std::function< void(void)> completion, Resource::Consumer &consumer, std::shared_ptr< ReadView const > const &inLedger, Json::Value const &request)
An endpoint that consumes resources.
Definition Consumer.h:16
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5