rippled
Loading...
Searching...
No Matches
LedgerDeltaAcquire.h
1#ifndef XRPL_APP_LEDGER_LEDGERDELTAACQUIRE_H_INCLUDED
2#define XRPL_APP_LEDGER_LEDGERDELTAACQUIRE_H_INCLUDED
3
4#include <xrpld/app/ledger/InboundLedger.h>
5#include <xrpld/app/ledger/Ledger.h>
6#include <xrpld/app/ledger/detail/TimeoutCounter.h>
7
8#include <xrpl/basics/CountedObject.h>
9#include <xrpl/basics/base_uint.h>
10
11#include <map>
12
13namespace ripple {
14class InboundLedgers;
15class PeerSet;
16namespace test {
17class LedgerReplayClient;
18} // namespace test
19
26 : public TimeoutCounter,
27 public std::enable_shared_from_this<LedgerDeltaAcquire>,
28 public CountedObject<LedgerDeltaAcquire>
29{
30public:
37 std::function<void(bool successful, uint256 const& hash)>;
38
48 Application& app,
49 InboundLedgers& inboundLedgers,
50 uint256 const& ledgerHash,
51 std::uint32_t ledgerSeq,
53
54 ~LedgerDeltaAcquire() override;
55
60 void
61 init(int numPeers);
62
70 void
72 LedgerInfo const& info,
74
84
92 void
94
95private:
96 void
97 onTimer(bool progress, ScopedLockType& peerSetLock) override;
98
100 pmDowncast() override;
101
107 void
109
118 void
120 ScopedLockType& sl,
122
127 void
129
139 bool fallBack_ = false;
140
141 friend class LedgerReplayTask; // for asserts only
143};
144
145} // namespace ripple
146
147#endif
Tracks the number of instances of an object.
Manages the lifetime of inbound ledgers.
Manage the retrieval of a ledger delta (header and transactions) from the network.
std::shared_ptr< Ledger const > fullLedger_
void trigger(std::size_t limit, ScopedLockType &sl)
Trigger another round.
std::set< InboundLedger::Reason > reasons_
void processData(LedgerInfo const &info, std::map< std::uint32_t, std::shared_ptr< STTx const > > &&orderedTxns)
Process the data extracted from a peer's reply.
std::map< std::uint32_t, std::shared_ptr< STTx const > > orderedTxns_
std::shared_ptr< Ledger const > tryBuild(std::shared_ptr< Ledger const > const &parent)
Try to build the ledger if not already.
std::shared_ptr< Ledger const > replayTemp_
void init(int numPeers)
Start the LedgerDeltaAcquire task.
std::vector< OnDeltaDataCB > dataReadyCallbacks_
void onTimer(bool progress, ScopedLockType &peerSetLock) override
Hook called from invokeOnTimer().
std::unique_ptr< PeerSet > peerSet_
void notify(ScopedLockType &sl)
Call the OnDeltaDataCB callbacks.
std::weak_ptr< TimeoutCounter > pmDowncast() override
Return a weak pointer to this.
void addDataCallback(InboundLedger::Reason reason, OnDeltaDataCB &&cb)
Add a reason and a callback to the LedgerDeltaAcquire subtask.
void onLedgerBuilt(ScopedLockType &sl, std::optional< InboundLedger::Reason > reason={})
Process a newly built ledger, such as store it.
This class is an "active" object.
std::unique_lock< std::recursive_mutex > ScopedLockType
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
Information about the notional ledger backing the view.