bootstrap

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2021 License: GPL-3.0 Imports: 52 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
	EpochConfig                config.EpochConfig
	EconomicsData              process.EconomicsDataHandler
	GenesisNodesConfig         sharding.GenesisNodesSetupHandler
	GenesisShardCoordinator    sharding.Coordinator
	StorageUnitOpener          storage.UnitOpenerHandler
	LatestStorageDataProvider  storage.LatestStorageDataProviderHandler
	Rater                      sharding.ChanceComputer
	NodeShuffler               sharding.NodesShuffler
	RoundHandler               epochStart.RoundHandler
	ArgumentsParser            process.ArgumentsParser
	StatusHandler              core.AppStatusHandler
	HeaderIntegrityVerifier    process.HeaderIntegrityVerifier
}

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            sharding.ChanceComputer
	GenesisNodesConfig        sharding.GenesisNodesSetupHandler
	NodeShuffler              sharding.NodesShuffler
	PubKey                    []byte
	ShardIdAsObserver         uint32
	WaitingListFixEnableEpoch uint32
	ChanNodeStop              chan endProcess.ArgEndProcess
	NodeTypeProvider          NodeTypeProviderHandler
	IsFullArchive             bool
}

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 *block.MetaBlock
	PreviousEpochStart  *block.MetaBlock
	ShardHeader         *block.Header
	NodesConfig         *sharding.NodesCoordinatorRegistry
	Headers             map[string]data.HeaderHandler
	ShardCoordinator    sharding.Coordinator
	PendingMiniBlocks   map[string]*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) (*block.MetaBlock, 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
}

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 *sharding.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 StartInEpochNodesCoordinator

type StartInEpochNodesCoordinator interface {
	EpochStartPrepare(metaHdr data.HeaderHandler, body data.BodyHandler)
	NodesCoordinatorToRegistry() *sharding.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 *block.MetaBlock, prevMetaBlock *block.MetaBlock) (*sharding.NodesCoordinatorRegistry, uint32, 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