rippled
Loading...
Searching...
No Matches
LedgerDeltaAcquire.h
1#pragma once
2
3#include <xrpld/app/ledger/InboundLedger.h>
4#include <xrpld/app/ledger/Ledger.h>
5#include <xrpld/app/ledger/detail/TimeoutCounter.h>
6
7#include <xrpl/basics/CountedObject.h>
8#include <xrpl/basics/base_uint.h>
9
10#include <map>
11
12namespace xrpl {
13class InboundLedgers;
14class PeerSet;
15namespace test {
16class LedgerReplayClient;
17} // namespace test
18
25 public std::enable_shared_from_this<LedgerDeltaAcquire>,
26 public CountedObject<LedgerDeltaAcquire>
27{
28public:
34 using OnDeltaDataCB = std::function<void(bool successful, uint256 const& hash)>;
35
45 Application& app,
46 InboundLedgers& inboundLedgers,
47 uint256 const& ledgerHash,
48 std::uint32_t ledgerSeq,
50
51 ~LedgerDeltaAcquire() override;
52
57 void
58 init(int numPeers);
59
67 void
69
79
87 void
89
90private:
91 void
92 onTimer(bool progress, ScopedLockType& peerSetLock) override;
93
95 pmDowncast() override;
96
102 void
104
113 void
115
120 void
122
132 bool fallBack_ = false;
133
134 friend class LedgerReplayTask; // for asserts only
136};
137
138} // namespace xrpl
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::uint32_t const ledgerSeq_
void trigger(std::size_t limit, ScopedLockType &sl)
Trigger another round.
void init(int numPeers)
Start the LedgerDeltaAcquire task.
std::shared_ptr< Ledger const > fullLedger_
void onLedgerBuilt(ScopedLockType &sl, std::optional< InboundLedger::Reason > reason={})
Process a newly built ledger, such as store it.
std::vector< OnDeltaDataCB > dataReadyCallbacks_
void processData(LedgerHeader const &info, std::map< std::uint32_t, std::shared_ptr< STTx const > > &&orderedTxns)
Process the data extracted from a peer's reply.
std::unique_ptr< PeerSet > peerSet_
std::set< InboundLedger::Reason > reasons_
void notify(ScopedLockType &sl)
Call the OnDeltaDataCB callbacks.
std::shared_ptr< Ledger const > replayTemp_
void onTimer(bool progress, ScopedLockType &peerSetLock) override
Hook called from invokeOnTimer().
std::weak_ptr< TimeoutCounter > pmDowncast() override
Return a weak pointer to this.
std::shared_ptr< Ledger const > tryBuild(std::shared_ptr< Ledger const > const &parent)
Try to build the ledger if not already.
std::map< std::uint32_t, std::shared_ptr< STTx const > > orderedTxns_
void addDataCallback(InboundLedger::Reason reason, OnDeltaDataCB &&cb)
Add a reason and a callback to the LedgerDeltaAcquire subtask.
This class is an "active" object.
std::unique_lock< std::recursive_mutex > ScopedLockType
Ledger replay client side.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
Information about the notional ledger backing the view.