factory

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: GPL-3.0 Imports: 76 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxTxsToRequest specifies the maximum number of txs to request
	MaxTxsToRequest = 1000
)

Variables

This section is empty.

Functions

func CreateLatestStorageDataProvider

func CreateLatestStorageDataProvider(
	bootstrapDataProvider storageFactory.BootstrapDataProviderHandler,
	marshalizer marshal.Marshalizer,
	hasher hashing.Hasher,
	generalConfig config.Config,
	chainID string,
	workingDir string,
	defaultDBPath string,
	defaultEpochString string,
	defaultShardString string,
) (storage.LatestStorageDataProviderHandler, error)

CreateLatestStorageDataProvider will create a latest storage data provider handler

func CreateSoftwareVersionChecker

func CreateSoftwareVersionChecker(
	statusHandler core.AppStatusHandler,
	config config.SoftwareVersionConfig,
) (*softwareVersion.SoftwareVersionChecker, error)

CreateSoftwareVersionChecker will create a new software version checker and will start check if a new software version is available

func CreateStatusHandlers

func CreateStatusHandlers(arguments *ArgStatusHandlers) (*statusHandlersInfo, error)

CreateStatusHandlers will return a slice of status handlers

func CreateUnitOpener

func CreateUnitOpener(
	bootstrapDataProvider storageFactory.BootstrapDataProviderHandler,
	latestDataFromStorageProvider storage.LatestStorageDataProviderHandler,
	internalMarshalizer marshal.Marshalizer,
	generalConfig config.Config,
	chainID string,
	workingDir string,
	defaultDBPath string,
	defaultEpochString string,
	defaultShardString string,
) (storage.UnitOpenerHandler, error)

CreateUnitOpener will create a new unit opener handler

func NewProcessComponentsFactoryArgs

func NewProcessComponentsFactoryArgs(
	coreComponents *mainFactory.CoreComponentsFactoryArgs,
	accountsParser genesis.AccountsParser,
	smartContractParser genesis.InitialSmartContractParser,
	economicsData *economics.EconomicsData,
	nodesConfig *sharding.NodesSetup,
	gasSchedule map[string]map[string]uint64,
	rounder consensus.Rounder,
	shardCoordinator sharding.Coordinator,
	nodesCoordinator sharding.NodesCoordinator,
	data *mainFactory.DataComponents,
	coreData *mainFactory.CoreComponents,
	crypto *mainFactory.CryptoComponents,
	state *mainFactory.StateComponents,
	network *mainFactory.NetworkComponents,
	tries *mainFactory.TriesComponents,
	requestedItemsHandler dataRetriever.RequestedItemsHandler,
	whiteListHandler process.WhiteListHandler,
	whiteListerVerifiedTxs process.WhiteListHandler,
	epochStartNotifier EpochStartNotifier,
	mainConfig config.Config,
	startEpochNum uint32,
	rater sharding.PeerAccountListAndRatingHandler,
	sizeCheckDelta uint32,
	stateCheckpointModulus uint,
	maxComputableRounds uint64,
	numConcurrentResolverJobs int32,
	minSizeInBytes uint32,
	maxSizeInBytes uint32,
	maxRating uint32,
	validatorPubkeyConverter core.PubkeyConverter,
	ratingsData process.RatingsInfoHandler,
	systemSCConfig *config.SystemSmartContractsConfig,
	version string,
	importStartHandler update.ImportStartHandler,
	uint64Converter typeConverters.Uint64ByteSliceConverter,
	workingDir string,
	indexer indexer.Indexer,
	tpsBenchmark statistics.TPSBenchmark,
	historyRepo fullHistory.HistoryRepository,
) *processComponentsFactoryArgs

NewProcessComponentsFactoryArgs initializes the arguments necessary for creating the process components

func PrepareNetworkShardingCollector

func PrepareNetworkShardingCollector(
	network *mainFactory.NetworkComponents,
	config *config.Config,
	nodesCoordinator sharding.NodesCoordinator,
	coordinator sharding.Coordinator,
	epochStartRegistrationHandler epochStart.RegistrationHandler,
	epochStart uint32,
) (*networksharding.PeerShardMapper, error)

PrepareNetworkShardingCollector will create the network sharding collector and apply it to the network messenger and antiflood handler

