common

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: GPL-3.0 Imports: 5 Imported by: 3 modules, 7 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const MaxRetriesToCreateDB = 10

MaxRetriesToCreateDB represents the maximum number of times to try to create DB if it failed

View Source
const SleepTimeBetweenCreateDBRetries = 5 * time.Second

SleepTimeBetweenCreateDBRetries represents the number of seconds to sleep between DB creates

Variables

View Source
var ErrCacheCapacityInvalid = errors.New("cache capacity is less than 1")

ErrCacheCapacityInvalid signals that capacity of cache is less than 1

View Source
var ErrCacheSizeInvalid = errors.New("cache size is less than 1")

ErrCacheSizeInvalid signals that size of cache is less than 1

View Source
var ErrCacheSizeIsLowerThanBatchSize = errors.New("cache size is lower than batch size")

ErrCacheSizeIsLowerThanBatchSize signals that size of cache is lower than size of batch

View Source
var ErrDBIsClosed = core.ErrDBIsClosed

ErrDBIsClosed is raised when the DB is closed

View Source
var ErrEmptyKey = errors.New("key is empty")

ErrEmptyKey is raised when a key is empty

View Source
var ErrFailedCacheEviction = errors.New("failed eviction within cache")

ErrFailedCacheEviction signals a failed eviction within a cache

View Source
var ErrImmuneItemsCapacityReached = errors.New("capacity reached for immune items")

ErrImmuneItemsCapacityReached signals that capacity for immune items is reached

View Source
var ErrInvalidBatch = errors.New("batch is invalid")

ErrInvalidBatch is raised when the used batch is invalid

View Source
var ErrInvalidCacheExpiry = errors.New("invalid cache expiry")

ErrInvalidCacheExpiry signals that an invalid cache expiry was provided

View Source
var ErrInvalidConfig = errors.New("invalid config")

ErrInvalidConfig signals an invalid config

View Source
var ErrInvalidDefaultSpan = errors.New("invalid default span")

ErrInvalidDefaultSpan signals that an invalid default span was provided

View Source
var ErrInvalidNumOpenFiles = errors.New("maxOpenFiles is invalid")

ErrInvalidNumOpenFiles is raised when the max num of open files is less than 1

View Source
var ErrKeyNotFound = errors.New("key not found")

ErrKeyNotFound is raised when a key is not found

View Source
var ErrLRUCacheInvalidSize = errors.New("wrong size in bytes value for LRU cache")

ErrLRUCacheInvalidSize signals that the provided size in bytes value for LRU cache is invalid

View Source
var ErrLRUCacheWithProvidedSize = errors.New("LRU cache does not support size in bytes")

ErrLRUCacheWithProvidedSize signals that a simple LRU cache is wanted but the user provided a positive size in bytes value

View Source
var ErrNegativeSizeInBytes = errors.New("negative size in bytes")

ErrNegativeSizeInBytes signals that the provided size in bytes value is negative

View Source
var ErrNilCacher = errors.New("expected not nil cacher")

ErrNilCacher is raised when a nil cacher is provided

View Source
var ErrNilMarshalizer = errors.New("nil marshalizer")

ErrNilMarshalizer signals that a nil marshalizer has been provided

View Source
var ErrNilPersister = errors.New("expected not nil persister")

ErrNilPersister is raised when a nil persister is provided

View Source
var ErrNilStoredDataFactory = errors.New("nil stored data factory")

ErrNilStoredDataFactory signals that a nil stored data factory has been provided

View Source
var ErrNilTimeCache = errors.New("nil time cache")

ErrNilTimeCache signals that a nil time cache has been provided

View Source
var ErrNotSupportedCacheType = errors.New("not supported cache type")

ErrNotSupportedCacheType is raised when an unsupported cache type is provided

View Source
var ErrNotSupportedDBType = errors.New("not supported db type")

ErrNotSupportedDBType is raised when an unsupported database type is provided

View Source
var ErrNotSupportedHashType = errors.New("hash type not supported")

ErrNotSupportedHashType is raised when an unsupported hasher is provided

View Source
var ErrOldestEpochNotAvailable = errors.New("oldest epoch not available")

ErrOldestEpochNotAvailable signals that fetching the oldest epoch is not available

Functions

This section is empty.

Types

type CacheConfig added in v1.0.16

type CacheConfig struct {
	Name                 string
	Type                 CacheType
	SizeInBytes          uint64
	SizeInBytesPerSender uint32
	Capacity             uint32
	SizePerSender        uint32
	Shards               uint32
}

CacheConfig holds the configurable elements of a cache

func (*CacheConfig) String added in v1.0.16

func (config *CacheConfig) String() string

String returns a readable representation of the object

type CacheType added in v1.0.16

type CacheType string

CacheType represents the type of the supported caches

const (
	LRUCache         CacheType = "LRU"
	SizeLRUCache     CacheType = "SizeLRU"
	FIFOShardedCache CacheType = "FIFOSharded"
)

Cache types that are currently supported

type DBConfig added in v1.0.16

type DBConfig struct {
	FilePath          string
	Type              DBType
	BatchDelaySeconds int
	MaxBatchSize      int
	MaxOpenFiles      int
	// BloomFilterBitsPerKey == 0, the Bloom filter is disabled.
	// Otherwise, it specifies the number of bits per key used by the Bloom filter.
	BloomFilterBitsPerKey int
}

DBConfig holds the configurable elements of a database

type DBType added in v1.0.16

type DBType string

DBType represents the type of the supported databases

const (
	LvlDB       DBType = "LvlDB"
	LvlDBSerial DBType = "LvlDBSerial"
	MemoryDB    DBType = "MemoryDB"
)

DB types that are currently supported

type ShardIDProviderType added in v1.0.16

type ShardIDProviderType string

ShardIDProviderType represents the type for the supported shard id provider

const (
	BinarySplit ShardIDProviderType = "BinarySplit"
)

Shard id provider types that are currently supported

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL