factory

package
v1.6.18 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: GPL-3.0 Imports: 25 Imported by: 3 modules, 4 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreatePathManager

func CreatePathManager(arg ArgCreatePathManager) (*pathmanager.PathManager, error)

CreatePathManager crates a path manager from provided working directory and chain ID

func CreatePathManagerFromSinglePathString

func CreatePathManagerFromSinglePathString(dbPathWithChainID string) (*pathmanager.PathManager, error)

CreatePathManagerFromSinglePathString crates a path manager from provided path string

func GetCacherFromConfig

func GetCacherFromConfig(cfg config.CacheConfig) storageunit.CacheConfig

GetCacherFromConfig will return the cache config needed for storage unit from a config came from the toml file

func GetDBFromConfig

func GetDBFromConfig(cfg config.DBConfig) storageunit.DBConfig

GetDBFromConfig will return the db config needed for storage unit from a config came from the toml file

func NewBootstrapDataProvider

func NewBootstrapDataProvider(marshalizer marshal.Marshalizer) (*bootstrapDataProvider, error)

NewBootstrapDataProvider returns a new instance of bootstrapDataProvider

func NewDBConfigHandler added in v1.6.0

func NewDBConfigHandler(config config.DBConfig) *dbConfigHandler

NewDBConfigHandler will create a new db config handler instance

func NewStorageUnitOpenHandler

func NewStorageUnitOpenHandler(args ArgsNewOpenStorageUnits) (*openStorageUnits, error)

NewStorageUnitOpenHandler creates an openStorageUnits component

Types

type ArgCreatePathManager

type ArgCreatePathManager struct {
	WorkingDir string
	ChainID    string
}

ArgCreatePathManager is used to pass the strings to the path manager factory function

type ArgsNewOpenStorageUnits

type ArgsNewOpenStorageUnits struct {
	BootstrapDataProvider     BootstrapDataProviderHandler
	LatestStorageDataProvider storage.LatestStorageDataProviderHandler
	DefaultEpochString        string
	DefaultShardString        string
}

ArgsNewOpenStorageUnits defines the arguments in order to open a set of storage units from disk

type BootstrapDataProviderHandler

type BootstrapDataProviderHandler interface {
	LoadForPath(persisterFactory storage.PersisterFactory, path string) (*bootstrapStorage.BootstrapData, storage.Storer, error)
	GetStorer(storer storage.Storer) (process.BootStorer, error)
	IsInterfaceNil() bool
}

BootstrapDataProviderHandler defines which actions should be done for loading bootstrap data from the boot storer

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 PersisterFactory

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

PersisterFactory is the factory which will handle creating new databases

func NewPersisterFactory

func NewPersisterFactory(dbConfigHandler storage.DBConfigHandler) (*PersisterFactory, error)

NewPersisterFactory will return a new instance of a PersisterFactory

func (*PersisterFactory) Create

func (pf *PersisterFactory) Create(path string) (storage.Persister, error)

Create will return a new instance of a DB with a given path

func (*PersisterFactory) CreateDisabled

func (pf *PersisterFactory) CreateDisabled() storage.Persister

CreateDisabled will return a new disabled persister

func (*PersisterFactory) IsInterfaceNil

func (pf *PersisterFactory) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

type StorageServiceFactory

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

StorageServiceFactory handles the creation of storage services for both meta and shards

func NewStorageServiceFactory

func NewStorageServiceFactory(args StorageServiceFactoryArgs) (*StorageServiceFactory, error)

NewStorageServiceFactory will return a new instance of StorageServiceFactory

func (*StorageServiceFactory) CreateForMeta

func (psf *StorageServiceFactory) CreateForMeta() (dataRetriever.StorageService, error)

CreateForMeta will return the storage service which contains all storers needed for metachain

func (*StorageServiceFactory) CreateForShard

func (psf *StorageServiceFactory) CreateForShard() (dataRetriever.StorageService, error)

CreateForShard will return the storage service which contains all storers needed for a shard

type StorageServiceFactoryArgs

type StorageServiceFactoryArgs struct {
	Config                        config.Config
	PrefsConfig                   config.PreferencesConfig
	ShardCoordinator              storage.ShardCoordinator
	PathManager                   storage.PathManagerHandler
	EpochStartNotifier            epochStart.EpochStartNotifier
	NodeTypeProvider              NodeTypeProviderHandler
	StorageType                   StorageServiceType
	ManagedPeersHolder            storage.ManagedPeersHolder
	CurrentEpoch                  uint32
	CreateTrieEpochRootHashStorer bool
	NodeProcessingMode            common.NodeProcessingMode
	RepopulateTokensSupplies      bool
}

StorageServiceFactoryArgs holds the arguments needed for creating a new storage service factory

type StorageServiceType

type StorageServiceType string

StorageServiceType defines the type of StorageService

const (
	// BootstrapStorageService is used when the node is bootstrapping
	BootstrapStorageService StorageServiceType = "bootstrap"

	// ProcessStorageService is used in normal processing
	ProcessStorageService StorageServiceType = "process"
)

Jump to

Keyboard shortcuts

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