simple_kv

package
v0.0.0-...-92398f1 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Enabled    bool   `config:"enabled"`
	Path       string `config:"path"`
	SyncWrites bool   `config:"sync_writes"`
}

type KVStore

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

KVStore represents a simple key-value store.

func NewKVStore

func NewKVStore(lastStateFilename, walFilename string) *KVStore

NewKVStore creates a new key-value store and initializes the current state from the last state file.

func (*KVStore) Delete

func (kv *KVStore) Delete(key string) error

Delete removes a key-value pair from the store and writes to the WAL synchronously.

func (*KVStore) Get

func (kv *KVStore) Get(key string) ([]byte, error)

func (*KVStore) Set

func (kv *KVStore) Set(key string, value []byte) error

type LastState

type LastState struct {
	Data map[string][]byte `json:"data"`
}

LastState represents the last state of the key-value store.

type SimpleKV

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

func (*SimpleKV) Add

func (filter *SimpleKV) Add(bucket string, key []byte) error

func (*SimpleKV) AddValue

func (filter *SimpleKV) AddValue(bucket string, key []byte, value []byte) error

func (*SimpleKV) AddValueCompress

func (filter *SimpleKV) AddValueCompress(bucket string, key []byte, value []byte) error

func (*SimpleKV) CheckThenAdd

func (filter *SimpleKV) CheckThenAdd(bucket string, key []byte) (b bool, err error)

func (*SimpleKV) Close

func (filter *SimpleKV) Close() error

func (*SimpleKV) Delete

func (filter *SimpleKV) Delete(bucket string, key []byte) error

func (*SimpleKV) DeleteKey

func (filter *SimpleKV) DeleteKey(bucket string, key []byte) error

func (*SimpleKV) Exists

func (filter *SimpleKV) Exists(bucket string, key []byte) bool

func (*SimpleKV) ExistsKey

func (filter *SimpleKV) ExistsKey(bucket string, key []byte) (bool, error)

func (*SimpleKV) GetCompressedValue

func (filter *SimpleKV) GetCompressedValue(bucket string, key []byte) ([]byte, error)

func (*SimpleKV) GetValue

func (filter *SimpleKV) GetValue(bucket string, key []byte) ([]byte, error)

func (*SimpleKV) Name

func (module *SimpleKV) Name() string

func (*SimpleKV) Open

func (filter *SimpleKV) Open() error

func (*SimpleKV) Setup

func (module *SimpleKV) Setup()

func (*SimpleKV) Start

func (module *SimpleKV) Start() error

func (*SimpleKV) Stop

func (module *SimpleKV) Stop() error

type WAL

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

WAL represents a Write-Ahead Log for storing key-value changes.

func (*WAL) Close

func (wal *WAL) Close()

func (*WAL) Open

func (wal *WAL) Open() error

Jump to

Keyboard shortcuts

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