heartbeat

package
v1.7.11 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthHeartbeat        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowHeartbeat          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupHeartbeat = fmt.Errorf("proto: unexpected end of group")
)
View Source
var ErrEmptySendTopic = errors.New("empty topic for sending messages")

ErrEmptySendTopic signals that an empty topic string was provided

View Source
var ErrInvalidConfiguration = errors.New("invalid configuration")

ErrInvalidConfiguration signals that an invalid configuration has been provided

View Source
var ErrInvalidThreshold = errors.New("invalid threshold")

ErrInvalidThreshold signals that an invalid threshold was provided

View Source
var ErrInvalidTimeDuration = errors.New("invalid time duration")

ErrInvalidTimeDuration signals that an invalid time duration was provided

View Source
var ErrInvalidValue = errors.New("invalid value")

ErrInvalidValue signals that an invalid value has been provided

View Source
var ErrNilAppStatusHandler = errors.New("nil AppStatusHandler")

ErrNilAppStatusHandler defines the error for setting a nil AppStatusHandler

View Source
var ErrNilCacher = errors.New("nil cacher")

ErrNilCacher signals that a nil cache has been provided

View Source
var ErrNilCurrentBlockProvider = errors.New("nil current block provider")

ErrNilCurrentBlockProvider signals that a nil current block provider

View Source
var ErrNilHardforkTrigger = errors.New("nil hardfork trigger")

ErrNilHardforkTrigger signals that a nil hardfork trigger has been provided

View Source
var ErrNilHeartbeatMonitor = errors.New("nil heartbeat monitor")

ErrNilHeartbeatMonitor signals that a nil heartbeat monitor was provided

View Source
var ErrNilHeartbeatSenderInfoProvider = errors.New("nil heartbeat sender info provider")

ErrNilHeartbeatSenderInfoProvider signals that a nil heartbeat sender info provider was provided

View Source
var ErrNilManagedPeersHolder = errors.New("nil managed peers holder")

ErrNilManagedPeersHolder signals that a nil managed peers holder has been provided

View Source
var ErrNilMarshaller = errors.New("nil marshaller")

ErrNilMarshaller signals that a nil marshaller has been provided

View Source
var ErrNilMessenger = errors.New("nil P2P Messenger")

ErrNilMessenger signals that a nil p2p messenger has been provided

View Source
var ErrNilNodesCoordinator = errors.New("nil nodes coordinator")

ErrNilNodesCoordinator signals that an operation has been attempted to or with a nil nodes coordinator

View Source
var ErrNilPeerAuthenticationPool = errors.New("nil peer authentication pool")

ErrNilPeerAuthenticationPool signals that a nil peer authentication pool has been provided

View Source
var ErrNilPeerShardMapper = errors.New("nil peer shard mapper")

ErrNilPeerShardMapper signals that a nil peer shard mapper has been provided

View Source
var ErrNilPeerSignatureHandler = errors.New("trying to set nil peerSignatureHandler")

ErrNilPeerSignatureHandler signals that a nil peerSignatureHandler object has been provided

View Source
var ErrNilPeerTypeProvider = errors.New("nil peer type provider")

ErrNilPeerTypeProvider signals that a nil peer type provider has been given

View Source
var ErrNilPrivateKey = errors.New("nil private key")

ErrNilPrivateKey signals that a nil private key has been provided

View Source
var ErrNilPubkeyConverter = errors.New("trying to use a nil pubkey converter")

ErrNilPubkeyConverter signals that a nil public key converter has been provided

View Source
var ErrNilRandomizer = errors.New("nil randomizer")

ErrNilRandomizer signals that a nil randomizer has been provided

View Source
var ErrNilRedundancyHandler = errors.New("nil redundancy handler")

ErrNilRedundancyHandler signals that a nil redundancy handler was provided

View Source
var ErrNilRequestHandler = errors.New("nil request handler")

ErrNilRequestHandler signals that a nil request handler interface was provided

View Source
var ErrNilShardCoordinator = errors.New("nil shard coordinator")

ErrNilShardCoordinator signals that a nil shard coordinator was provided

View Source
var ErrNilTrieSyncStatisticsProvider = errors.New("nil trie sync statistics provider")

ErrNilTrieSyncStatisticsProvider signals that a nil trie sync statistics provider was provided

View Source
var ErrPropertyTooLong = errors.New("property too long in Heartbeat")

ErrPropertyTooLong signals that one of the properties is too long

View Source
var ErrShouldSkipValidator = errors.New("validator should be skipped")

