bootstrap

package
v1.7.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const DefaultTimeToWaitForRequestedData = time.Minute

DefaultTimeToWaitForRequestedData represents the default timespan until requested data needs to be received from the connected peers

Variables

This section is empty.

Functions

func NewEpochStartBootstrap

func NewEpochStartBootstrap(args ArgsEpochStartBootstrap) (*epochStartBootstrap, error)

NewEpochStartBootstrap will return a new instance of epochStartBootstrap

func NewEpochStartMetaBlockProcessor

func NewEpochStartMetaBlockProcessor(
	messenger Messenger,
	handler RequestHandler,
	marshalizer marshal.Marshalizer,
	hasher hashing.Hasher,
	consensusPercentage uint8,
	minNumConnectedPeersConfig int,
	minNumOfPeersToConsiderBlockValidConfig int,
) (*epochStartMetaBlockProcessor, error)

NewEpochStartMetaBlockProcessor will return an interceptor processor for epoch start meta block

func NewEpochStartMetaSyncer

func NewEpochStartMetaSyncer(args ArgsNewEpochStartMetaSyncer) (*epochStartMetaSyncer, error)

NewEpochStartMetaSyncer will return a new instance of epochStartMetaSyncer

func NewMetaStorageHandler

func NewMetaStorageHandler(args StorageHandlerArgs) (*metaStorageHandler, error)

NewMetaStorageHandler will return a new instance of metaStorageHandler

func NewShardStorageHandler

func NewShardStorageHandler(args StorageHandlerArgs) (*shardStorageHandler, error)

NewShardStorageHandler will return a new instance of shardStorageHandler

func NewStorageEpochStartBootstrap

func NewStorageEpochStartBootstrap(args ArgsStorageEpochStartBootstrap) (*storageEpochStartBootstrap, error)

NewStorageEpochStartBootstrap will return a new instance of storageEpochStartBootstrap that can bootstrap the node with the help of storage requesters through the import-db process

func NewStorageEpochStartMetaBlockProcessor

func NewStorageEpochStartMetaBlockProcessor(
	messenger Messenger,
	handler RequestHandler,
	marshalizer marshal.Marshalizer,
	hasher hashing.Hasher,
) (*storageEpochStartMetaBlockProcessor, error)

NewStorageEpochStartMetaBlockProcessor will return an interceptor processor for epoch start meta block when importing data from storage

func NewSyncValidatorStatus

func NewSyncValidatorStatus(args ArgsNewSyncValidatorStatus) (*syncValidatorStatus, error)

NewSyncValidatorStatus creates a new validator status process component

Types

type ArgsEpochStartBootstrap

type ArgsEpochStartBootstrap struct {
	CoreComponentsHolder            process.CoreComponentsHolder
	CryptoComponentsHolder          process.CryptoComponentsHolder
	DestinationShardAsObserver      uint32
	MainMessenger                   p2p.Messenger
	FullArchiveMessenger            p2p.Messenger
	GeneralConfig                   config.Config
	PrefsConfig                     config.PreferencesConfig
	FlagsConfig                     config.ContextFlagsConfig
	EconomicsData                   process.EconomicsDataHandler
	GenesisNodesConfig              sharding.GenesisNodesSetupHandler
	GenesisShardCoordinator         sharding.Coordinator
	StorageUnitOpener               storage.UnitOpenerHandler
	LatestStorageDataProvider       storage.LatestStorageDataProviderHandler
	Rater                           nodesCoordinator.ChanceComputer
	NodeShuffler                    nodesCoordinator.NodesShuffler
	RoundHandler                    epochStart.RoundHandler
	ArgumentsParser                 process.ArgumentsParser
	StatusHandler                   core.AppStatusHandler
	HeaderIntegrityVerifier         process.HeaderIntegrityVerifier
	DataSyncerCreator               types.ScheduledDataSyncerCreator
	ScheduledSCRsStorer             storage.Storer
	TrieSyncStatisticsProvider      common.SizeSyncStatisticsHandler
	NodeProcessingMode              common.NodeProcessingMode
	StateStatsHandler               common.StateStatisticsHandler
	NodesCoordinatorRegistryFactory nodesCoordinator.NodesCoordinatorRegistryFactory
}

