database

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: MIT Imports: 5 Imported by: 17

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 Batch

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

type Database

type Database interface {
	Put(key []byte, value []byte) error
	Get(key []byte) ([]byte, error)
	Delete(key []byte) error
	NewBatch() Batch
	NewIterator(prefix []byte) Iterator
	Close() error
}

type Iterator

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

type LevelDB

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

func NewLevelDB

func NewLevelDB(file string) (*LevelDB, error)

func (*LevelDB) Close

func (l *LevelDB) Close() error

func (*LevelDB) Delete

func (l *LevelDB) Delete(key []byte) error

func (*LevelDB) Get

func (l *LevelDB) Get(key []byte) ([]byte, error)

func (*LevelDB) NewBatch

func (l *LevelDB) NewBatch() Batch

func (*LevelDB) NewIterator

func (l *LevelDB) NewIterator(prefix []byte) Iterator

func (*LevelDB) Put

func (l *LevelDB) Put(key []byte, value []byte) error

Jump to

Keyboard shortcuts

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