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) 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) Remove(key []byte) error
- func (ps *PruningStorer) SearchFirst(key []byte) ([]byte, error)
- 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) IsInterfaceNil() bool }
DbFactoryHandler defines what a db factory implementation should do
type EpochStartNotifier ¶
type EpochStartNotifier interface { RegisterHandler(handler notifier.SubscribeFunctionHandler) UnregisterHandler(handler notifier.SubscribeFunctionHandler) IsInterfaceNil() bool }
EpochStartNotifier defines
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) 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) 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
type StorerArgs ¶
type StorerArgs struct { Identifier string ShardCoordinator sharding.Coordinator CacheConf storageUnit.CacheConfig PathManager storage.PathManagerHandler DbPath string PersisterFactory DbFactoryHandler BloomFilterConf storageUnit.BloomConfig Notifier EpochStartNotifier NumOfEpochsToKeep uint32 NumOfActivePersisters uint32 StartingEpoch uint32 PruningEnabled bool FullArchive bool MaxBatchSize int }
StorerArgs will hold the arguments needed for PruningStorer