Versions in this module Expand all Collapse all v0 v0.1.11 Oct 3, 2023 v0.1.10 Oct 2, 2023 Changes in this version + const StoreVersionNone + var EmptyPrefix = KeyPrefix + var ErrKeyNotFound = errors.New("key not found") + var ErrStoreClosed = errors.New("trying to access closed kvstore") + var ErrStoreVersionCheckNotSupported = errors.New("store version check not supported") + var ErrStoreVersionUpdateFuncNotGiven = errors.New("store version update function not given") + func Copy(source KVStore, target KVStore) error + func CopyBatched(source KVStore, target KVStore, batchSize ...int) error + type BatchCollector struct + func (br *BatchCollector) Add(objectToPersist BatchWriteObject) (batchSizeReached bool) + func (br *BatchCollector) Commit() error + type BatchWriteObject interface + BatchWrite func(batchedMuts BatchedMutations) + BatchWriteDone func() + BatchWriteScheduled func() bool + ResetBatchWriteScheduled func() + type BatchedMutations interface + Cancel func() + Commit func() error + Delete func(key Key) error + Set func(key Key, value Value) error + type BatchedWriter struct + func NewBatchedWriter(store KVStore, opts ...Option) *BatchedWriter + func (bw *BatchedWriter) Enqueue(object BatchWriteObject) + func (bw *BatchedWriter) Flush() + func (bw *BatchedWriter) KVStore() KVStore + func (bw *BatchedWriter) StopBatchWriter() + type IterDirection byte + const IterDirectionBackward + const IterDirectionForward + func GetIterDirection(iterDirection ...IterDirection) IterDirection + type IteratorKeyConsumerFunc func(key Key) bool + type IteratorKeyValueConsumerFunc func(key Key, value Value) bool + type KVStore interface + Batched func() (BatchedMutations, error) + Clear func() error + Close func() error + Delete func(key Key) error + DeletePrefix func(prefix KeyPrefix) error + Flush func() error + Get func(key Key) (value Value, err error) + Has func(key Key) (bool, error) + Iterate func(prefix KeyPrefix, kvConsumerFunc IteratorKeyValueConsumerFunc, ...) error + IterateKeys func(prefix KeyPrefix, consumerFunc IteratorKeyConsumerFunc, ...) error + Realm func() Realm + Set func(key Key, value Value) error + WithExtendedRealm func(realm Realm) (KVStore, error) + WithRealm func(realm Realm) (KVStore, error) + type Key = []byte + type KeyPrefix = []byte + type Option func(opts *Options) + func WithBatchSize(batchSize int) Option + func WithBatchTimeout(batchTimeout time.Duration) Option + func WithQueueSize(queueSize int) Option + type Options struct + type Realm = []byte + type Sequence struct + func NewSequence(store KVStore, key []byte, interval uint64) (*Sequence, error) + func (seq *Sequence) Next() (uint64, error) + func (seq *Sequence) Release() error + type StoreHealthTracker struct + func NewStoreHealthTracker(store KVStore, storePrefixHealth []byte, storeVersion byte, ...) (*StoreHealthTracker, error) + func (s *StoreHealthTracker) CheckCorrectStoreVersion() (bool, error) + func (s *StoreHealthTracker) Close() error + func (s *StoreHealthTracker) Flush() error + func (s *StoreHealthTracker) IsCorrupted() (bool, error) + func (s *StoreHealthTracker) IsTainted() (bool, error) + func (s *StoreHealthTracker) MarkCorrupted() error + func (s *StoreHealthTracker) MarkHealthy() error + func (s *StoreHealthTracker) MarkTainted() error + func (s *StoreHealthTracker) StoreVersion() (byte, error) + func (s *StoreHealthTracker) UpdateStoreVersion() (bool, error) + type StoreVersionUpdateFunc func(oldVersion byte, newVersion byte) error + type Value = []byte