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/SHAMapTreeNode.h>
13
14#include <cstddef>
15#include <memory>
16#include <utility>
17#include <vector>
18
19namespace xrpl {
20
21// VFALCO TODO rename to PeerTxRequest
22// A transaction set we are trying to acquire
24 public std::enable_shared_from_this<TransactionAcquire>,
25 public CountedObject<TransactionAcquire>
26{
27public:
29
31 ~TransactionAcquire() override = default;
32
36 std::shared_ptr<Peer> const& peer);
37
38 void
39 init(int startPeers);
40
41 void
42 stillNeed();
43
44private:
46 bool haveRoot_{false};
48
49 void
50 onTimer(bool progress, ScopedLockType& peerSetLock) override;
51
52 void
53 done();
54
55 void
56 addPeers(std::size_t limit);
57
58 void
61 pmDowncast() override;
62};
63
64} // namespace xrpl
TimeoutCounter(Application &app, uint256 const &targetHash, std::chrono::milliseconds timeoutInterval, QueueJobParameter &&jobParameter, beast::Journal journal)
std::unique_lock< std::recursive_mutex > ScopedLockType
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
void trigger(std::shared_ptr< Peer > const &)
TransactionAcquire(Application &app, uint256 const &hash, std::unique_ptr< PeerSet > peerSet)
~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