xrpld
Loading...
Searching...
No Matches
TransactionAcquire.h
1#pragma once
2
3#include <xrpld/app/ledger/detail/TimeoutCounter.h>
4#include <xrpld/app/main/Application.h>
5#include <xrpld/overlay/Peer.h>
6#include <xrpld/overlay/PeerSet.h>
7
8#include <xrpl/basics/CountedObject.h>
9#include <xrpl/basics/base_uint.h>
10#include <xrpl/shamap/SHAMap.h>
11#include <xrpl/shamap/SHAMapAddNode.h>
12#include <xrpl/shamap/SHAMapNodeID.h>
13#include <xrpl/shamap/SHAMapTreeNode.h>
14
15#include <cstddef>
16#include <memory>
17#include <utility>
18#include <vector>
19
20namespace xrpl {
21
22// VFALCO TODO rename to PeerTxRequest
23// A transaction set we are trying to acquire
25 public std::enable_shared_from_this<TransactionAcquire>,
26 public CountedObject<TransactionAcquire>
27{
28public:
30
32 ~TransactionAcquire() override = default;
33
37 std::shared_ptr<Peer> const& peer);
38
39 void
40 init(int startPeers);
41
42 void
43 stillNeed();
44
45private:
47 bool haveRoot_{false};
49
50 void
51 onTimer(bool progress, ScopedLockType& peerSetLock) override;
52
53 void
54 done();
55
56 void
57 addPeers(std::size_t limit);
58
59 void
62 pmDowncast() override;
63};
64
65} // namespace xrpl
std::unique_lock< std::recursive_mutex > ScopedLockType
TimeoutCounter(Application &app, UInt256 const &targetHash, std::chrono::milliseconds timeoutInterval, QueueJobParameter &&jobParameter, beast::Journal journal)
void onTimer(bool progress, ScopedLockType &peerSetLock) override
Hook called from invokeOnTimer().
SHAMapAddNode takeNodes(std::vector< std::pair< SHAMapNodeID, SHAMapTreeNodePtr > > data, std::shared_ptr< Peer > const &peer)
std::shared_ptr< SHAMap > map_
void addPeers(std::size_t limit)
std::shared_ptr< TransactionAcquire > pointer
TransactionAcquire(Application &app, UInt256 const &hash, std::unique_ptr< PeerSet > peerSet)
void trigger(std::shared_ptr< Peer > const &)
~TransactionAcquire() override=default
std::weak_ptr< TimeoutCounter > pmDowncast() override
Return a weak pointer to this.
std::unique_ptr< PeerSet > peerSet_
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
BaseUInt< 256 > UInt256
Definition base_uint.h:580