factory

package
v1.0.102 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2020 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindLatestDataFromStorage added in v1.0.102

func FindLatestDataFromStorage(
	generalConfig config.Config,
	marshalizer marshal.Marshalizer,
	workingDir string,
	chainID string,
	defaultDBPath string,
	defaultEpochString string,
	defaultShardString string,
) (uint32, uint32, int64, error)

FindLatestDataFromStorage finds the last data (such as last epoch, shard ID or round) by searching over the storage folders and opening older databases

func GetBloomFromConfig

func GetBloomFromConfig(cfg config.BloomFilterConfig) storageUnit.BloomConfig

GetBloomFromConfig will return the bloom config needed for storage unit from a config came from the toml file

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

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

NewStorageUnitOpenHandler creates an openStorageUnits component TODO refactor this and unit tests

Types

type ArgsNewOpenStorageUnits added in v1.0.102

type ArgsNewOpenStorageUnits struct {
	GeneralConfig      config.Config
	Marshalizer        marshal.Marshalizer
	WorkingDir         string
	ChainID            string
	DefaultDBPath      string
	DefaultEpochString string
	DefaultShardString string
}

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

type PersisterFactory

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

PersisterFactory is the factory which will handle creating new databases

func NewPersisterFactory

func NewPersisterFactory(config config.DBConfig) *PersisterFactory

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) 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(
	config *config.Config,
	shardCoordinator sharding.Coordinator,
	pathManager storage.PathManagerHandler,
	epochStartNotifier storage.EpochStartNotifier,
	currentEpoch uint32,
) (*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

Jump to

Keyboard shortcuts

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