pruning

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: 20 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFullHistoryTriePruningStorer added in v1.3.0

func NewFullHistoryTriePruningStorer(args FullHistoryStorerArgs) (*fullHistoryTriePruningStorer, error)

NewFullHistoryTriePruningStorer will return a new instance of PruningStorer without sharded directories' naming scheme

func NewPersistersTracker added in v1.4.0

func NewPersistersTracker(args EpochArgs) *normalPersistersTracker

NewPersistersTracker creates a new instance of normalPersistersTracker. It is not safe to use in a concurrent manner

func NewTriePersisterTracker added in v1.4.0

func NewTriePersisterTracker(args EpochArgs) *triePersistersTracker

NewTriePersisterTracker creates a new instance of triePersistersTracker. It is not safe to use in a concurrent manner

func NewTriePruningStorer added in v1.3.0

func NewTriePruningStorer(args StorerArgs) (*triePruningStorer, error)

NewTriePruningStorer will return a new instance of NewTriePruningStorer

Types

type DbFactoryHandler

type DbFactoryHandler interface {
	Create(filePath string) (storage.Persister, error)
	CreateDisabled() storage.Persister
	IsInterfaceNil() bool
}

DbFactoryHandler defines what a db factory implementation should do

type EpochArgs added in v1.4.0

type EpochArgs struct {
	NumOfEpochsToKeep     uint32
	NumOfActivePersisters uint32
	StartingEpoch         uint32
}

EpochArgs will hold the arguments needed for persistersTracker

type EpochStartNotifier

type EpochStartNotifier interface {
	RegisterHandler(handler epochStart.ActionHandler)
	IsInterfaceNil() bool
}

EpochStartNotifier defines what a component which will handle registration to epoch start event should do

type FullHistoryPruningStorer added in v1.2.0

type FullHistoryPruningStorer struct {
	*PruningStorer
	// contains filtered or unexported fields
}

FullHistoryPruningStorer represents a storer for full history nodes which creates a new persister for each epoch and removes older activePersisters

func NewFullHistoryPruningStorer added in v1.2.0

func NewFullHistoryPruningStorer(args FullHistoryStorerArgs) (*FullHistoryPruningStorer, error)

NewFullHistoryPruningStorer will return a new instance of PruningStorer without sharded directories' naming scheme

func NewShardedFullHistoryPruningStorer added in v1.2.0

func NewShardedFullHistoryPruningStorer(
	args FullHistoryStorerArgs,
	shardID uint32,
) (*FullHistoryPruningStorer, error)

NewShardedFullHistoryPruningStorer will return a new instance of PruningStorer with sharded directories' naming scheme

func (*FullHistoryPruningStorer) Close added in v1.3.0

func (fhps *FullHistoryPruningStorer) Close() error

Close will try to close all opened persisters, including the ones in the LRU cache

func (*FullHistoryPruningStorer) GetBulkFromEpoch added in v1.2.23

func (fhps *FullHistoryPruningStorer) GetBulkFromEpoch(keys [][]byte, epoch uint32) ([]storageCore.KeyValuePair, error)

GetBulkFromEpoch will search a bulk of keys in the persister for the given epoch doesn't return an error if a key or any isn't found

func (*FullHistoryPruningStorer) GetFromEpoch added in v1.2.0

func (fhps *FullHistoryPruningStorer) GetFromEpoch(key []byte, epoch uint32) ([]byte, error)

GetFromEpoch will search a key only in the persister for the given epoch

func (*FullHistoryPruningStorer) IsInterfaceNil added in v1.4.0

func (fhps *FullHistoryPruningStorer) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*FullHistoryPruningStorer) PutInEpoch added in v1.2.23

func (fhps *FullHistoryPruningStorer) PutInEpoch(key []byte, data []byte, epoch uint32) error

PutInEpoch will set the key-value pair in the given epoch

type FullHistoryStorerArgs added in v1.2.0

type FullHistoryStorerArgs struct {
	StorerArgs
	NumOfOldActivePersisters uint32
}

FullHistoryStorerArgs will hold the arguments needed for full history PruningStorer

type PersistersTracker added in v1.4.0

