Documentation ¶
Index ¶
- type DbFactoryHandler
- type EpochStartNotifier
- type PruningStorer
- func (ps *PruningStorer) ClearCache()
- func (ps *PruningStorer) Close() error
- func (ps *PruningStorer) DestroyUnit() error
- func (ps *PruningStorer) Get(key []byte) ([]byte, error)
- func (ps *PruningStorer) GetBulkFromEpoch(keys [][]byte, epoch uint32) (map[string][]byte, error)
- func (ps *PruningStorer) GetFromEpoch(key []byte, epoch uint32) ([]byte, error)
- func (ps *PruningStorer) Has(key []byte) error
- func (ps *PruningStorer) HasInEpoch(key []byte, epoch uint32) error
- func (ps *PruningStorer) IsInterfaceNil() bool
- func (ps *PruningStorer) Put(key, data []byte) error
- func (ps *PruningStorer) PutInEpoch(key, data []byte, epoch uint32) error
- func (ps *PruningStorer) RangeKeys(_ func(key []byte, val []byte) bool)
- func (ps *PruningStorer) Remove(key []byte) error
- func (ps *PruningStorer) SearchFirst(key []byte) ([]byte, error)
- func (ps *PruningStorer) SetEpochForPutOperation(epoch uint32)
- type StorerArgs
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) 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
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 ¶ 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 MaxBatchSize int NumOfEpochsToKeep uint32 NumOfActivePersisters uint32 StartingEpoch uint32 PruningEnabled bool CleanOldEpochsData bool EnabledDbLookupExtensions bool }
StorerArgs will hold the arguments needed for PruningStorer