ErrShouldSkipValidator signals that the validator should be skipped

Functions

This section is empty.

Types

type CurrentBlockProvider

type CurrentBlockProvider interface {
	GetCurrentBlockHeader() data.HeaderHandler
	SetCurrentBlockHeaderAndRootHash(bh data.HeaderHandler, rootHash []byte) error
	IsInterfaceNil() bool
}

CurrentBlockProvider can provide the current block that the node was able to commit

type HardforkTrigger

type HardforkTrigger interface {
	TriggerReceived(payload []byte, data []byte, pkBytes []byte) (bool, error)
	RecordedTriggerMessage() ([]byte, bool)
	NotifyTriggerReceivedV2() <-chan struct{}
	CreateData() []byte
	IsInterfaceNil() bool
}

HardforkTrigger defines the behavior of a hardfork trigger

type HeartbeatV2

type HeartbeatV2 struct {
	Payload            []byte `protobuf:"bytes,1,opt,name=Payload,proto3" json:"Payload,omitempty"`
	VersionNumber      string `protobuf:"bytes,2,opt,name=VersionNumber,proto3" json:"VersionNumber,omitempty"`
	NodeDisplayName    string `protobuf:"bytes,3,opt,name=NodeDisplayName,proto3" json:"NodeDisplayName,omitempty"`
	Identity           string `protobuf:"bytes,4,opt,name=Identity,proto3" json:"Identity,omitempty"`
	Nonce              uint64 `protobuf:"varint,5,opt,name=Nonce,proto3" json:"Nonce,omitempty"`
	PeerSubType        uint32 `protobuf:"varint,6,opt,name=PeerSubType,proto3" json:"PeerSubType,omitempty"`
	Pubkey             []byte `protobuf:"bytes,7,opt,name=Pubkey,proto3" json:"Pubkey,omitempty"`
	NumTrieNodesSynced uint64 `protobuf:"varint,8,opt,name=NumTrieNodesSynced,proto3" json:"NumTrieNodesSynced,omitempty"`
}

HeartbeatV2 represents the heartbeat message that is sent between peers from the same shard containing current node status

func (*HeartbeatV2) Descriptor

func (*HeartbeatV2) Descriptor() ([]byte, []int)

func (*HeartbeatV2) Equal

func (this *HeartbeatV2) Equal(that interface{}) bool

func (*HeartbeatV2) GetIdentity

func (m *HeartbeatV2) GetIdentity() string

func (*HeartbeatV2) GetNodeDisplayName

func (m *HeartbeatV2) GetNodeDisplayName() string

func (*HeartbeatV2) GetNonce

func (m *HeartbeatV2) GetNonce() uint64

func (*HeartbeatV2) GetNumTrieNodesSynced

func (m *HeartbeatV2) GetNumTrieNodesSynced() uint64

func (*HeartbeatV2) GetPayload

func (m *HeartbeatV2) GetPayload() []byte

func (*HeartbeatV2) GetPeerSubType

func (m *HeartbeatV2) GetPeerSubType() uint32

func (*HeartbeatV2) GetPubkey

func (m *HeartbeatV2) GetPubkey() []byte

func (*HeartbeatV2) GetVersionNumber

func (m *HeartbeatV2) GetVersionNumber() string

func (*HeartbeatV2) GoString

func (this *HeartbeatV2) GoString() string

func (*HeartbeatV2) Marshal

func (m *HeartbeatV2) Marshal() (dAtA []byte, err error)

func (*HeartbeatV2) MarshalTo

func (m *HeartbeatV2) MarshalTo(dAtA []byte) (int, error)

func (*HeartbeatV2) MarshalToSizedBuffer

func (m *HeartbeatV2) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*HeartbeatV2) ProtoMessage

func (*HeartbeatV2) ProtoMessage()

func (*HeartbeatV2) Reset

func (m *HeartbeatV2) Reset()

func (*HeartbeatV2) Size

func (m *HeartbeatV2) Size() (n int)

func (*HeartbeatV2) String

func (this *HeartbeatV2) String() string

func (*HeartbeatV2) Unmarshal

func (m *HeartbeatV2) Unmarshal(dAtA []byte) error

func (*HeartbeatV2) XXX_DiscardUnknown

func (m *HeartbeatV2) XXX_DiscardUnknown()

func (*HeartbeatV2) XXX_Marshal

func (m *HeartbeatV2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*HeartbeatV2) XXX_Merge

func (m *HeartbeatV2) XXX_Merge(src proto.Message)

func (*HeartbeatV2) XXX_Size

