rippled
Loading...
Searching...
No Matches
PathRequests.h
1#ifndef XRPL_APP_PATHS_PATHREQUESTS_H_INCLUDED
2#define XRPL_APP_PATHS_PATHREQUESTS_H_INCLUDED
3
4#include <xrpld/app/main/Application.h>
5#include <xrpld/app/paths/PathRequest.h>
6#include <xrpld/app/paths/RippleLineCache.h>
7
8#include <atomic>
9#include <mutex>
10#include <vector>
11
12namespace ripple {
13
15{
16public:
19 Application& app,
20 beast::Journal journal,
21 beast::insight::Collector::ptr const& collector)
22 : app_(app), mJournal(journal), mLastIdentifier(0)
23 {
24 mFast = collector->make_event("pathfind_fast");
25 mFull = collector->make_event("pathfind_full");
26 }
27
32 void
34
35 bool
36 requestsPending() const;
37
41 bool authoritative);
42
43 // Create a new-style path request that pushes
44 // updates to a subscriber
47 std::shared_ptr<InfoSub> const& subscriber,
49 Json::Value const& request);
50
51 // Create an old-style path request that is
52 // managed by a coroutine and updated by
53 // the path engine
57 std::function<void(void)> completion,
58 Resource::Consumer& consumer,
59 std::shared_ptr<ReadView const> const& inLedger,
60 Json::Value const& request);
61
62 // Execute an old-style path request immediately
63 // with the ledger specified by the caller
66 Resource::Consumer& consumer,
67 std::shared_ptr<ReadView const> const& inLedger,
68 Json::Value const& request);
69
70 void
75
76 void
81
82private:
83 void
85
88
91
92 // Track all requests
94
95 // Use a RippleLineCache
97
99
101};
102
103} // namespace ripple
104
105#endif
Represents a JSON value.
Definition json_value.h:130
A generic endpoint for log messages.
Definition Journal.h:41
A metric for reporting event timing.
Definition Event.h:22
void notify(std::chrono::duration< Rep, Period > const &value) const
Push an event notification.
Definition Event.h:45
PathRequests(Application &app, beast::Journal journal, beast::insight::Collector::ptr const &collector)
A collection of all PathRequest instances.
beast::Journal mJournal
void updateAll(std::shared_ptr< ReadView const > const &ledger)
Update all of the contained PathRequest instances.
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)
void insertPathRequest(PathRequest::pointer const &)
Json::Value doLegacyPathRequest(Resource::Consumer &consumer, std::shared_ptr< ReadView const > const &inLedger, Json::Value const &request)
beast::insight::Event mFull
std::weak_ptr< RippleLineCache > lineCache_
void reportFast(std::chrono::milliseconds ms)
std::shared_ptr< RippleLineCache > getLineCache(std::shared_ptr< ReadView const > const &ledger, bool authoritative)
Get the current RippleLineCache, updating it if necessary.
std::recursive_mutex mLock
bool requestsPending() const
std::atomic< int > mLastIdentifier
void reportFull(std::chrono::milliseconds ms)
Json::Value makePathRequest(std::shared_ptr< InfoSub > const &subscriber, std::shared_ptr< ReadView const > const &ledger, Json::Value const &request)
beast::insight::Event mFast
std::vector< PathRequest::wptr > requests_
Application & app_
An endpoint that consumes resources.
Definition Consumer.h:17
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6