driver

package
v0.0.0-...-3238c46 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTxSupport = errors.New("transaction is not supported")
)

Functions

func ListStores

func ListStores() []string

func Register

func Register(s Store)

Types

type BatchPuter

type BatchPuter interface {
	BatchPut([]Write) error
}

type IDB

type IDB interface {
	Close() error

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

	Put(key []byte, value []byte) error
	Delete(key []byte) error

	NewIterator() IIterator

	NewWriteBatch() IWriteBatch

	NewSnapshot() (ISnapshot, error)

	Begin() (Tx, error)
}

type IIterator

type IIterator interface {
	Close() error

	First()
	Last()
	Seek(key []byte)

	Next()
	Prev()

	Valid() bool

	Key() []byte
	Value() []byte
}

type ISnapshot

type ISnapshot interface {
	Get(key []byte) ([]byte, error)
	NewIterator() IIterator
	Close()
}

type IWriteBatch

type IWriteBatch interface {
	Put(key []byte, value []byte)
	Delete(key []byte)
	Commit() error
	Rollback() error
}

func NewWriteBatch

func NewWriteBatch(puter BatchPuter) IWriteBatch

type Store

type Store interface {
	String() string
	Open(path string, cfg *config.Config) (IDB, error)
	Repair(path string, cfg *config.Config) error
}

func GetStore

func GetStore(cfg *config.Config) (Store, error)

type Tx

type Tx interface {
	Get(key []byte) ([]byte, error)
	Put(key []byte, value []byte) error
	Delete(key []byte) error

	NewIterator() IIterator
	NewWriteBatch() IWriteBatch

	Commit() error
	Rollback() error
}

type Write

type Write struct {
	Key   []byte
	Value []byte
}

type WriteBatch

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

func (*WriteBatch) Commit

func (w *WriteBatch) Commit() error

func (*WriteBatch) Delete

func (w *WriteBatch) Delete(key []byte)

func (*WriteBatch) Put

func (w *WriteBatch) Put(key, value []byte)

func (*WriteBatch) Rollback

func (w *WriteBatch) Rollback() error

Jump to

Keyboard shortcuts

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