nodeinfo

package
v2.3.3 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	DisableBroadcastNodeInfo:  false,
	BroadcastNodeInfoInterval: 1 * time.Minute,
	NodeMapSize:               1000,
}

DefaultConfig is the default config

Functions

This section is empty.

Types

type Config

type Config struct {
	DisableBroadcastNodeInfo  bool          `yaml:"enableBroadcastNodeInfo"`
	BroadcastNodeInfoInterval time.Duration `yaml:"broadcastNodeInfoInterval"`
	NodeMapSize               int           `yaml:"nodeMapSize"`
}

Config node config

type Info

type Info struct {
	Version   string
	Height    uint64
	Timestamp time.Time
	Address   string
	PeerID    string
}

Info node infomation

type InfoManager

type InfoManager struct {
	lifecycle.Lifecycle
	// contains filtered or unexported fields
}

InfoManager manage delegate node info

func NewInfoManager

func NewInfoManager(cfg *Config, t transmitter, ch chain, blockInterval time.Duration, privKeys ...crypto.PrivateKey) *InfoManager

NewInfoManager new info manager

func (*InfoManager) BroadcastNodeInfo

func (dm *InfoManager) BroadcastNodeInfo(ctx context.Context, addrs []string) error

BroadcastNodeInfo broadcast request node info message

func (*InfoManager) GetNodeInfo

func (dm *InfoManager) GetNodeInfo(addr string) (Info, bool)

GetNodeInfo get node info by address

func (*InfoManager) HandleNodeInfo

func (dm *InfoManager) HandleNodeInfo(ctx context.Context, peerID string, msg *iotextypes.NodeInfo)

HandleNodeInfo handle node info message

func (*InfoManager) HandleNodeInfoRequest

func (dm *InfoManager) HandleNodeInfoRequest(ctx context.Context, peer peer.AddrInfo) error

HandleNodeInfoRequest tell node info to peer

func (*InfoManager) MayHaveBlock added in v2.3.3

func (dm *InfoManager) MayHaveBlock(peerID string, start uint64) bool

MayHaveBlock check whether the peer may have the block starting from 'start'

func (*InfoManager) RequestSingleNodeInfoAsync

func (dm *InfoManager) RequestSingleNodeInfoAsync(ctx context.Context, peer peer.AddrInfo) error

RequestSingleNodeInfoAsync unicast request node info message

func (*InfoManager) Start

func (dm *InfoManager) Start(ctx context.Context) error

Start start delegate broadcast task

func (*InfoManager) Stop

func (dm *InfoManager) Stop(ctx context.Context) error

Stop stop delegate broadcast task

Jump to

Keyboard shortcuts

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