|
rippled
|
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 (Logs &logs, 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::WAIT_ON_BOOTUP time passed since startup. | |
| void | updateSlotAndSquelch (uint256 const &key, PublicKey const &validator, id_t 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_t id, protocol::MessageType type, typename Slot< clock_type >::ignored_squelch_callback 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_t > | getSelected (PublicKey const &validator) |
| Get selected peers. | |
| std::unordered_map< typename Peer::id_t, 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_t id, bool erase) |
| Called when a peer is deleted. | |
Private Types | |
| using | time_point = typename clock_type::time_point |
| using | id_t = typename Peer::id_t |
| using | messages = beast::aged_unordered_map< uint256, std::unordered_set< Peer::id_t >, clock_type, hardened_hash< strong_hash > > |
Private Member Functions | |
| bool | addPeerMessage (uint256 const &key, id_t id) |
| Add message/peer if have not seen this message from the peer. | |
Private Attributes | |
| std::atomic_bool | reduceRelayReady_ {false} |
| hash_map< PublicKey, Slot< clock_type > > | slots_ |
| SquelchHandler const & | handler_ |
| Logs & | logs_ |
| beast::Journal const | journal_ |
| bool const | baseSquelchEnabled_ |
| uint16_t const | maxSelectedPeers_ |
Static Private Attributes | |
| static messages | peersWithMessage_ |
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 569 of file overlay/Slot.h.
|
private |
Definition at line 571 of file overlay/Slot.h.
|
private |
Definition at line 572 of file overlay/Slot.h.
|
private |
Definition at line 573 of file overlay/Slot.h.
| ripple::reduce_relay::Slots< clock_type >::Slots | ( | Logs & | logs, |
| SquelchHandler const & | handler, | ||
| Config const & | config | ||
| ) |
| logs | reference to the logger |
| handler | Squelch/unsquelch implementation |
| config | reference to the global config |
Definition at line 585 of file overlay/Slot.h.
|
default |
| bool ripple::reduce_relay::Slots< clock_type >::baseSquelchReady | ( | ) |
Check if base squelching feature is enabled and ready.
Definition at line 597 of file overlay/Slot.h.
| bool ripple::reduce_relay::Slots< clock_type >::reduceRelayReady | ( | ) |
Check if reduce_relay::WAIT_ON_BOOTUP time passed since startup.
Definition at line 604 of file overlay/Slot.h.
| void ripple::reduce_relay::Slots< clock_type >::updateSlotAndSquelch | ( | uint256 const & | key, |
| PublicKey const & | validator, | ||
| id_t | 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 622 of file overlay/Slot.h.
| void ripple::reduce_relay::Slots< clock_type >::updateSlotAndSquelch | ( | uint256 const & | key, |
| PublicKey const & | validator, | ||
| id_t | id, | ||
| protocol::MessageType | type, | ||
| typename Slot< clock_type >::ignored_squelch_callback | 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 785 of file overlay/Slot.h.
| void ripple::reduce_relay::Slots< clock_type >::deleteIdlePeers | ( | ) |
Check if peers stopped relaying messages and if slots stopped receiving messages from the validator.
Definition at line 823 of file overlay/Slot.h.
| std::optional< std::uint16_t > ripple::reduce_relay::Slots< clock_type >::inState | ( | PublicKey const & | validator, |
| PeerState | state | ||
| ) | const |
Return number of peers in state.
Definition at line 654 of file overlay/Slot.h.
| std::optional< std::uint16_t > ripple::reduce_relay::Slots< clock_type >::notInState | ( | PublicKey const & | validator, |
| PeerState | state | ||
| ) | const |
Return number of peers not in state.
Definition at line 664 of file overlay/Slot.h.
| bool ripple::reduce_relay::Slots< clock_type >::inState | ( | PublicKey const & | validator, |
| SlotState | state | ||
| ) | const |
Return true if Slot is in state.
Definition at line 674 of file overlay/Slot.h.
| std::set< id_t > ripple::reduce_relay::Slots< clock_type >::getSelected | ( | PublicKey const & | validator | ) |
Get selected peers.
Definition at line 684 of file overlay/Slot.h.
| std::unordered_map< typename Peer::id_t, std::tuple< PeerState, uint16_t, uint32_t, std::uint32_t > > ripple::reduce_relay::Slots< clock_type >::getPeers | ( | PublicKey const & | validator | ) |
Get peers info.
Return map of peer's state, count, and squelch expiration milliseconds.
Definition at line 698 of file overlay/Slot.h.
| std::optional< SlotState > ripple::reduce_relay::Slots< clock_type >::getState | ( | PublicKey const & | validator | ) |
Get Slot's state.
Definition at line 708 of file overlay/Slot.h.
| void ripple::reduce_relay::Slots< clock_type >::deletePeer | ( | id_t | 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 815 of file 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 752 of file overlay/Slot.h.
|
private |
Definition at line 732 of file overlay/Slot.h.
|
private |
Definition at line 734 of file overlay/Slot.h.
|
private |
Definition at line 735 of file overlay/Slot.h.
|
private |
Definition at line 736 of file overlay/Slot.h.
|
private |
Definition at line 737 of file overlay/Slot.h.
|
private |
Definition at line 739 of file overlay/Slot.h.
|
private |
Definition at line 740 of file overlay/Slot.h.
|
staticprivate |
Definition at line 746 of file overlay/Slot.h.