peer

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: GPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBootstrapPeerTypeProvider

func NewBootstrapPeerTypeProvider() *bootstrapPeerTypeProvider

NewBootstrapPeerTypeProvider returns a new instance of bootstrapPeerTypeProvider It should be used for bootstrap only!

func NewInterceptedValidatorInfo

func NewInterceptedValidatorInfo(args ArgInterceptedValidatorInfo) (*interceptedValidatorInfo, error)

NewInterceptedValidatorInfo creates a new intercepted validator info instance

func NewValidatorStatisticsProcessor

func NewValidatorStatisticsProcessor(arguments ArgValidatorStatisticsProcessor) (*validatorStatistics, error)

NewValidatorStatisticsProcessor instantiates a new validatorStatistics structure responsible for keeping account of

each validator actions in the consensus process

func NewValidatorsProvider

func NewValidatorsProvider(
	args ArgValidatorsProvider,
) (*validatorsProvider, error)

NewValidatorsProvider instantiates a new validatorsProvider structure responsible for keeping account of the latest information about the validators

Types

type ArgInterceptedValidatorInfo

type ArgInterceptedValidatorInfo struct {
	DataBuff    []byte
	Marshalizer marshal.Marshalizer
	Hasher      hashing.Hasher
}

ArgInterceptedValidatorInfo is the argument used to create a new intercepted validator info

type ArgPeerTypeProvider

type ArgPeerTypeProvider struct {
	NodesCoordinator        process.NodesCoordinator
	StartEpoch              uint32
	EpochStartEventNotifier process.EpochStartEventNotifier
}

ArgPeerTypeProvider contains all parameters needed for creating a PeerTypeProvider

type ArgValidatorStatisticsProcessor

type ArgValidatorStatisticsProcessor struct {
	Marshalizer                          marshal.Marshalizer
	NodesCoordinator                     nodesCoordinator.NodesCoordinator
	ShardCoordinator                     sharding.Coordinator
	DataPool                             DataPool
	StorageService                       dataRetriever.StorageService
	PubkeyConv                           core.PubkeyConverter
	PeerAdapter                          state.AccountsAdapter
	Rater                                sharding.PeerAccountListAndRatingHandler
	RewardsHandler                       process.RewardsHandler
	MaxComputableRounds                  uint64
	MaxConsecutiveRoundsOfRatingDecrease uint64
	NodesSetup                           sharding.GenesisNodesSetupHandler
	GenesisNonce                         uint64
	RatingEnableEpoch                    uint32
	EnableEpochsHandler                  common.EnableEpochsHandler
}

ArgValidatorStatisticsProcessor holds all dependencies for the validatorStatistics

type ArgValidatorsProvider

type ArgValidatorsProvider struct {
	NodesCoordinator                  process.NodesCoordinator
	EpochStartEventNotifier           process.EpochStartEventNotifier
	CacheRefreshIntervalDurationInSec time.Duration
	ValidatorStatistics               process.ValidatorStatisticsProcessor
	ValidatorPubKeyConverter          core.PubkeyConverter
	AddressPubKeyConverter            core.PubkeyConverter
	StakingDataProvider               StakingDataProviderAPI
	AuctionListSelector               epochStart.AuctionListSelector
	StartEpoch                        uint32
	MaxRating                         uint32
}

ArgValidatorsProvider contains all parameters needed for creating a validatorsProvider

type DataPool

type DataPool interface {
	Headers() dataRetriever.HeadersPool
	IsInterfaceNil() bool
}

DataPool indicates the main functionality needed in order to fetch the required blocks from the pool

type ListIndexUpdater

type ListIndexUpdater struct {
	// contains filtered or unexported fields
}

ListIndexUpdater will handle the updating of list type and the index for a peer

func (*ListIndexUpdater) IsInterfaceNil

func (liu *ListIndexUpdater) IsInterfaceNil() bool

IsInterfaceNil checks if the underlying object is nil

func (*ListIndexUpdater) UpdateListAndIndex

func (liu *ListIndexUpdater) UpdateListAndIndex(pubKey string, shardID uint32, list string, index uint32) error

UpdateListAndIndex will update the list and the index for a given peer

type PeerTypeProvider

type PeerTypeProvider struct {
	// contains filtered or unexported fields
}

PeerTypeProvider handles the computation of a peer type

func NewPeerTypeProvider

func NewPeerTypeProvider(arg ArgPeerTypeProvider) (*PeerTypeProvider, error)

NewPeerTypeProvider will return a new instance of PeerTypeProvider

func (*PeerTypeProvider) ComputeForPubKey

func (ptp *PeerTypeProvider) ComputeForPubKey(pubKey []byte) (common.PeerType, uint32, error)

ComputeForPubKey returns the peer type for a given public key and shard id

func (*PeerTypeProvider) GetAllPeerTypeInfos

func (ptp *PeerTypeProvider) GetAllPeerTypeInfos() []*state.PeerTypeInfo

GetAllPeerTypeInfos returns all known peer type infos

func (*PeerTypeProvider) IsInterfaceNil

func (ptp *PeerTypeProvider) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

type RatingReader

type RatingReader struct {
	// contains filtered or unexported fields
}

RatingReader will handle the fetching of the ratings

func (*RatingReader) GetRating

func (bsr *RatingReader) GetRating(pk string) uint32

GetRating returns the Rating for the specified public key

func (*RatingReader) IsInterfaceNil

func (bsr *RatingReader) IsInterfaceNil() bool

IsInterfaceNil checks if the underlying object is nil

type StakingDataProviderAPI added in v1.7.0

type StakingDataProviderAPI interface {
	ComputeUnQualifiedNodes(validatorInfos state.ShardValidatorsInfoMapHandler) ([][]byte, map[string][][]byte, error)
	FillValidatorInfo(validator state.ValidatorInfoHandler) error
	GetOwnersData() map[string]*epochStart.OwnerData
	Clean()
	IsInterfaceNil() bool
}

StakingDataProviderAPI is able to provide staking data from the system smart contracts

Jump to

Keyboard shortcuts

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