xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
xrpld
app
ledger
InboundLedgers.h
1
#pragma once
2
3
#include <xrpld/app/ledger/InboundLedger.h>
4
#include <xrpld/app/main/Application.h>
5
#include <xrpld/overlay/Peer.h>
6
7
#include <xrpl/basics/base_uint.h>
8
#include <xrpl/beast/clock/abstract_clock.h>
9
#include <xrpl/beast/insight/Collector.h>
10
#include <xrpl/json/json_value.h>
11
#include <xrpl/ledger/Ledger.h>
12
#include <xrpl/protocol/RippleLedgerHash.h>
13
14
#include <xrpl.pb.h>
15
16
#include <
chrono
>
17
#include <
cstddef
>
18
#include <
cstdint
>
19
#include <
memory
>
20
21
namespace
xrpl
{
22
28
class
InboundLedgers
29
{
30
public
:
31
using
ClockType
=
beast::AbstractClock<std::chrono::steady_clock>
;
32
33
virtual
~InboundLedgers
() =
default
;
34
35
// Callers should use this if they possibly need an authoritative
36
// response immediately.
37
virtual
std::shared_ptr<Ledger const>
38
acquire
(
UInt256
const
& hash,
std::uint32_t
seq,
InboundLedger::Reason
) = 0;
39
40
// Callers should use this if they are known to be executing on the Job
41
// Queue. TODO review whether all callers of acquire() can use this
42
// instead. Inbound ledger acquisition is asynchronous anyway.
43
virtual
void
44
acquireAsync
(
UInt256
const
& hash,
std::uint32_t
seq,
InboundLedger::Reason
reason) = 0;
45
46
virtual
std::shared_ptr<InboundLedger>
47
find
(
LedgerHash
const
& hash) = 0;
48
49
// VFALCO TODO Remove the dependency on the Peer object.
50
//
51
virtual
bool
52
gotLedgerData
(
53
LedgerHash
const
& ledgerHash,
54
std::shared_ptr<Peer>
,
55
std::shared_ptr<protocol::TMLedgerData>
) = 0;
56
57
virtual
void
58
gotStaleData
(
std::shared_ptr<protocol::TMLedgerData>
packet) = 0;
59
60
virtual
void
61
logFailure
(
UInt256
const
& h,
std::uint32_t
seq) = 0;
62
63
virtual
bool
64
isFailure
(
UInt256
const
& h) = 0;
65
66
virtual
void
67
clearFailures
() = 0;
68
69
virtual
json::Value
70
getInfo
() = 0;
71
75
virtual
std::size_t
76
fetchRate
() = 0;
77
81
virtual
void
82
onLedgerFetched
() = 0;
83
84
virtual
void
85
gotFetchPack
() = 0;
86
virtual
void
87
sweep
() = 0;
88
89
virtual
void
90
stop
() = 0;
91
92
virtual
std::size_t
93
cacheSize
() = 0;
94
};
95
96
std::unique_ptr<InboundLedgers>
97
makeInboundLedgers
(
98
Application
& app,
99
InboundLedgers::ClockType
& clock,
100
beast::insight::Collector::Ptr
const
& collector);
101
102
}
// namespace xrpl
chrono
beast::AbstractClock
Abstract interface to a clock.
Definition
abstract_clock.h:36
beast::insight::Collector::Ptr
std::shared_ptr< Collector > Ptr
Definition
Collector.h:29
json::Value
Represents a JSON value.
Definition
json_value.h:117
xrpl::Application
Definition
Application.h:94
xrpl::InboundLedger::Reason
Reason
Definition
InboundLedger.h:41
xrpl::InboundLedgers
Manages the lifetime of inbound ledgers.
Definition
InboundLedgers.h:29
xrpl::InboundLedgers::gotStaleData
virtual void gotStaleData(std::shared_ptr< protocol::TMLedgerData > packet)=0
xrpl::InboundLedgers::onLedgerFetched
virtual void onLedgerFetched()=0
Called when a complete ledger is obtained.
xrpl::InboundLedgers::ClockType
beast::AbstractClock< std::chrono::steady_clock > ClockType
Definition
InboundLedgers.h:31
xrpl::InboundLedgers::fetchRate
virtual std::size_t fetchRate()=0
Returns the rate of historical ledger fetches per minute.
xrpl::InboundLedgers::gotLedgerData
virtual bool gotLedgerData(LedgerHash const &ledgerHash, std::shared_ptr< Peer >, std::shared_ptr< protocol::TMLedgerData >)=0
xrpl::InboundLedgers::getInfo
virtual json::Value getInfo()=0
xrpl::InboundLedgers::acquire
virtual std::shared_ptr< Ledger const > acquire(UInt256 const &hash, std::uint32_t seq, InboundLedger::Reason)=0
xrpl::InboundLedgers::acquireAsync
virtual void acquireAsync(UInt256 const &hash, std::uint32_t seq, InboundLedger::Reason reason)=0
xrpl::InboundLedgers::gotFetchPack
virtual void gotFetchPack()=0
xrpl::InboundLedgers::~InboundLedgers
virtual ~InboundLedgers()=default
xrpl::InboundLedgers::clearFailures
virtual void clearFailures()=0
xrpl::InboundLedgers::sweep
virtual void sweep()=0
xrpl::InboundLedgers::cacheSize
virtual std::size_t cacheSize()=0
xrpl::InboundLedgers::isFailure
virtual bool isFailure(UInt256 const &h)=0
xrpl::InboundLedgers::find
virtual std::shared_ptr< InboundLedger > find(LedgerHash const &hash)=0
xrpl::InboundLedgers::stop
virtual void stop()=0
xrpl::InboundLedgers::logFailure
virtual void logFailure(UInt256 const &h, std::uint32_t seq)=0
cstddef
cstdint
std::uint32_t
memory
xrpl
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition
algorithm.h:5
xrpl::makeInboundLedgers
std::unique_ptr< InboundLedgers > makeInboundLedgers(Application &app, InboundLedgers::ClockType &clock, beast::insight::Collector::Ptr const &collector)
Definition
InboundLedgers.cpp:455
xrpl::LedgerHash
UInt256 LedgerHash
Definition
RippleLedgerHash.h:7
xrpl::UInt256
BaseUInt< 256 > UInt256
Definition
base_uint.h:580
std::shared_ptr
std::size_t
std::unique_ptr
Generated by
1.17.0