Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrClosingPersisters = errors.New("cannot close all the persisters")
ErrClosingPersisters signals that not all persisters were closed
var ErrDestroyingUnit = errors.New("destroy unit didn't remove all the persisters")
ErrDestroyingUnit signals that the destroy unit method did not manage to destroy all the persisters in a pruning storer
var ErrDuplicateKeyToAdd = errors.New("the key can not be added as it already exists")
ErrDuplicateKeyToAdd signals that a key can not be added as it already exists
var ErrEmptyKey = errors.New("key is empty")
ErrEmptyKey is raised when a key is empty
var ErrEmptyPruningPathTemplate = errors.New("empty path template for pruning storers")
ErrEmptyPruningPathTemplate signals that an empty path template for pruning storers has been provided
var ErrEmptyStaticPathTemplate = errors.New("empty path template for static storers")
ErrEmptyStaticPathTemplate signals that an empty path template for static storers has been provided
var ErrInvalidBatch = errors.New("batch is invalid")
ErrInvalidBatch is raised when the used batch is invalid
var ErrInvalidNumOpenFiles = errors.New("maxOpenFiles is invalid")
ErrInvalidNumOpenFiles is raised when the max num of open files is less than 1
var ErrInvalidNumberOfActivePersisters = errors.New("invalid number of active persisters")
ErrInvalidNumberOfActivePersisters signals that an invalid number of active persisters has been provided
var ErrInvalidNumberOfEpochsToSave = errors.New("invalid number of epochs to save")
ErrInvalidNumberOfEpochsToSave signals that an invalid number of epochs to save has been provided
var ErrInvalidNumberOfPersisters = errors.New("invalid number of active persisters")
ErrInvalidNumberOfPersisters signals that an invalid number of persisters has been provided
var ErrInvalidPruningPathTemplate = errors.New("invalid path template for pruning storers")
ErrInvalidPruningPathTemplate signals that an invalid path template for pruning storers has been provided
var ErrInvalidStaticPathTemplate = errors.New("invalid path template for static storers")
ErrInvalidStaticPathTemplate signals that an invalid path template for static storers has been provided
var ErrKeyNotFound = errors.New("key not found")
ErrKeyNotFound is raised when a key is not found
var ErrNilBloomFilter = errors.New("expected not nil bloom filter")
ErrNilBloomFilter is raised when a nil bloom filter is provided
var ErrNilCacher = errors.New("expected not nil cacher")
ErrNilCacher is raised when a nil cacher is provided
var ErrNilConfig = errors.New("nil config")
ErrNilConfig signals that a nil configuration has been received
var ErrNilEpochStartNotifier = errors.New("nil epoch start notifier")
ErrNilEpochStartNotifier signals that a nil epoch start notifier has been provided
var ErrNilPathManager = errors.New("nil path manager")
ErrNilPathManager signals that a nil path manager has been provided
var ErrNilPersister = errors.New("expected not nil persister")
ErrNilPersister is raised when a nil persister is provided
var ErrNilPersisterFactory = errors.New("nil persister factory")
ErrNilPersisterFactory signals that a nil persister factory has been provided
var ErrNilShardCoordinator = errors.New("nil shard coordinator")
ErrNilShardCoordinator signals that a nil shard coordinator has been provided
var ErrNotSupportedCacheType = errors.New("not supported cache type")
ErrNotSupportedCacheType is raised when an unsupported cache type is provided
var ErrNotSupportedDBType = errors.New("nit supported db type")
ErrNotSupportedDBType is raised when an unsupported database type is provided
var ErrNotSupportedHashType = errors.New("hash type not supported")
ErrNotSupportedHashType is raised when an unsupported hasher is provided
var ErrSerialDBIsClosed = errors.New("serialDB is closed")
ErrSerialDBIsClosed is raised when the serialDB is closed
Functions ¶
This section is empty.
Types ¶
type Batcher ¶
type Batcher interface { // Put inserts one entry - key, value pair - into the batch Put(key []byte, val []byte) error // Delete deletes the batch Delete(key []byte) error // Reset clears the contents of the batch Reset() // IsInterfaceNil returns true if there is no value under the interface IsInterfaceNil() bool }
Batcher allows to batch the data first then write the batch to the persister in one go
type BloomFilter ¶
type BloomFilter interface { //Add adds the value to the bloom filter Add([]byte) // MayContain checks if the value is in in the set. If it returns 'false', //the item is definitely not in the DB MayContain([]byte) bool //Clear sets all the bits from the filter to 0 Clear() // IsInterfaceNil returns true if there is no value under the interface IsInterfaceNil() bool }
BloomFilter provides services for filtering database requests
type Cacher ¶
type Cacher interface { // Clear is used to completely clear the cache. Clear() // Put adds a value to the cache. Returns true if an eviction occurred. Put(key []byte, value interface{}) (evicted bool) // Get looks up a key's value from the cache. Get(key []byte) (value interface{}, ok bool) // Has checks if a key is in the cache, without updating the // recent-ness or deleting it for being stale. Has(key []byte) bool // Peek returns the key value (or undefined if not found) without updating // the "recently used"-ness of the key. Peek(key []byte) (value interface{}, ok bool) // HasOrAdd checks if a key is in the cache without updating the // recent-ness or deleting it for being stale, and if not adds the value. // Returns whether found and whether an eviction occurred. HasOrAdd(key []byte, value interface{}) (ok, evicted bool) // Remove removes the provided key from the cache. Remove(key []byte) // RemoveOldest removes the oldest item from the cache. RemoveOldest() // Keys returns a slice of the keys in the cache, from oldest to newest. Keys() [][]byte // Len returns the number of items in the cache. Len() int // MaxSize returns the maximum number of items which can be stored in the cache. MaxSize() int // RegisterHandler registers a new handler to be called when a new data is added RegisterHandler(func(key []byte)) // IsInterfaceNil returns true if there is no value under the interface IsInterfaceNil() bool }
Cacher provides caching services
type EpochStartNotifier ¶
type EpochStartNotifier interface { RegisterHandler(handler notifier.SubscribeFunctionHandler) UnregisterHandler(handler notifier.SubscribeFunctionHandler) NotifyAll(hdr data.HeaderHandler) IsInterfaceNil() bool }
EpochStartNotifier defines which actions should be done for handling new epoch's events
type PathManagerHandler ¶
type PathManagerHandler interface { PathForEpoch(shardId string, epoch uint32, identifier string) string PathForStatic(shardId string, identifier string) string IsInterfaceNil() bool }
PathManagerHandler defines which actions should be done for generating paths for databases directories
type Persister ¶
type Persister interface { // Put add the value to the (key, val) persistence medium Put(key, val []byte) error // Get gets the value associated to the key Get(key []byte) ([]byte, error) // Has returns true if the given key is present in the persistence medium Has(key []byte) error // Init initializes the persistence medium and prepares it for usage Init() error // Close closes the files/resources associated to the persistence medium Close() error // Remove removes the data associated to the given key Remove(key []byte) error // Destroy removes the persistence medium stored data Destroy() error // DestroyClosed removes the already closed persistence medium stored data DestroyClosed() error // IsInterfaceNil returns true if there is no value under the interface IsInterfaceNil() bool }
Persister provides storage of data services in a database like construct
type Storer ¶
type Storer interface { Put(key, data []byte) error Get(key []byte) ([]byte, error) GetFromEpoch(key []byte, epoch uint32) ([]byte, error) Has(key []byte) error HasInEpoch(key []byte, epoch uint32) error SearchFirst(key []byte) ([]byte, error) Remove(key []byte) error ClearCache() DestroyUnit() error IsInterfaceNil() bool Close() error }
Storer provides storage services in a two layered storage construct, where the first layer is represented by a cache and second layer by a persitent storage (DB-like)