ArgsEpochStartBootstrap holds the arguments needed for creating an epoch start data provider component

type ArgsNewEpochStartMetaSyncer

type ArgsNewEpochStartMetaSyncer struct {
	CoreComponentsHolder    process.CoreComponentsHolder
	CryptoComponentsHolder  process.CryptoComponentsHolder
	RequestHandler          RequestHandler
	Messenger               Messenger
	ShardCoordinator        sharding.Coordinator
	EconomicsData           process.EconomicsDataHandler
	WhitelistHandler        process.WhiteListHandler
	StartInEpochConfig      config.EpochStartConfig
	ArgsParser              process.ArgumentsParser
	HeaderIntegrityVerifier process.HeaderIntegrityVerifier
	MetaBlockProcessor      EpochStartMetaBlockInterceptorProcessor
}

ArgsNewEpochStartMetaSyncer -

type ArgsNewSyncValidatorStatus

type ArgsNewSyncValidatorStatus struct {
	DataPool                        dataRetriever.PoolsHolder
	Marshalizer                     marshal.Marshalizer
	Hasher                          hashing.Hasher
	RequestHandler                  process.RequestHandler
	ChanceComputer                  nodesCoordinator.ChanceComputer
	GenesisNodesConfig              sharding.GenesisNodesSetupHandler
	NodeShuffler                    nodesCoordinator.NodesShuffler
	PubKey                          []byte
	ShardIdAsObserver               uint32
	ChanNodeStop                    chan endProcess.ArgEndProcess
	NodeTypeProvider                NodeTypeProviderHandler
	IsFullArchive                   bool
	EnableEpochsHandler             common.EnableEpochsHandler
	NodesCoordinatorRegistryFactory nodesCoordinator.NodesCoordinatorRegistryFactory
}

ArgsNewSyncValidatorStatus holds the arguments needed for creating a new validator status process component

type ArgsStorageEpochStartBootstrap

type ArgsStorageEpochStartBootstrap struct {
	ArgsEpochStartBootstrap
	ImportDbConfig             config.ImportDbConfig
	ChanGracefullyClose        chan endProcess.ArgEndProcess
	TimeToWaitForRequestedData time.Duration
}

ArgsStorageEpochStartBootstrap holds the arguments needed for creating an epoch start data provider component from storage

type ComponentsNeededForBootstrap

type ComponentsNeededForBootstrap struct {
	EpochStartMetaBlock data.MetaHeaderHandler
	PreviousEpochStart  data.MetaHeaderHandler
	ShardHeader         data.HeaderHandler
	NodesConfig         nodesCoordinator.NodesCoordinatorRegistryHandler
	Headers             map[string]data.HeaderHandler
	ShardCoordinator    sharding.Coordinator
	PendingMiniBlocks   map[string]*block.MiniBlock
	PeerMiniBlocks      []*block.MiniBlock
}

ComponentsNeededForBootstrap holds the components which need to be initialized from network

type EpochStartMetaBlockInterceptorProcessor

type EpochStartMetaBlockInterceptorProcessor interface {
	process.InterceptorProcessor
	GetEpochStartMetaBlock(ctx context.Context) (data.MetaHeaderHandler, error)
}

EpochStartMetaBlockInterceptorProcessor defines the methods to sync an epoch start metablock

type Messenger