func PrepareOpenTopics

func PrepareOpenTopics(
	antiflood mainFactory.P2PAntifloodHandler,
	shardCoordinator sharding.Coordinator,
)

PrepareOpenTopics will set to the anti flood handler the topics for which the node can receive messages from others than validators

Types

type ArgStatusHandlers

type ArgStatusHandlers struct {
	LogViewName                  string
	ServersConfigurationFileName string
	Ctx                          *cli.Context
	Marshalizer                  marshal.Marshalizer
	Uint64ByteSliceConverter     typeConverters.Uint64ByteSliceConverter
	ChanStartViews               chan struct{}
	ChanLogRewrite               chan struct{}
	LogFile                      *os.File
}

ArgStatusHandlers is a struct that stores arguments needed to create status handlers

func NewStatusHandlersFactoryArgs

func NewStatusHandlersFactoryArgs(
	logViewName string,
	ctx *cli.Context,
	marshalizer marshal.Marshalizer,
	uint64ByteSliceConverter typeConverters.Uint64ByteSliceConverter,
	chanStartViews chan struct{},
	chanLogRewrite chan struct{},
	logFile *os.File,
) (*ArgStatusHandlers, error)

NewStatusHandlersFactoryArgs will return arguments for status handlers

type EpochStartNotifier

type EpochStartNotifier interface {
	RegisterHandler(handler epochStart.ActionHandler)
	UnregisterHandler(handler epochStart.ActionHandler)
	NotifyAll(hdr data.HeaderHandler)
	NotifyAllPrepare(metaHdr data.HeaderHandler, body data.BodyHandler)
	RegisterForEpochChangeConfirmed(handler func(epoch uint32))
	NotifyEpochChangeConfirmed(epoch uint32)
	IsInterfaceNil() bool
}

EpochStartNotifier defines which actions should be done for handling new epoch's events

type HeaderIntegrityVerifierHandler

type HeaderIntegrityVerifierHandler interface {
	Verify(header data.HeaderHandler) error
	IsInterfaceNil() bool
}

HeaderIntegrityVerifierHandler is the interface needed to check that a header's integrity is correct

type HeaderSigVerifierHandler

type HeaderSigVerifierHandler interface {
	VerifyRandSeed(header data.HeaderHandler) error
	VerifyRandSeedAndLeaderSignature(header data.HeaderHandler) error
	VerifySignature(header data.HeaderHandler) error
	IsInterfaceNil() bool
}

HeaderSigVerifierHandler is the interface needed to check that a header's signature is correct

type P2PAntifloodHandler

type P2PAntifloodHandler interface {
	CanProcessMessage(message p2p.MessageP2P, fromConnectedPeer core.PeerID) error
	CanProcessMessagesOnTopic(peer core.PeerID, topic string, numMessages uint32) error
	ResetForTopic(topic string)
	SetMaxMessagesForTopic(topic string, maxNum uint32)
	IsInterfaceNil() bool
}

P2PAntifloodHandler defines the behavior of a component able to signal that the system is too busy (or flooded) processing p2p messages

type Process

type Process struct {
	InterceptorsContainer    process.InterceptorsContainer
	ResolversFinder          dataRetriever.ResolversFinder
	Rounder                  consensus.Rounder
	EpochStartTrigger        epochStart.TriggerHandler
	ForkDetector             process.ForkDetector
	BlockProcessor           process.BlockProcessor
	BlackListHandler         process.TimeCacher
	BootStorer               process.BootStorer
	HeaderSigVerifier        HeaderSigVerifierHandler
	HeaderIntegrityVerifier  HeaderIntegrityVerifierHandler
	ValidatorsStatistics     process.ValidatorStatisticsProcessor
	ValidatorsProvider       process.ValidatorsProvider
	BlockTracker             process.BlockTracker
	PendingMiniBlocksHandler process.PendingMiniBlocksHandler
	RequestHandler           process.RequestHandler
	TxLogsProcessor          process.TransactionLogProcessorDatabase
	HeaderValidator          epochStart.HeaderValidator
}

Process struct holds the process components

func ProcessComponentsFactory

func ProcessComponentsFactory(args *processComponentsFactoryArgs) (*Process, error)

ProcessComponentsFactory creates the process components

Jump to

Keyboard shortcuts

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