kvs

package module
v0.0.0-...-d2c2cf8 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

README

kvs-go

install

sudo apt install librocksdb-dev libsnappy-dev libz-mingw-w64-dev liblz4-dev libzstd-dev libbz2-dev 

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UnknownError = errors.New("unknown error")
)

Functions

This section is empty.

Types

type KVS

type KVS interface {
	Put(id etf.ErlTerm, data etf.ErlTerm) error
	Get(id etf.ErlTerm) (etf.ErlTerm, error)
	Delete(id etf.ErlTerm) error
	Index(field etf.ErlTerm, value etf.ErlTerm) ([]etf.ErlTerm, error)
	Seq() (etf.ErlTerm, error)
	Count() (int64, error)
	Dir() ([]etf.ErlTerm, error)
}

type KVSRocksDB

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

func NewKVSRocksDB

func NewKVSRocksDB(db *RocksDB) *KVSRocksDB

func (*KVSRocksDB) Count

func (r *KVSRocksDB) Count() (int64, error)

func (*KVSRocksDB) Delete

func (r *KVSRocksDB) Delete(id etf.ErlTerm) error

func (*KVSRocksDB) Dir

func (r *KVSRocksDB) Dir() ([]etf.ErlTerm, error)

func (*KVSRocksDB) Get

func (r *KVSRocksDB) Get(id etf.ErlTerm) (etf.ErlTerm, error)

func (*KVSRocksDB) Index

func (r *KVSRocksDB) Index(field etf.ErlTerm, value etf.ErlTerm) ([]etf.ErlTerm, error)

I have no idea how to implement this function

func (*KVSRocksDB) Put

func (r *KVSRocksDB) Put(id etf.ErlTerm, data etf.ErlTerm) error

func (*KVSRocksDB) Seq

func (r *KVSRocksDB) Seq() (etf.ErlTerm, error)

I have no idea how to implement this function

type RocksDB

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

RocksDB represents a RocksDB instance and associated options

func NewRocksDB

func NewRocksDB(db *grocksdb.DB, ro *grocksdb.ReadOptions, wo *grocksdb.WriteOptions) *RocksDB

func (*RocksDB) All

func (r *RocksDB) All(rec etf.ErlTerm) ([]etf.ErlTerm, error)

func (*RocksDB) Append

func (r *RocksDB) Append(rec etf.ErlTerm, feed etf.ErlTerm) (etf.ErlTerm, error)

Append adds a record to the database if it doesn't already exist, otherwise returns the existing key

func (*RocksDB) Bot

func (r *RocksDB) Bot() (etf.ErlTerm, etf.ErlTerm, error)

Bot retrieves the last key-value pair in the database

func (*RocksDB) Close

func (r *RocksDB) Close()

Close closes the database

func (*RocksDB) Count

func (r *RocksDB) Count() (int64, error)

func (*RocksDB) Cut

func (r *RocksDB) Cut(feed etf.ErlTerm) error

Cut removes all the data associated with a specific feed or key range.

func (*RocksDB) Drop

func (r *RocksDB) Drop(startKey etf.ErlTerm, num int) error

Drop removes a specific number of key-value pairs starting from a given key.

func (*RocksDB) LoadReader

func (r *RocksDB) LoadReader(id etf.ErlTerm) (etf.ErlTerm, error)

LoadReader loads a specific reader from the database using the given key

func (*RocksDB) Next

func (r *RocksDB) Next(startKey etf.ErlTerm) (etf.ErlTerm, etf.ErlTerm, error)

Next retrieves the next key-value pair after the provided startKey

func (*RocksDB) Prev

func (r *RocksDB) Prev(startKey etf.ErlTerm) (etf.ErlTerm, etf.ErlTerm, error)

Prev retrieves the previous key-value pair before the provided startKey

func (*RocksDB) Remove

func (r *RocksDB) Remove(key etf.ErlTerm) error

Remove deletes a record from the database using the given key

func (*RocksDB) SaveReader

func (r *RocksDB) SaveReader(id etf.ErlTerm, data etf.ErlTerm) error

SaveReader saves a reader to the database with the specified key and value

func (*RocksDB) Take

func (r *RocksDB) Take(startKey etf.ErlTerm, num int) (etf.Map, error)

Take retrieves a specific number of key-value pairs starting from a given key.

func (*RocksDB) Top

func (r *RocksDB) Top() (etf.ErlTerm, etf.ErlTerm, error)

Top retrieves the first key-value pair in the database

Directories

Path Synopsis
cmd
test_tool command

Jump to

Keyboard shortcuts

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