buffered

package
v2.0.3-0...-34c6bb6 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package buffered provides buffered implementations of the key-value store interfaces. It allows for batch operations and in-memory caching of key-value operations before committing them to the underlying storage.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BufferedKVStore

type BufferedKVStore struct {
	// contains filtered or unexported fields
}

BufferedKVStore is a KVStore backed by a given KVStoreReader. Writes are cached in-memory; reads are delegated to the backing store for unmodified keys.

func NewBufferedKVStore

func NewBufferedKVStore(r kv.KVStoreReader) *BufferedKVStore

func NewBufferedKVStoreForMutations

func NewBufferedKVStoreForMutations(r kv.KVStoreReader, m *Mutations) *BufferedKVStore

func (*BufferedKVStore) Clone

func (b *BufferedKVStore) Clone() *BufferedKVStore

func (*BufferedKVStore) DangerouslyDumpToDict

func (b *BufferedKVStore) DangerouslyDumpToDict() dict.Dict

DangerouslyDumpToDict returns a Dict with the whole contents of the backing store + applied mutations.

func (*BufferedKVStore) DangerouslyDumpToString

func (b *BufferedKVStore) DangerouslyDumpToString() string

DangerouslyDumpToString iterates over all key-value pairs in KVStore

func (*BufferedKVStore) Del

func (b *BufferedKVStore) Del(key kv.Key)

func (*BufferedKVStore) Get

func (b *BufferedKVStore) Get(key kv.Key) []byte

func (*BufferedKVStore) Has

func (b *BufferedKVStore) Has(key kv.Key) bool

func (*BufferedKVStore) Iterate

func (b *BufferedKVStore) Iterate(prefix kv.Key, f func(key kv.Key, value []byte) bool)

func (*BufferedKVStore) IterateKeys

func (b *BufferedKVStore) IterateKeys(prefix kv.Key, f func(key kv.Key) bool)

func (*BufferedKVStore) IterateKeysSorted

func (b *BufferedKVStore) IterateKeysSorted(prefix kv.Key, f func(key kv.Key) bool)

func (*BufferedKVStore) IterateSorted

func (b *BufferedKVStore) IterateSorted(prefix kv.Key, f func(key kv.Key, value []byte) bool)

func (*BufferedKVStore) Mutations

func (b *BufferedKVStore) Mutations() *Mutations

func (*BufferedKVStore) Set

func (b *BufferedKVStore) Set(key kv.Key, value []byte)

func (*BufferedKVStore) SetMutations

func (b *BufferedKVStore) SetMutations(muts *Mutations)

type Mutations

type Mutations struct {
	Sets map[kv.Key][]byte
	Dels map[kv.Key]struct{}
}

Mutations is a set of mutations: one for each key It provides a deterministic serialization

func MutationsFromBytes

func MutationsFromBytes(data []byte) (*Mutations, error)

func NewMutations

func NewMutations() *Mutations

func (*Mutations) ApplyTo

func (ms *Mutations) ApplyTo(w kv.KVWriter)

func (*Mutations) Bytes

func (ms *Mutations) Bytes() []byte

func (*Mutations) Clone

func (ms *Mutations) Clone() *Mutations

func (*Mutations) Contains

func (ms *Mutations) Contains(k kv.Key) bool

func (*Mutations) Del

func (ms *Mutations) Del(k kv.Key, baseExists bool)

func (*Mutations) DelsSorted

func (ms *Mutations) DelsSorted() []kv.Key

func (*Mutations) Dump

func (ms *Mutations) Dump() string

func (*Mutations) Get

func (ms *Mutations) Get(k kv.Key) ([]byte, bool)

func (*Mutations) IsEmpty

func (ms *Mutations) IsEmpty() bool

func (*Mutations) Set

func (ms *Mutations) Set(k kv.Key, v []byte)

func (*Mutations) SetsSorted

func (ms *Mutations) SetsSorted() kv.Items

Jump to

Keyboard shortcuts

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