process

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VerifyHeartbeatProperyLen

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

VerifyHeartbeatProperyLen 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
}

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
	StatusHandler        core.AppStatusHandler
	VersionNumber        string
	NodeDisplayName      string
	KeyBaseIdentity      string
	HardforkTrigger      heartbeat.HardforkTrigger
}

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

func (*Monitor) SetAppStatusHandler

func (m *Monitor) SetAppStatusHandler(ash core.AppStatusHandler) error

SetAppStatusHandler will set the AppStatusHandler which will be used for monitoring

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