|
xrpld
|
Slots is a container for validator's Slot and handles Slot update when a message is received from a validator. More...
#include <Slot.h>

Public Member Functions | |
| Slots (ServiceRegistry ®istry, SquelchHandler const &handler, Config const &config) | |
| ~Slots ()=default | |
| bool | baseSquelchReady () |
| Check if base squelching feature is enabled and ready. | |
| bool | reduceRelayReady () |
| Check if reduce_relay::kWaitOnBootup time passed since startup. | |
| void | updateSlotAndSquelch (UInt256 const &key, PublicKey const &validator, ID id, protocol::MessageType type) |
| Calls Slot::update of Slot associated with the validator, with a noop callback. | |
| void | updateSlotAndSquelch (UInt256 const &key, PublicKey const &validator, ID id, protocol::MessageType type, Slot< ClockType >::IgnoredSquelchCallback callback) |
| Calls Slot::update of Slot associated with the validator. | |
| void | deleteIdlePeers () |
| Check if peers stopped relaying messages and if slots stopped receiving messages from the validator. | |
| std::optional< std::uint16_t > | inState (PublicKey const &validator, PeerState state) const |
| Return number of peers in state. | |
| std::optional< std::uint16_t > | notInState (PublicKey const &validator, PeerState state) const |
| Return number of peers not in state. | |
| bool | inState (PublicKey const &validator, SlotState state) const |
| Return true if Slot is in state. | |
| std::set< ID > | getSelected (PublicKey const &validator) |
| Get selected peers. | |
| std::unordered_map< Peer::ID, std::tuple< PeerState, uint16_t, uint32_t, std::uint32_t > > | getPeers (PublicKey const &validator) |
| Get peers info. | |
| std::optional< SlotState > | getState (PublicKey const &validator) |
| Get Slot's state. | |
| void | deletePeer (ID id, bool erase) |
| Called when a peer is deleted. | |
Private Types | |
| using | time_point = ClockType::time_point |
| using | ID = Peer::ID |
| using | Messages |
Private Member Functions | |
| bool | addPeerMessage (UInt256 const &key, ID id) |
| Add message/peer if have not seen this message from the peer. | |
Private Attributes | |
| std::atomic_bool | reduceRelayReady_ {false} |
| HashMap< PublicKey, Slot< ClockType > > | slots_ |
| SquelchHandler const & | handler_ |
| Logs & | logs_ |
| beast::Journal const | journal_ |
| bool const | baseSquelchEnabled_ |
| uint16_t const | maxSelectedPeers_ |
Static Private Attributes | |
| static Messages | peersWithMessage {beast::getAbstractClock<ClockType>()} |
Slots is a container for validator's Slot and handles Slot update when a message is received from a validator.
It also handles Slot aging and checks for peers which are disconnected or stopped relaying the messages.
Definition at line 572 of file src/xrpld/overlay/Slot.h.
|
private |
Definition at line 574 of file src/xrpld/overlay/Slot.h.
|
private |
Definition at line 575 of file src/xrpld/overlay/Slot.h.
|
private |
Definition at line 576 of file src/xrpld/overlay/Slot.h.
| xrpl::reduce_relay::Slots< ClockType >::Slots | ( | ServiceRegistry & | registry, |
| SquelchHandler const & | handler, | ||
| Config const & | config ) |
| registry | The service registry. |
| handler | Squelch/unsquelch implementation |
| config | reference to the global config |
Definition at line 588 of file src/xrpld/overlay/Slot.h.
|
default |
| bool xrpl::reduce_relay::Slots< ClockType >::baseSquelchReady | ( | ) |
Check if base squelching feature is enabled and ready.
Definition at line 602 of file src/xrpld/overlay/Slot.h.
| bool xrpl::reduce_relay::Slots< ClockType >::reduceRelayReady | ( | ) |
Check if reduce_relay::kWaitOnBootup time passed since startup.
Definition at line 611 of file src/xrpld/overlay/Slot.h.
| void xrpl::reduce_relay::Slots< ClockType >::updateSlotAndSquelch | ( | UInt256 const & | key, |
| PublicKey const & | validator, | ||
| ID | id, | ||
| protocol::MessageType | type ) |
Calls Slot::update of Slot associated with the validator, with a noop callback.
| key | Message's hash |
| validator | Validator's public key |
| id | Peer's id which received the message |
| type | Received protocol message type |
Definition at line 631 of file src/xrpld/overlay/Slot.h.
| void xrpl::reduce_relay::Slots< ClockType >::updateSlotAndSquelch | ( | UInt256 const & | key, |
| PublicKey const & | validator, | ||
| ID | id, | ||
| protocol::MessageType | type, | ||
| Slot< ClockType >::IgnoredSquelchCallback | callback ) |
Calls Slot::update of Slot associated with the validator.
| key | Message's hash |
| validator | Validator's public key |
| id | Peer's id which received the message |
| type | Received protocol message type |
| callback | A callback to report ignored validations |
Definition at line 805 of file src/xrpld/overlay/Slot.h.
| void xrpl::reduce_relay::Slots< ClockType >::deleteIdlePeers | ( | ) |
Check if peers stopped relaying messages and if slots stopped receiving messages from the validator.
Definition at line 843 of file src/xrpld/overlay/Slot.h.
|
nodiscard |
Return number of peers in state.
Definition at line 667 of file src/xrpld/overlay/Slot.h.
|
nodiscard |
Return number of peers not in state.
Definition at line 679 of file src/xrpld/overlay/Slot.h.
|
nodiscard |
Return true if Slot is in state.
Definition at line 691 of file src/xrpld/overlay/Slot.h.
| std::set< ID > xrpl::reduce_relay::Slots< ClockType >::getSelected | ( | PublicKey const & | validator | ) |
Get selected peers.
Definition at line 703 of file src/xrpld/overlay/Slot.h.
| std::unordered_map< Peer::ID, std::tuple< PeerState, uint16_t, uint32_t, std::uint32_t > > xrpl::reduce_relay::Slots< ClockType >::getPeers | ( | PublicKey const & | validator | ) |
Get peers info.
Return map of peer's state, count, and squelch expiration milliseconds.
Definition at line 716 of file src/xrpld/overlay/Slot.h.
| std::optional< SlotState > xrpl::reduce_relay::Slots< ClockType >::getState | ( | PublicKey const & | validator | ) |
Get Slot's state.
Definition at line 728 of file src/xrpld/overlay/Slot.h.
| void xrpl::reduce_relay::Slots< ClockType >::deletePeer | ( | ID | id, |
| bool | erase ) |
Called when a peer is deleted.
If the peer was selected to be the source of messages from the validator then squelched peers have to be unsquelched.
| id | Peer's id |
| erase | If true then erase the peer |
Definition at line 835 of file src/xrpld/overlay/Slot.h.
|
private |
Add message/peer if have not seen this message from the peer.
A message is aged after IDLED seconds. Return true if added
Definition at line 774 of file src/xrpld/overlay/Slot.h.
|
private |
Definition at line 755 of file src/xrpld/overlay/Slot.h.
|
private |
Definition at line 757 of file src/xrpld/overlay/Slot.h.
|
private |
Definition at line 758 of file src/xrpld/overlay/Slot.h.
|
private |
Definition at line 759 of file src/xrpld/overlay/Slot.h.
|
private |
Definition at line 760 of file src/xrpld/overlay/Slot.h.
|
private |
Definition at line 762 of file src/xrpld/overlay/Slot.h.
|
private |
Definition at line 763 of file src/xrpld/overlay/Slot.h.
|
staticprivate |
Definition at line 769 of file src/xrpld/overlay/Slot.h.