Versions in this module Expand all Collapse all v0 v0.0.1 Nov 7, 2024 Changes in this version + const DefaultDBPath + const DefaultEpochString + const DefaultShardString + const DefaultStaticDbString + const MaxRetriesToCreateDB + const PathEpochPlaceholder + const PathIdentifierPlaceholder + const PathShardPlaceholder + const SleepTimeBetweenCreateDBRetries + const TxPoolNumTxsToPreemptivelyEvict + var ErrBootstrapDataNotFoundInStorage = errors.New("didn't find any bootstrap data in storage") + var ErrCacheSizeInvalid = storageErrors.ErrCacheSizeInvalid + var ErrCacheSizeIsLowerThanBatchSize = errors.New("cache size is lower than batch size") + var ErrCannotComputeStorageOldestEpoch = errors.New("could not compute the oldest epoch for storage") + var ErrClosingPersisters = errors.New("cannot close all the persisters") + var ErrDBIsClosed = storageErrors.ErrDBIsClosed + var ErrDestroyingUnit = errors.New("destroy unit didn't remove all the persisters") + var ErrEpochKeepIsLowerThanNumActive = errors.New("num epochs to keep is lower than num active epochs") + var ErrInvalidConfig = storageErrors.ErrInvalidConfig + var ErrInvalidFilePath = errors.New("invalid file path") + var ErrInvalidNumberOfActivePersisters = errors.New("invalid number of active persisters") + var ErrInvalidNumberOfEpochsToSave = errors.New("invalid number of epochs to save") + var ErrInvalidNumberOfOldPersisters = errors.New("invalid number of old active persisters") + var ErrInvalidNumberOfPersisters = errors.New("invalid number of active persisters") + var ErrKeyNotFound = storageErrors.ErrKeyNotFound + var ErrNilBootstrapDataProvider = errors.New("nil bootstrap data provider") + var ErrNilCustomDatabaseRemover = errors.New("custom database remover") + var ErrNilDBConfigHandler = errors.New("nil db config handler") + var ErrNilDirectoryReader = errors.New("nil directory reader") + var ErrNilEpochStartNotifier = errors.New("nil epoch start notifier") + var ErrNilLatestStorageDataProvider = errors.New("nil latest storage data provider") + var ErrNilManagedPeersHolder = errors.New("nil managed peers holder") + var ErrNilMarshalizer = errors.New("nil marshalizer") + var ErrNilNodeTypeProvider = errors.New("nil node type provider") + var ErrNilOldDataCleanerProvider = errors.New("nil old data cleaner provider") + var ErrNilPathManager = errors.New("nil path manager") + var ErrNilPersisterFactory = errors.New("nil persister factory") + var ErrNilPersistersTracker = errors.New("nil persisters tracker provided") + var ErrNilShardCoordinator = errors.New("nil shard coordinator") + var ErrNilShardIDProvider = errors.New("nil shard id provider") + var ErrNilStatsCollector = errors.New("nil stats collector provided") + var ErrNilStorageListProvider = errors.New("nil storage list provider") + var ErrNotSupportedCacheType = storageErrors.ErrNotSupportedCacheType + var ErrNotSupportedDBType = storageErrors.ErrNotSupportedDBType + var ErrNotSupportedShardIDProviderType = errors.New("invalid shard id provider type has been provided") + var ErrWrongTypeAssertion = errors.New("wrong type assertion") + func IsNotFoundInStorageErr(err error) bool + type AdaptedSizedLRUCache interface + AddSizedAndReturnEvicted func(key, value interface{}, sizeInBytes int64) map[interface{}]interface{} + IsInterfaceNil func() bool + type Batcher interface + Delete func(key []byte) error + Get func(key []byte) []byte + IsInterfaceNil func() bool + IsRemoved func(key []byte) bool + Put func(key []byte, val []byte) error + Reset func() + type Cacher interface + Clear func() + Close func() error + Get func(key []byte) (value interface{}, ok bool) + Has func(key []byte) bool + HasOrAdd func(key []byte, value interface{}, sizeInBytes int) (has, added bool) + IsInterfaceNil func() bool + Keys func() [][]byte + Len func() int + MaxSize func() int + Peek func(key []byte) (value interface{}, ok bool) + Put func(key []byte, value interface{}, sizeInBytes int) (evicted bool) + RegisterHandler func(handler func(key []byte, value interface{}), id string) + Remove func(key []byte) + SizeInBytesContained func() uint64 + UnRegisterHandler func(id string) + type CustomDatabaseRemoverHandler interface + IsInterfaceNil func() bool + ShouldRemove func(dbIdentifier string, epoch uint32) bool + type DBConfigHandler interface + GetDBConfig func(path string) (*config.DBConfig, error) + IsInterfaceNil func() bool + SaveDBConfigToFilePath func(path string, dbConfig *config.DBConfig) error + type DirectoryReaderHandler interface + IsInterfaceNil func() bool + ListAllAsString func(directoryPath string) ([]string, error) + ListDirectoriesAsString func(directoryPath string) ([]string, error) + ListFilesAsString func(directoryPath string) ([]string, error) + type LatestDataFromStorage = types.LatestDataFromStorage + type LatestStorageDataProviderHandler interface + Get func() (LatestDataFromStorage, error) + GetParentDirAndLastEpoch func() (string, uint32, error) + GetParentDirectory func() string + GetShardsFromDirectory func(path string) ([]string, error) + IsInterfaceNil func() bool + type ManagedPeersHolder interface + IsInterfaceNil func() bool + IsMultiKeyMode func() bool + type PathManagerHandler interface + DatabasePath func() string + IsInterfaceNil func() bool + PathForEpoch func(shardId string, epoch uint32, identifier string) string + PathForStatic func(shardId string, identifier string) string + type Persister = types.Persister + type PersisterCreator = types.PersisterCreator + type PersisterFactory interface + Create func(path string) (Persister, error) + IsInterfaceNil func() bool + type PersisterFactoryHandler interface + Create func(path string) (Persister, error) + IsInterfaceNil func() bool + type ShardCoordinator interface + CommunicationIdentifier func(destShardID uint32) string + ComputeId func(address []byte) uint32 + IsInterfaceNil func() bool + NumberOfShards func() uint32 + SameShard func(firstAddress, secondAddress []byte) bool + SelfId func() uint32 + type ShardIDProvider interface + ComputeId func(key []byte) uint32 + GetShardIDs func() []uint32 + IsInterfaceNil func() bool + NumberOfShards func() uint32 + type SizedLRUCacheHandler interface + AddSized func(key, value interface{}, sizeInBytes int64) bool + AddSizedIfMissing func(key, value interface{}, sizeInBytes int64) (ok, evicted bool) + Contains func(key interface{}) (ok bool) + Get func(key interface{}) (value interface{}, ok bool) + Keys func() []interface{} + Len func() int + Peek func(key interface{}) (value interface{}, ok bool) + Purge func() + Remove func(key interface{}) bool + SizeInBytesContained func() uint64 + type StateStatsHandler interface + IncrementCache func() + IncrementPersister func(epoch uint32) + IncrementSnapshotCache func() + IncrementSnapshotPersister func(epoch uint32) + type StoredDataFactory interface + CreateEmpty func() interface{} + IsInterfaceNil func() bool + type Storer interface + ClearCache func() + Close func() error + DestroyUnit func() error + Get func(key []byte) ([]byte, error) + GetBulkFromEpoch func(keys [][]byte, epoch uint32) ([]data.KeyValuePair, error) + GetFromEpoch func(key []byte, epoch uint32) ([]byte, error) + GetOldestEpoch func() (uint32, error) + Has func(key []byte) error + IsInterfaceNil func() bool + Put func(key, data []byte) error + PutInEpoch func(key, data []byte, epoch uint32) error + RangeKeys func(handler func(key []byte, val []byte) bool) + Remove func(key []byte) error + RemoveFromCurrentEpoch func(key []byte) error + SearchFirst func(key []byte) ([]byte, error) + type StorerWithPutInEpoch interface + SetEpochForPutOperation func(epoch uint32) + type TimeCacher interface + Add func(key string) error + Has func(key string) bool + IsInterfaceNil func() bool + Sweep func() + Upsert func(key string, span time.Duration) error + type UnitOpenerHandler interface + GetMostRecentStorageUnit func(config config.DBConfig) (Storer, error) + IsInterfaceNil func() bool + OpenDB func(dbConfig config.DBConfig, shardID uint32, epoch uint32) (Storer, error)