process

package
v1.999.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2022 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VerifyHeartbeatPropertyLen

func VerifyHeartbeatPropertyLen(property string, value []byte) error

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) Close

func (m *Monitor) Close() error

Close closes all underlying components

func (*Monitor) EpochConfirmed

func (m *Monitor) EpochConfirmed(epoch uint32, _ uint64)

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

func (m *Monitor) IsInterfaceNil() bool

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

func (m *Monitor) SaveMultipleHeartbeatMessageInfos(pubKeysToSave map[string]*heartbeatMessageInfo)

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

func (rt *RealTimer) IsInterfaceNil() bool

IsInterfaceNil verifies if the interface is nil

func (*RealTimer) Now

func (rt *RealTimer) Now() time.Time

Now returns the time.Now() Time

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

func (s *Sender) EpochConfirmed(epoch uint32, _ uint64)

EpochConfirmed is called whenever an epoch is confirmed

func (*Sender) IsInterfaceNil

func (s *Sender) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*Sender) SendHeartbeat

func (s *Sender) SendHeartbeat() error

SendHeartbeat broadcasts a new heartbeat message

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL