leveldbstore

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2018 License: LGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const BITSPERKEY = 10

used to compute the size of bloom filter bits array . too small will lead to high false positive rate.

Variables

This section is empty.

Functions

This section is empty.

Types

type Iterator

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

Iterator of leveldb. Warp struct of leveldb iterator

func (*Iterator) First

func (it *Iterator) First() bool

func (*Iterator) Key

func (it *Iterator) Key() []byte

func (*Iterator) Last

func (it *Iterator) Last() bool

func (*Iterator) Next

func (it *Iterator) Next() bool

func (*Iterator) Prev

func (it *Iterator) Prev() bool

func (*Iterator) Release

func (it *Iterator) Release()

func (*Iterator) Seek

func (it *Iterator) Seek(key []byte) bool

func (*Iterator) Value

func (it *Iterator) Value() []byte

type LevelDBStore

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

LevelDB store

func NewLevelDBStore

func NewLevelDBStore(file string) (*LevelDBStore, error)

NewLevelDBStore return LevelDBStore instance

func (*LevelDBStore) BatchCommit

func (self *LevelDBStore) BatchCommit() error

BatchCommit commit batch to leveldb

func (*LevelDBStore) BatchDelete

func (self *LevelDBStore) BatchDelete(key []byte)

BatchDelete delete a key to leveldb batch

func (*LevelDBStore) BatchPut

func (self *LevelDBStore) BatchPut(key []byte, value []byte)

BatchPut put a key-value pair to leveldb batch

func (*LevelDBStore) Close

func (self *LevelDBStore) Close() error

Close leveldb

func (*LevelDBStore) Delete

func (self *LevelDBStore) Delete(key []byte) error

Delete the the in leveldb

func (*LevelDBStore) Get

func (self *LevelDBStore) Get(key []byte) ([]byte, error)

Get the value of a key from leveldb

func (*LevelDBStore) Has

func (self *LevelDBStore) Has(key []byte) (bool, error)

Has return whether the key is exist in leveldb

func (*LevelDBStore) NewBatch

func (self *LevelDBStore) NewBatch()

NewBatch start commit batch

func (*LevelDBStore) NewIterator

func (self *LevelDBStore) NewIterator(prefix []byte) common.StoreIterator

NewIterator return a iterator of leveldb with the key perfix

func (*LevelDBStore) Put

func (self *LevelDBStore) Put(key []byte, value []byte) error

Put a key-value pair to leveldb

Jump to

Keyboard shortcuts

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