keyvalue

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CompressionDefault = CompressionAlgo(opt.DefaultCompression) // = Snappy
	CompressionNone    = CompressionAlgo(opt.NoCompression)
	CompressionSnappy  = CompressionAlgo(opt.SnappyCompression)
	CompressionZSTD    = CompressionAlgo(opt.ZSTDCompression)
	CompressionMinLZ   = CompressionAlgo(opt.MinLZCompression)
)

Variables

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

Functions

func CompressionAlgoStrings added in v0.11.0

func CompressionAlgoStrings() []string

CompressionAlgoStrings returns a slice of all String values of the enum

func NewBloomFilterStub added in v0.8.8

func NewBloomFilterStub(params BloomFilterParams) bloomFilterStub

func NewStore added in v0.3.0

func NewStore(path string) *storeImpl

func SafeKey added in v0.3.0

func SafeKey(k KeyInter) []byte

func SafeValue added in v0.3.0

func SafeValue(k ValueInter) []byte

Types

type Batch added in v0.3.0

type Batch interface {
	Delete(key []byte)
	Put(key, val []byte)
	Reset()
}

type BloomFilter added in v0.8.8

type BloomFilter interface {
	Params() BloomFilterParams
	io.WriterTo
	// contains filtered or unexported methods
}

type BloomFilterParams added in v0.3.0

type BloomFilterParams struct {
	// BloomFilterCapacity is how many items will be added to the filter.
	BloomFilterCapacity uint64
	// FalsePositiveProbability is acceptable false positive rate {0..1}.
	FalsePositiveProbability float64
	// Bloom store.
	BloomFilterStore store
	// Disable bloom filter.
	DisableBloomFilter bool
}

func NewBloomFilterParams added in v0.3.0

func NewBloomFilterParams(capacity uint64, probability float64, store store) BloomFilterParams

type CacheParams added in v0.3.0

type CacheParams struct {
	CacheSize int
}

type CompressionAlgo added in v0.11.0

type CompressionAlgo opt.Compression

func CompressionAlgoString added in v0.11.0

func CompressionAlgoString(s string) (CompressionAlgo, error)

CompressionAlgoString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func CompressionAlgoValues added in v0.11.0

func CompressionAlgoValues() []CompressionAlgo

CompressionAlgoValues returns all values of the enum

func (CompressionAlgo) IsACompressionAlgo added in v0.11.0

func (i CompressionAlgo) IsACompressionAlgo() bool

IsACompressionAlgo returns "true" if the value is listed in the enum definition. "false" otherwise

func (CompressionAlgo) MarshalText added in v0.11.0

func (i CompressionAlgo) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for CompressionAlgo

func (CompressionAlgo) String added in v0.11.0

func (i CompressionAlgo) String() string

func (*CompressionAlgo) UnmarshalText added in v0.11.0

func (i *CompressionAlgo) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for CompressionAlgo

type IterableKeyVal

type IterableKeyVal interface {
	KeyValue
	NewKeyIterator(prefix []byte) (Iterator, error)
}

type Iterator

type Iterator interface {
	Key() []byte
	Value() []byte
	Next() bool
	Prev() bool

	First() bool
	Last() bool

	Error() error
	Release()
}

type KeyInter added in v0.6.0

type KeyInter interface {
	Key() []byte
}

type KeyVal

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

func NewKeyVal

func NewKeyVal(path string, params KeyValParams) (*KeyVal, error)

func (*KeyVal) Close added in v0.3.0

func (k *KeyVal) Close() error

func (*KeyVal) Delete

func (k *KeyVal) Delete(key []byte) error

func (*KeyVal) Flush

func (k *KeyVal) Flush(b1 Batch) error

func (*KeyVal) Get

func (k *KeyVal) Get(key []byte) ([]byte, error)

func (*KeyVal) Has

func (k *KeyVal) Has(key []byte) (bool, error)

func (*KeyVal) NewBatch added in v0.3.0

func (k *KeyVal) NewBatch() (Batch, error)

func (*KeyVal) NewKeyIterator

func (k *KeyVal) NewKeyIterator(prefix []byte) (Iterator, error)

func (*KeyVal) Put

func (k *KeyVal) Put(key, val []byte) error

type KeyValParams added in v0.3.0

type KeyValParams struct {
	CacheParams
	BloomFilterParams
	WriteBuffer            int
	CompactionTableSize    int
	CompactionTotalSize    int
	OpenFilesCacheCapacity int
	CompressionAlgo        CompressionAlgo
}

type KeyValue

type KeyValue interface {
	NewBatch() (Batch, error)
	Has(key []byte) (bool, error)
	Put(key, val []byte) error
	Get(key []byte) ([]byte, error)
	Delete(key []byte) error
	Flush(batch Batch) error
	Close() error
}

type NoOpStore added in v0.3.0

type NoOpStore struct {
}

func (NoOpStore) WithPath added in v0.3.0

func (NoOpStore) WithPath(string)

type ValueInter added in v0.6.0

type ValueInter interface {
	Value() []byte
}

Jump to

Keyboard shortcuts

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