Documentation ¶
Index ¶
- func VerifyHeartbeatPropertyLen(property string, value []byte) error
- type ArgHeartbeatMonitor
- type ArgHeartbeatSender
- type MessageProcessor
- type Monitor
- func (m *Monitor) Cleanup()
- func (m *Monitor) Close() error
- func (m *Monitor) EpochConfirmed(epoch uint32, _ uint64)
- func (m *Monitor) GetHeartbeats() []data.PubKeyHeartbeat
- func (m *Monitor) IsInterfaceNil() bool
- func (m *Monitor) ProcessReceivedMessage(message p2p.MessageP2P, fromConnectedPeer core.PeerID) error
- func (m *Monitor) SaveMultipleHeartbeatMessageInfos(pubKeysToSave map[string]*heartbeatMessageInfo)
- type RealTimer
- type Sender
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func VerifyHeartbeatPropertyLen ¶
VerifyHeartbeatPropertyLen returns an error if the provided value is longer than accepted by the network
Types ¶
type ArgHeartbeatMonitor ¶
type ArgHeartbeatMonitor struct { Marshalizer marshal.Marshalizer MaxDurationPeerUnresponsive time.Duration PubKeysMap map[uint32][]string GenesisTime time.Time MessageHandler heartbeat.MessageHandler Storer heartbeat.HeartbeatStorageHandler PeerTypeProvider heartbeat.PeerTypeProviderHandler Timer heartbeat.Timer AntifloodHandler heartbeat.P2PAntifloodHandler HardforkTrigger heartbeat.HardforkTrigger ValidatorPubkeyConverter core.PubkeyConverter HeartbeatRefreshIntervalInSec uint32 HideInactiveValidatorIntervalInSec uint32 AppStatusHandler core.AppStatusHandler EpochNotifier vmcommon.EpochNotifier HeartbeatDisableEpoch uint32 }
ArgHeartbeatMonitor represents the arguments for the heartbeat monitor
type ArgHeartbeatSender ¶
type ArgHeartbeatSender struct { PeerMessenger heartbeat.P2PMessenger PeerSignatureHandler crypto.PeerSignatureHandler PrivKey crypto.PrivateKey Marshalizer marshal.Marshalizer Topic string ShardCoordinator sharding.Coordinator PeerTypeProvider heartbeat.PeerTypeProviderHandler PeerSubType core.P2PPeerSubType StatusHandler core.AppStatusHandler VersionNumber string NodeDisplayName string KeyBaseIdentity string HardforkTrigger heartbeat.HardforkTrigger CurrentBlockProvider heartbeat.CurrentBlockProvider RedundancyHandler heartbeat.NodeRedundancyHandler EpochNotifier vmcommon.EpochNotifier HeartbeatDisableEpoch uint32 }
ArgHeartbeatSender represents the arguments for the heartbeat sender
type MessageProcessor ¶
type MessageProcessor struct {
// contains filtered or unexported fields
}
MessageProcessor is the struct that will handle heartbeat message verifications and conversion between heartbeatMessageInfo and HeartbeatDTO
func NewMessageProcessor ¶
func NewMessageProcessor( peerSignatureHandler crypto.PeerSignatureHandler, marshalizer marshal.Marshalizer, networkShardingCollector heartbeat.NetworkShardingCollector, ) (*MessageProcessor, error)
NewMessageProcessor will return a new instance of MessageProcessor
func (*MessageProcessor) CreateHeartbeatFromP2PMessage ¶
func (mp *MessageProcessor) CreateHeartbeatFromP2PMessage(message p2p.MessageP2P) (*data.Heartbeat, error)
CreateHeartbeatFromP2PMessage will return a heartbeat if all the checks pass
func (*MessageProcessor) IsInterfaceNil ¶
func (mp *MessageProcessor) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
Monitor represents the heartbeat component that processes received heartbeat messages
func NewMonitor ¶
func NewMonitor(arg ArgHeartbeatMonitor) (*Monitor, error)
NewMonitor returns a new monitor instance
func (*Monitor) Cleanup ¶
func (m *Monitor) Cleanup()
Cleanup will delete all the entries in the heartbeatMessages map
func (*Monitor) EpochConfirmed ¶
EpochConfirmed is called whenever an epoch is confirmed
func (*Monitor) GetHeartbeats ¶
func (m *Monitor) GetHeartbeats() []data.PubKeyHeartbeat
GetHeartbeats returns the heartbeat status
func (*Monitor) IsInterfaceNil ¶
IsInterfaceNil returns true if there is no value under the interface
func (*Monitor) ProcessReceivedMessage ¶
func (m *Monitor) ProcessReceivedMessage(message p2p.MessageP2P, fromConnectedPeer core.PeerID) error
ProcessReceivedMessage satisfies the p2p.MessageProcessor interface so it can be called by the p2p subsystem each time a new heartbeat message arrives
func (*Monitor) SaveMultipleHeartbeatMessageInfos ¶
SaveMultipleHeartbeatMessageInfos stores all heartbeatMessageInfos to the storer
type RealTimer ¶
type RealTimer struct { }
RealTimer is an implementation of Timer and uses real time.now
func (*RealTimer) IsInterfaceNil ¶
IsInterfaceNil verifies if the interface is nil
type Sender ¶
type Sender struct {
// contains filtered or unexported fields
}
Sender periodically sends heartbeat messages on a pubsub topic
func NewSender ¶
func NewSender(arg ArgHeartbeatSender) (*Sender, error)
NewSender will create a new sender instance
func (*Sender) EpochConfirmed ¶
EpochConfirmed is called whenever an epoch is confirmed
func (*Sender) IsInterfaceNil ¶
IsInterfaceNil returns true if there is no value under the interface
func (*Sender) SendHeartbeat ¶
SendHeartbeat broadcasts a new heartbeat message