kv

package
v3.3.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2019 License: LGPL-3.0 Imports: 1 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Iterator added in v1.1.0

type Iterator struct {
	IteratorBackend
}

Iterator is the storage iterator

type IteratorBackend added in v1.1.0

type IteratorBackend interface {
	Next() bool
	Key() []byte
	Value() []byte
	Error() error
	Release()
}

IteratorBackend is the storage iterator backend

type Storage

type Storage struct {
	StorageBackend
}

Storage is a kv database

func NewStorage

func NewStorage(path string, t StorageType) (*Storage, error)

NewStorage return the storage of the specify type

func (*Storage) NewIteratorByPrefix added in v1.1.0

func (s *Storage) NewIteratorByPrefix(prefix []byte) *Iterator

NewIteratorByPrefix returns a new iterator by prefix

type StorageBackend

type StorageBackend interface {
	Get(key []byte) ([]byte, error)
	Put(key []byte, value []byte) error
	Has(key []byte) (bool, error)
	Delete(key []byte) error
	Keys(prefix []byte) ([][]byte, error)
	BeginBatch() error
	CommitBatch() error
	Size() (int64, error)
	Close() error
	NewIteratorByPrefix(prefix []byte) interface{}
}

StorageBackend is the storage backend interface

type StorageType

type StorageType uint8

StorageType is the type of storage, include leveldb and rocksdb

const (
	LevelDBStorage StorageType
)

Storage type constant

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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