func (m *HeartbeatV2) XXX_Size() int

func (*HeartbeatV2) XXX_Unmarshal

func (m *HeartbeatV2) XXX_Unmarshal(b []byte) error

type ManagedPeersHolder added in v1.6.0

type ManagedPeersHolder interface {
	AddManagedPeer(privateKeyBytes []byte) error
	GetPrivateKey(pkBytes []byte) (crypto.PrivateKey, error)
	GetP2PIdentity(pkBytes []byte) ([]byte, core.PeerID, error)
	GetMachineID(pkBytes []byte) (string, error)
	GetNameAndIdentity(pkBytes []byte) (string, string, error)
	IncrementRoundsWithoutReceivedMessages(pkBytes []byte)
	ResetRoundsWithoutReceivedMessages(pkBytes []byte, pid core.PeerID)
	GetManagedKeysByCurrentNode() map[string]crypto.PrivateKey
	GetLoadedKeysByCurrentNode() [][]byte
	IsKeyManagedByCurrentNode(pkBytes []byte) bool
	IsKeyRegistered(pkBytes []byte) bool
	IsPidManagedByCurrentNode(pid core.PeerID) bool
	IsKeyValidator(pkBytes []byte) bool
	SetValidatorState(pkBytes []byte, state bool)
	GetNextPeerAuthenticationTime(pkBytes []byte) (time.Time, error)
	SetNextPeerAuthenticationTime(pkBytes []byte, nextTime time.Time)
	IsMultiKeyMode() bool
	IsInterfaceNil() bool
}

ManagedPeersHolder defines the operations of an entity that holds managed identities for a node

type NodeRedundancyHandler

type NodeRedundancyHandler interface {
	IsRedundancyNode() bool
	IsMainMachineActive() bool
	ObserverPrivateKey() crypto.PrivateKey
	IsInterfaceNil() bool
}

NodeRedundancyHandler defines the interface responsible for the redundancy management of the node

type NodesCoordinator

type NodesCoordinator interface {
	GetAllEligibleValidatorsPublicKeys(epoch uint32) (map[uint32][][]byte, error)
	GetAllWaitingValidatorsPublicKeys(epoch uint32) (map[uint32][][]byte, error)
	GetValidatorWithPublicKey(publicKey []byte) (validator nodesCoordinator.Validator, shardId uint32, err error)
	IsInterfaceNil() bool
}

NodesCoordinator defines the behavior of a struct able to do validator selection

type P2PMessenger

type P2PMessenger interface {
	Broadcast(topic string, buff []byte)
	BroadcastUsingPrivateKey(topic string, buff []byte, pid core.PeerID, skBytes []byte)
	ID() core.PeerID
	Sign(payload []byte) ([]byte, error)
	ConnectedPeersOnTopic(topic string) []core.PeerID
	SignUsingPrivateKey(skBytes []byte, payload []byte) ([]byte, error)
	IsInterfaceNil() bool
}

P2PMessenger defines a subset of the p2p.Messenger interface

type Payload

type Payload struct {
	Timestamp       int64  `protobuf:"varint,1,opt,name=Timestamp,proto3" json:"Timestamp,omitempty"`
	HardforkMessage string `protobuf:"bytes,2,opt,name=HardforkMessage,proto3" json:"HardforkMessage,omitempty"`
}

Payload represents the DTO used as payload for both HeartbeatV2 and PeerAuthentication messages

func (*Payload) Descriptor

func (*Payload) Descriptor() ([]byte, []int)

func (*Payload) Equal

func (this *Payload) Equal(that interface{}) bool

func (*Payload) GetHardforkMessage

func (m *Payload) GetHardforkMessage() string

func (*Payload) GetTimestamp

func (m *Payload) GetTimestamp() int64

func (*Payload) GoString

func (this *Payload) GoString() string

func (*Payload) Marshal

func (m *Payload) Marshal() (dAtA []byte, err error)

func (*Payload) MarshalTo

func (m *Payload) MarshalTo(dAtA []byte) (int, error)

func (*Payload) MarshalToSizedBuffer

func (m *Payload) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Payload) ProtoMessage

func (*Payload) ProtoMessage()

func (*Payload) Reset

func (m *Payload) Reset()

func (*Payload) Size

func (m *Payload) Size() (n int)

func (*Payload) String

func (this *Payload) String() string

func (*Payload) Unmarshal

func (m *Payload) Unmarshal(dAtA []byte) error

func (*Payload) XXX_DiscardUnknown

