pruning

package
v1.1.66 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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 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 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

func NewPruningStorer

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

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

func NewShardedPruningStorer

func NewShardedPruningStorer(
	args *StorerArgs,
	shardID uint32,
) (*PruningStorer, error)

NewShardedPruningStorer will return a new instance of PruningStorer with 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 bloom filter, 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, it verifies with the bloom filter if the key may be in the db. If bloom filter confirms then it further searches in the databases.

func (*PruningStorer) GetBulkFromEpoch

func (ps *PruningStorer) GetBulkFromEpoch(keys [][]byte, epoch uint32) (map[string][]byte, 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) 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 bloom filter and if present it checks the db

func (*PruningStorer) HasInEpoch

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

HasInEpoch checks if the key is in the Unit in a given epoch. It first checks the cache. If it is not found, it checks the bloom filter and if present 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 and updates the bloom filter

func (*PruningStorer) PutInEpoch

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

PutInEpoch adds data to specified epoch

func (*PruningStorer) RangeKeys

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) 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

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
	BloomFilterConf           storageUnit.BloomConfig
	Notifier                  EpochStartNotifier
	MaxBatchSize              int
	NumOfEpochsToKeep         uint32
	NumOfActivePersisters     uint32
	StartingEpoch             uint32
	PruningEnabled            bool
	CleanOldEpochsData        bool
	EnabledDbLookupExtensions bool
}

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