type Messenger interface {
	dataRetriever.MessageHandler
	dataRetriever.TopicHandler
	UnregisterMessageProcessor(topic string, identifier string) error
	UnregisterAllMessageProcessors() error
	UnJoinAllTopics() error
	ConnectedPeers() []core.PeerID
	Verify(payload []byte, pid core.PeerID, signature []byte) error
	Broadcast(topic string, buff []byte)
	BroadcastUsingPrivateKey(topic string, buff []byte, pid core.PeerID, skBytes []byte)
	Sign(payload []byte) ([]byte, error)
	SignUsingPrivateKey(skBytes []byte, payload []byte) ([]byte, error)
}

Messenger defines which methods a p2p messenger should implement

type NodeTypeProviderHandler

type NodeTypeProviderHandler interface {
	SetType(nodeType core.NodeType)
	GetType() core.NodeType
	IsInterfaceNil() bool
}

NodeTypeProviderHandler defines the actions needed for a component that can handle the node type

type Parameters

type Parameters struct {
	Epoch       uint32
	SelfShardId uint32
	NumOfShards uint32
	NodesConfig nodesCoordinator.NodesCoordinatorRegistryHandler
}

Parameters defines the DTO for the result produced by the bootstrap component

type RequestHandler

type RequestHandler interface {
	RequestStartOfEpochMetaBlock(epoch uint32)
	SetNumPeersToQuery(topic string, intra int, cross int) error
	GetNumPeersToQuery(topic string) (int, int, error)
	IsInterfaceNil() bool
}

RequestHandler defines which methods a request handler should implement

type ScheduledDataSyncerFactory

type ScheduledDataSyncerFactory struct{}

ScheduledDataSyncerFactory is a factory for the scheduled data syncer

func NewScheduledDataSyncerFactory

func NewScheduledDataSyncerFactory() *ScheduledDataSyncerFactory

NewScheduledDataSyncerFactory creates a factory instance

func (*ScheduledDataSyncerFactory) Create

Create creates a scheduled data syncer

func (*ScheduledDataSyncerFactory) IsInterfaceNil

func (sdsf *ScheduledDataSyncerFactory) IsInterfaceNil() bool

IsInterfaceNil returns nil if the underlying object is nil

type StartInEpochNodesCoordinator

type StartInEpochNodesCoordinator interface {
	EpochStartPrepare(metaHdr data.HeaderHandler, body data.BodyHandler)
	NodesCoordinatorToRegistry(epoch uint32) nodesCoordinator.NodesCoordinatorRegistryHandler
	ShardIdForEpoch(epoch uint32) (uint32, error)
	IsInterfaceNil() bool
}

StartInEpochNodesCoordinator defines the methods to process and save nodesCoordinator information to storage

type StartOfEpochNodesConfigHandler

type StartOfEpochNodesConfigHandler interface {
	NodesConfigFromMetaBlock(currMetaBlock data.HeaderHandler, prevMetaBlock data.HeaderHandler) (nodesCoordinator.NodesCoordinatorRegistryHandler, uint32, []*block.MiniBlock, error)
	IsInterfaceNil() bool
}

StartOfEpochNodesConfigHandler defines the methods to process nodesConfig from epoch start metablocks

type StorageHandlerArgs added in v1.7.0

type StorageHandlerArgs struct {
	GeneralConfig                   config.Config
	PreferencesConfig               config.PreferencesConfig
	ShardCoordinator                sharding.Coordinator
	PathManagerHandler              storage.PathManagerHandler
	Marshaller                      marshal.Marshalizer
	Hasher                          hashing.Hasher
	CurrentEpoch                    uint32
	Uint64Converter                 typeConverters.Uint64ByteSliceConverter
	NodeTypeProvider                NodeTypeProviderHandler
	NodesCoordinatorRegistryFactory nodesCoordinator.NodesCoordinatorRegistryFactory
	SnapshotsEnabled                bool
	ManagedPeersHolder              common.ManagedPeersHolder
	NodeProcessingMode              common.NodeProcessingMode
	RepopulateTokensSupplies        bool
	StateStatsHandler               common.StateStatisticsHandler
}

StorageHandlerArgs is a struct placeholder for all arguments required to create either a shard or a meta storage handler

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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