func (m *Payload) XXX_DiscardUnknown()

func (*Payload) XXX_Marshal

func (m *Payload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Payload) XXX_Merge

func (m *Payload) XXX_Merge(src proto.Message)

func (*Payload) XXX_Size

func (m *Payload) XXX_Size() int

func (*Payload) XXX_Unmarshal

func (m *Payload) XXX_Unmarshal(b []byte) error

type PeerAuthentication

type PeerAuthentication struct {
	Pubkey           []byte `protobuf:"bytes,1,opt,name=Pubkey,proto3" json:"Pubkey,omitempty"`
	Signature        []byte `protobuf:"bytes,2,opt,name=Signature,proto3" json:"Signature,omitempty"`
	Pid              []byte `protobuf:"bytes,3,opt,name=Pid,proto3" json:"Pid,omitempty"`
	Payload          []byte `protobuf:"bytes,4,opt,name=Payload,proto3" json:"Payload,omitempty"`
	PayloadSignature []byte `protobuf:"bytes,5,opt,name=PayloadSignature,proto3" json:"PayloadSignature,omitempty"`
}

PeerAuthentication represents the DTO used to pass peer authentication information such as public key, peer id, signature, payload and the signature. This message is used to link the peerID with the associated public key

func (*PeerAuthentication) Descriptor

func (*PeerAuthentication) Descriptor() ([]byte, []int)

func (*PeerAuthentication) Equal

func (this *PeerAuthentication) Equal(that interface{}) bool

func (*PeerAuthentication) GetPayload

func (m *PeerAuthentication) GetPayload() []byte

func (*PeerAuthentication) GetPayloadSignature

func (m *PeerAuthentication) GetPayloadSignature() []byte

func (*PeerAuthentication) GetPid

func (m *PeerAuthentication) GetPid() []byte

func (*PeerAuthentication) GetPubkey

func (m *PeerAuthentication) GetPubkey() []byte

func (*PeerAuthentication) GetSignature

func (m *PeerAuthentication) GetSignature() []byte

func (*PeerAuthentication) GoString

func (this *PeerAuthentication) GoString() string

func (*PeerAuthentication) Marshal

func (m *PeerAuthentication) Marshal() (dAtA []byte, err error)

func (*PeerAuthentication) MarshalTo

func (m *PeerAuthentication) MarshalTo(dAtA []byte) (int, error)

func (*PeerAuthentication) MarshalToSizedBuffer

func (m *PeerAuthentication) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*PeerAuthentication) ProtoMessage

func (*PeerAuthentication) ProtoMessage()

func (*PeerAuthentication) Reset

func (m *PeerAuthentication) Reset()

func (*PeerAuthentication) Size

func (m *PeerAuthentication) Size() (n int)

func (*PeerAuthentication) String

func (this *PeerAuthentication) String() string

func (*PeerAuthentication) Unmarshal

func (m *PeerAuthentication) Unmarshal(dAtA []byte) error

func (*PeerAuthentication) XXX_DiscardUnknown

func (m *PeerAuthentication) XXX_DiscardUnknown()

func (*PeerAuthentication) XXX_Marshal

func (m *PeerAuthentication) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*PeerAuthentication) XXX_Merge

func (m *PeerAuthentication) XXX_Merge(src proto.Message)

func (*PeerAuthentication) XXX_Size

func (m *PeerAuthentication) XXX_Size() int

func (*PeerAuthentication) XXX_Unmarshal

func (m *PeerAuthentication) XXX_Unmarshal(b []byte) error

type PeerShardMapper

type PeerShardMapper interface {
	PutPeerIdShardId(pid core.PeerID, shardID uint32)
	IsInterfaceNil() bool
}

PeerShardMapper saves the shard for a peer ID

type PeerTypeProviderHandler

type PeerTypeProviderHandler interface {
	ComputeForPubKey(pubKey []byte) (common.PeerType, uint32, error)
	GetAllPeerTypeInfos() []*state.PeerTypeInfo
	IsInterfaceNil() bool
}

PeerTypeProviderHandler defines what a component which computes the type of a peer should do

type ShardCoordinator added in v1.6.0

type ShardCoordinator interface {
	SelfId() uint32
	ComputeId(address []byte) uint32
	IsInterfaceNil() bool
}

ShardCoordinator defines the operations of a shard coordinator

type TrieSyncStatisticsProvider

type TrieSyncStatisticsProvider interface {
	NumProcessed() int
	IsInterfaceNil() bool
}

TrieSyncStatisticsProvider is able to provide trie sync statistics

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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