xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
xrpld
overlay
xrpld/overlay/Peer.h
1
#pragma once
2
3
#include <xrpld/overlay/Message.h>
4
5
#include <xrpl/basics/base_uint.h>
6
#include <xrpl/beast/net/IPEndpoint.h>
7
#include <xrpl/json/json_value.h>
8
#include <xrpl/protocol/PublicKey.h>
9
10
#include <
cstddef
>
11
#include <
cstdint
>
12
#include <
memory
>
13
#include <
optional
>
14
#include <
string
>
15
16
namespace
xrpl
{
17
18
namespace
resource
{
19
class
Charge
;
20
}
// namespace resource
21
22
enum class
ProtocolFeature
{
23
LedgerReplay
,
24
LedgerNodeDepth
,
25
};
26
30
class
Peer
31
{
32
public
:
33
using
Ptr
=
std::shared_ptr<Peer>
;
34
41
using
ID
=
std::uint32_t
;
42
43
virtual
~Peer
() =
default
;
44
45
//
46
// Network
47
//
48
49
virtual
void
50
send
(
std::shared_ptr<Message>
const
& m) = 0;
51
52
[[nodiscard]]
virtual
beast::ip::Endpoint
53
getRemoteAddress
()
const
= 0;
54
58
virtual
void
59
sendTxQueue
() = 0;
60
64
virtual
void
65
addTxQueue
(
UInt256
const
&) = 0;
66
70
virtual
void
71
removeTxQueue
(
UInt256
const
&) = 0;
72
76
virtual
void
77
charge
(
resource::Charge
const
& fee,
std::string
const
& context) = 0;
78
79
//
80
// Identity
81
//
82
83
[[nodiscard]]
virtual
ID
84
id
()
const
= 0;
85
89
[[nodiscard]]
virtual
bool
90
cluster
()
const
= 0;
91
92
[[nodiscard]]
virtual
bool
93
isHighLatency
()
const
= 0;
94
95
[[nodiscard]]
virtual
int
96
getScore
(
bool
)
const
= 0;
97
98
[[nodiscard]]
virtual
PublicKey
const
&
99
getNodePublic
()
const
= 0;
100
101
virtual
json::Value
102
json
() = 0;
103
104
[[nodiscard]]
virtual
bool
105
supportsFeature
(
ProtocolFeature
f)
const
= 0;
106
107
[[nodiscard]]
virtual
std::optional<std::size_t>
108
publisherListSequence
(
PublicKey
const
&)
const
= 0;
109
110
virtual
void
111
setPublisherListSequence
(
PublicKey
const
&,
std::size_t
const
) = 0;
112
113
[[nodiscard]]
virtual
std::string
const
&
114
fingerprint
()
const
= 0;
115
//
116
// Ledger
117
//
118
119
[[nodiscard]]
virtual
UInt256
120
getClosedLedgerHash
()
const
= 0;
121
[[nodiscard]]
virtual
bool
122
hasLedger
(
UInt256
const
& hash,
std::uint32_t
seq)
const
= 0;
123
virtual
void
124
ledgerRange
(
std::uint32_t
& minSeq,
std::uint32_t
& maxSeq)
const
= 0;
125
[[nodiscard]]
virtual
bool
126
hasTxSet
(
UInt256
const
& hash)
const
= 0;
127
virtual
void
128
cycleStatus
() = 0;
129
virtual
bool
130
hasRange
(
std::uint32_t
uMin,
std::uint32_t
uMax) = 0;
131
132
[[nodiscard]]
virtual
bool
133
compressionEnabled
()
const
= 0;
134
135
[[nodiscard]]
virtual
bool
136
txReduceRelayEnabled
()
const
= 0;
137
};
138
139
}
// namespace xrpl
std::string
beast::ip::Endpoint
A version-independent IP address and port combination.
Definition
IPEndpoint.h:24
json::Value
Represents a JSON value.
Definition
json_value.h:117
xrpl::LedgerReplay
Definition
LedgerReplay.h:15
xrpl::Peer
Represents a peer connection in the overlay.
Definition
xrpld/overlay/Peer.h:31
xrpl::Peer::getScore
virtual int getScore(bool) const =0
xrpl::Peer::isHighLatency
virtual bool isHighLatency() const =0
xrpl::Peer::hasLedger
virtual bool hasLedger(UInt256 const &hash, std::uint32_t seq) const =0
xrpl::Peer::id
virtual ID id() const =0
xrpl::Peer::~Peer
virtual ~Peer()=default
xrpl::Peer::fingerprint
virtual std::string const & fingerprint() const =0
xrpl::Peer::hasRange
virtual bool hasRange(std::uint32_t uMin, std::uint32_t uMax)=0
xrpl::Peer::cluster
virtual bool cluster() const =0
Returns true if this connection is a member of the cluster.
xrpl::Peer::setPublisherListSequence
virtual void setPublisherListSequence(PublicKey const &, std::size_t const)=0
xrpl::Peer::removeTxQueue
virtual void removeTxQueue(UInt256 const &)=0
Remove hash from the transactions' hashes queue.
xrpl::Peer::hasTxSet
virtual bool hasTxSet(UInt256 const &hash) const =0
xrpl::Peer::send
virtual void send(std::shared_ptr< Message > const &m)=0
xrpl::Peer::cycleStatus
virtual void cycleStatus()=0
xrpl::Peer::getRemoteAddress
virtual beast::ip::Endpoint getRemoteAddress() const =0
xrpl::Peer::addTxQueue
virtual void addTxQueue(UInt256 const &)=0
Aggregate transaction's hash.
xrpl::Peer::compressionEnabled
virtual bool compressionEnabled() const =0
xrpl::Peer::Ptr
std::shared_ptr< Peer > Ptr
Definition
xrpld/overlay/Peer.h:33
xrpl::Peer::getNodePublic
virtual PublicKey const & getNodePublic() const =0
xrpl::Peer::charge
virtual void charge(resource::Charge const &fee, std::string const &context)=0
Adjust this peer's load balance based on the type of load imposed.
xrpl::Peer::supportsFeature
virtual bool supportsFeature(ProtocolFeature f) const =0
xrpl::Peer::publisherListSequence
virtual std::optional< std::size_t > publisherListSequence(PublicKey const &) const =0
xrpl::Peer::ID
std::uint32_t ID
Uniquely identifies a peer.
Definition
xrpld/overlay/Peer.h:41
xrpl::Peer::txReduceRelayEnabled
virtual bool txReduceRelayEnabled() const =0
xrpl::Peer::json
virtual json::Value json()=0
xrpl::Peer::ledgerRange
virtual void ledgerRange(std::uint32_t &minSeq, std::uint32_t &maxSeq) const =0
xrpl::Peer::sendTxQueue
virtual void sendTxQueue()=0
Send aggregated transactions' hashes.
xrpl::Peer::getClosedLedgerHash
virtual UInt256 getClosedLedgerHash() const =0
xrpl::PublicKey
A public key.
Definition
PublicKey.h:53
xrpl::resource::Charge
A consumption charge.
Definition
Charge.h:13
cstddef
cstdint
std::uint32_t
memory
xrpl::resource
Definition
ServiceRegistry.h:21
xrpl
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition
algorithm.h:5
xrpl::ProtocolFeature
ProtocolFeature
Definition
xrpld/overlay/Peer.h:22
xrpl::ProtocolFeature::LedgerNodeDepth
@ LedgerNodeDepth
Definition
xrpld/overlay/Peer.h:24
xrpl::UInt256
BaseUInt< 256 > UInt256
Definition
base_uint.h:580
optional
std::shared_ptr
std::size_t
string
Generated by
1.17.0