kv

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KV

type KV interface {
	Open(path string, mode os.FileMode, timeout time.Duration) error
	Close() error
	Put([]byte, []byte) error
	Get([]byte) ([]byte, error)
	Delete([]byte) error
	Scan([]byte) (<-chan ScanEntry, func())
	NextSequence() (ID uint64, err error)
}

KV is the key/value store backing the WAL.

type Lithium

type Lithium struct {
	sync.Mutex

	RootBucketKey []byte
	// contains filtered or unexported fields
}

Lithium is a bbolt backed KV.

func NewLithium

func NewLithium() *Lithium

func (*Lithium) Close

func (l *Lithium) Close() error

func (*Lithium) Delete

func (l *Lithium) Delete(key []byte) error

func (*Lithium) Get

func (l *Lithium) Get(key []byte) (dst []byte, err error)

func (*Lithium) NextSequence

func (l *Lithium) NextSequence() (uint64, error)

func (*Lithium) Open

func (l *Lithium) Open(path string, mode os.FileMode, timeout time.Duration) (err error)

func (*Lithium) Put

func (l *Lithium) Put(key, value []byte) (err error)

func (*Lithium) Reopen

func (l *Lithium) Reopen() error

Reopen closes and reopens the kvdb file.

func (*Lithium) Scan

func (l *Lithium) Scan(prefix []byte) (<-chan ScanEntry, func())

type LithiumScanEntry

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

LithiumScanEntry is a key/value pair produced by Lithium.Scan.

func (LithiumScanEntry) Error

func (e LithiumScanEntry) Error() error

func (LithiumScanEntry) Pair

func (e LithiumScanEntry) Pair() ([]byte, []byte)

type MockedKV

type MockedKV struct {
	sync.Mutex
	// contains filtered or unexported fields
}

MockedKV is an in-memory KV for tests.

func NewMockedKV

func NewMockedKV() *MockedKV

func (*MockedKV) Close

func (m *MockedKV) Close() error

func (*MockedKV) Delete

func (m *MockedKV) Delete(key []byte) error

func (*MockedKV) Get

func (m *MockedKV) Get(key []byte) ([]byte, error)

func (*MockedKV) NextSequence

func (m *MockedKV) NextSequence() (uint64, error)

func (*MockedKV) Open

func (*MockedKV) Put

func (m *MockedKV) Put(key, value []byte) error

func (*MockedKV) Scan

func (m *MockedKV) Scan(prefix []byte) (<-chan ScanEntry, func())

type MockedScanEntry

type MockedScanEntry struct {
	Err   error
	Key   string
	Value []byte
}

MockedScanEntry is a key/value pair produced by MockedKV.Scan.

func (MockedScanEntry) Error

func (e MockedScanEntry) Error() error

func (MockedScanEntry) Pair

func (e MockedScanEntry) Pair() ([]byte, []byte)

type ScanEntry

type ScanEntry interface {
	Pair() (key, value []byte)
	Error() error
}

Jump to

Keyboard shortcuts

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