pruning

package
v1.2.38-rc2-indexer1.1.26 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2022 License: GPL-3.0 Imports: 18 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 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) GetBulkFromEpoch added in v1.2.23

func (fhps *FullHistoryPruningStorer) GetBulkFromEpoch(keys [][]byte, epoch uint32) (map[string][]byte, error)

GetBulkFromEpoch will search a 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) 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 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 (*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 added in v1.0.147

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) 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 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 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) 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
	BloomFilterConf           storageUnit.BloomConfig
	Notifier                  EpochStartNotifier
	OldDataCleanerProvider    clean.OldDataCleanerProvider
	MaxBatchSize              int
	NumOfEpochsToKeep         uint32
	NumOfActivePersisters     uint32
	StartingEpoch             uint32
	PruningEnabled            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