type PersistersTracker interface {
	HasInitializedEnoughPersisters(epoch int64) bool
	ShouldClosePersister(epoch int64) bool
	CollectPersisterData(p storage.Persister)
	IsInterfaceNil() bool
}

PersistersTracker defines what a persisters tracker should do

type PruningStorer

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

PruningStorer represents a storer which creates a new persister for each epoch and removes older activePersisters TODO unexport PruningStorer

func NewPruningStorer

func NewPruningStorer(args StorerArgs) (*PruningStorer, error)

NewPruningStorer will return a new instance of PruningStorer without sharded directories' naming scheme

func (*PruningStorer) ClearCache

func (ps *PruningStorer) ClearCache()

ClearCache cleans up the entire cache

func (*PruningStorer) Close

func (ps *PruningStorer) Close() error

Close will close PruningStorer

func (*PruningStorer) DestroyUnit

func (ps *PruningStorer) DestroyUnit() error

DestroyUnit cleans up the cache and the dbs

func (*PruningStorer) Get

func (ps *PruningStorer) Get(key []byte) ([]byte, error)

Get searches the key in the cache. In case it is not found, the key may be in the db.

func (*PruningStorer) GetBulkFromEpoch added in v1.0.147

func (ps *PruningStorer) GetBulkFromEpoch(keys [][]byte, epoch uint32) ([]storageCore.KeyValuePair, error)

GetBulkFromEpoch will return a slice of keys only in the persister for the given epoch

func (*PruningStorer) GetFromEpoch

func (ps *PruningStorer) GetFromEpoch(key []byte, epoch uint32) ([]byte, error)

GetFromEpoch will search a key only in the persister for the given epoch

func (*PruningStorer) GetOldestEpoch added in v1.2.4

func (ps *PruningStorer) GetOldestEpoch() (uint32, error)

GetOldestEpoch returns the oldest epoch from current configuration

func (*PruningStorer) Has

func (ps *PruningStorer) Has(key []byte) error

Has checks if the key is in the Unit. It first checks the cache. If it is not found, it checks the db

func (*PruningStorer) IsInterfaceNil

func (ps *PruningStorer) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*PruningStorer) Put

func (ps *PruningStorer) Put(key, data []byte) error

Put adds data to both cache and persistence medium

func (*PruningStorer) PutInEpoch added in v1.1.1

func (ps *PruningStorer) PutInEpoch(key, data []byte, epoch uint32) error

PutInEpoch adds data to specified epoch

func (*PruningStorer) RangeKeys added in v1.0.138

func (ps *PruningStorer) RangeKeys(_ func(key []byte, val []byte) bool)

RangeKeys does nothing as it is unable to iterate over multiple persisters RangeKeys -

func (*PruningStorer) Remove

func (ps *PruningStorer) Remove(key []byte) error

Remove removes the data associated to the given key from both cache and persistence medium

func (*PruningStorer) RemoveFromCurrentEpoch added in v1.3.7

func (ps *PruningStorer) RemoveFromCurrentEpoch(key []byte) error

RemoveFromCurrentEpoch removes the data associated to the given key from both cache and the current epoch persistence medium

func (*PruningStorer) SearchFirst

func (ps *PruningStorer) SearchFirst(key []byte) ([]byte, error)

SearchFirst will search a given key in all the active persisters, from the newest to the oldest

func (*PruningStorer) SetEpochForPutOperation added in v1.0.109

func (ps *PruningStorer) SetEpochForPutOperation(epoch uint32)

SetEpochForPutOperation will set the epoch to be used when using the put operation

type StorerArgs

type StorerArgs struct {
	Identifier                string
	ShardCoordinator          storage.ShardCoordinator
	CacheConf                 storageunit.CacheConfig
	PathManager               storage.PathManagerHandler
	DbPath                    string
	PersisterFactory          DbFactoryHandler
	Notifier                  EpochStartNotifier
	OldDataCleanerProvider    clean.OldDataCleanerProvider
	CustomDatabaseRemover     storage.CustomDatabaseRemoverHandler
	MaxBatchSize              int
	EpochsData                EpochArgs
	PruningEnabled            bool
	EnabledDbLookupExtensions bool
	PersistersTracker         PersistersTracker
}

StorerArgs will hold the arguments needed for PruningStorer

Jump to

Keyboard shortcuts

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