rippled
Loading...
Searching...
No Matches
PathRequests.h
1#pragma once
2
3#include <xrpld/app/main/Application.h>
4#include <xrpld/app/paths/PathRequest.h>
5#include <xrpld/app/paths/RippleLineCache.h>
6
7#include <atomic>
8#include <mutex>
9#include <vector>
10
11namespace xrpl {
12
14{
15public:
18 : app_(app), mJournal(journal), mLastIdentifier(0)
19 {
20 mFast = collector->make_event("pathfind_fast");
21 mFull = collector->make_event("pathfind_full");
22 }
23
28 void
30
31 bool
32 requestsPending() const;
33
35 getLineCache(std::shared_ptr<ReadView const> const& ledger, bool authoritative);
36
37 // Create a new-style path request that pushes
38 // updates to a subscriber
41 std::shared_ptr<InfoSub> const& subscriber,
43 Json::Value const& request);
44
45 // Create an old-style path request that is
46 // managed by a coroutine and updated by
47 // the path engine
51 std::function<void(void)> completion,
52 Resource::Consumer& consumer,
53 std::shared_ptr<ReadView const> const& inLedger,
54 Json::Value const& request);
55
56 // Execute an old-style path request immediately
57 // with the ledger specified by the caller
60 Resource::Consumer& consumer,
61 std::shared_ptr<ReadView const> const& inLedger,
62 Json::Value const& request);
63
64 void
69
70 void
75
76private:
77 void
79
82
85
86 // Track all requests
88
89 // Use a RippleLineCache
91
93
95};
96
97} // 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
beast::insight::Event mFast
beast::Journal mJournal
Application & app_
std::weak_ptr< RippleLineCache > lineCache_
bool requestsPending() const
std::shared_ptr< RippleLineCache > getLineCache(std::shared_ptr< ReadView const > const &ledger, bool authoritative)
Get the current RippleLineCache, updating it if necessary.
Json::Value makePathRequest(std::shared_ptr< InfoSub > const &subscriber, std::shared_ptr< ReadView const > const &ledger, Json::Value const &request)
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)
void updateAll(std::shared_ptr< ReadView const > const &ledger)
Update all of the contained PathRequest instances.
void reportFast(std::chrono::milliseconds ms)
PathRequests(Application &app, beast::Journal journal, beast::insight::Collector::ptr const &collector)
A collection of all PathRequest instances.
void reportFull(std::chrono::milliseconds ms)
std::recursive_mutex mLock
std::atomic< int > mLastIdentifier
std::vector< PathRequest::wptr > requests_
beast::insight::Event mFull
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