kvdb

package
v0.0.0-...-d9e9996 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package kvdb 迭代器实现

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrNotFound

func ErrNotFound(err error) bool

ErrNotFound return true or false when key not found

Types

type Batch

type Batch interface {
	ValueSize() int
	Write() error
	Reset()
	Put(key []byte, value []byte) error
	Delete(key []byte) error
	PutIfAbsent(key []byte, value []byte) error
	Exist(key []byte) bool
}

Batch Batch操作的接口

type Database

type Database interface {
	Open(path string, options map[string]interface{}) error
	Put(key []byte, value []byte) error
	Get(key []byte) ([]byte, error)
	Has(key []byte) (bool, error)
	Delete(key []byte) error
	Close()
	NewBatch() Batch
	NewIteratorWithRange(start []byte, limit []byte) Iterator
	NewIteratorWithPrefix(prefix []byte) Iterator
}

Database KV数据库的接口

func NewTable

func NewTable(db Database, prefix string) Database

NewTable 基于前缀编码方式实现多表

type Iterator

type Iterator interface {
	Key() []byte
	Value() []byte
	Next() bool
	Prev() bool
	Last() bool
	First() bool
	Error() error
	Release()
}

Iterator NewIteratorXX操作后得到的迭代器

type QuickIterator

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

QuickIterator define the data structure of quick iterator

func NewQuickIterator

func NewQuickIterator(ldb Database, prefix []byte, middleKey []byte) *QuickIterator

NewQuickIterator new quick iterator instance

func (*QuickIterator) Error

func (qi *QuickIterator) Error() error

Error return err for quick iterator

func (*QuickIterator) Key

func (qi *QuickIterator) Key() []byte

Key get key by quick iterator

func (*QuickIterator) Next

func (qi *QuickIterator) Next() bool

Next if iterator finished

func (*QuickIterator) Release

func (qi *QuickIterator) Release()

Release release iterators of quick iterator

func (*QuickIterator) Value

func (qi *QuickIterator) Value() []byte

Value get value by quick iterator

Directories

Path Synopsis
badger wrapper plugin so
badger wrapper plugin so
go-leveldb wrapper plugin so 模式,package必须是main
go-leveldb wrapper plugin so 模式,package必须是main

Jump to

Keyboard shortcuts

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