bootstrap

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2022 License: GPL-3.0 Imports: 64 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(
	generalConfig config.Config,
	prefsConfig config.PreferencesConfig,
	shardCoordinator sharding.Coordinator,
	pathManagerHandler storage.PathManagerHandler,
	marshalizer marshal.Marshalizer,
	hasher hashing.Hasher,
	currentEpoch uint32,
	uint64Converter typeConverters.Uint64ByteSliceConverter,
	nodeTypeProvider NodeTypeProviderHandler,
) (*metaStorageHandler, error)

NewMetaStorageHandler will return a new instance of metaStorageHandler

func NewShardStorageHandler

func NewShardStorageHandler(
	generalConfig config.Config,
	prefsConfig config.PreferencesConfig,
	shardCoordinator sharding.Coordinator,
	pathManagerHandler storage.PathManagerHandler,
	marshalizer marshal.Marshalizer,
	hasher hashing.Hasher,
	currentEpoch uint32,
	uint64Converter typeConverters.Uint64ByteSliceConverter,
	nodeTypeProvider core.NodeTypeProviderHandler,
) (*shardStorageHandler, error)

NewShardStorageHandler will return a new instance of shardStorageHandler

func NewStorageEpochStartBootstrap added in v1.2.0

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

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

func NewStorageEpochStartMetaBlockProcessor added in v1.2.0

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

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
}

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

type ArgsStorageEpochStartBootstrap added in v1.2.0

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.NodesCoordinatorRegistry
	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 added in v1.0.116

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)
	Sign(payload []byte) ([]byte, error)
}

Messenger defines which methods a p2p messenger should implement

type NodeTypeProviderHandler added in v1.2.4

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.NodesCoordinatorRegistry
}

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 added in v1.3.0

type ScheduledDataSyncerFactory struct{}

ScheduledDataSyncerFactory is a factory for the scheduled data syncer

func NewScheduledDataSyncerFactory added in v1.3.0

func NewScheduledDataSyncerFactory() *ScheduledDataSyncerFactory

NewScheduledDataSyncerFactory creates a factory instance

func (*ScheduledDataSyncerFactory) Create added in v1.3.0

Create creates a scheduled data syncer

func (*ScheduledDataSyncerFactory) IsInterfaceNil added in v1.3.0

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() *nodesCoordinator.NodesCoordinatorRegistry
	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.NodesCoordinatorRegistry, uint32, []*block.MiniBlock, error)
	IsInterfaceNil() bool
}

StartOfEpochNodesConfigHandler defines the methods to process nodesConfig from epoch start metablocks

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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