kvi

package
v0.0.0-...-fa720cf Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddKVDriver

func AddKVDriver(name string, builder KVBuilder) error

AddKVDriver registers a KeyValue storage driver to the list of avalible drivers. Driver list the RocksDB are only included with some build tags and aren't always avalible

Types

type KVBuilder

type KVBuilder func(path string, opts Options) (KVInterface, error)

KVBuilder is function implemented by the various key/value storage drivers that returns an initialized KVInterface given a file/path argument

type KVBulkWrite

type KVBulkWrite interface {
	Set(key, value []byte) error
}

type KVInterface

type KVInterface interface {
	HasKey(key []byte) bool
	Set(key, value []byte) error
	Get(key []byte) ([]byte, error)
	DeletePrefix(prefix []byte) error
	Delete(key []byte) error

	View(func(it KVIterator) error) error
	Update(func(tx KVTransaction) error) error
	BulkWrite(func(bl KVBulkWrite) error) error
	Close() error
}

KVInterface is the base interface for key/value based graph driver

func NewKVInterface

func NewKVInterface(name string, dbPath string, opts *Options) (KVInterface, error)

NewKVInterface intitalize a new key value interface given the name of the driver and path to create the database

type KVIterator

type KVIterator interface {
	Seek(k []byte) error
	SeekReverse(k []byte) error
	Valid() bool
	Key() []byte
	Value() ([]byte, error)
	Next() error

	Get(key []byte) ([]byte, error)
}

KVIterator is a genetic interface used by KVInterface.View to allow the KVGraph to scan the values stored in the key value driver

type KVTransaction

type KVTransaction interface {
	Get(key []byte) ([]byte, error)
	HasKey(key []byte) bool
	Set(key, value []byte) error
	Delete(key []byte) error
	View(func(it KVIterator) error) error
}

KVTransaction is a generic interface used by KVInterface.Update to allow the KVGraph to alter the values stored in the key value driver

type Options

type Options struct {
	BulkLoad bool
}

Options are the options for loading the KeyValue driver

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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