README

TODO: syndtr/goleveldb should be replaced with actual LevelDB instance

Expand ▾ Collapse ▴

Documentation

Index

Constants

const (
	LevelDBBackendStr   = "leveldb" // legacy, defaults to goleveldb.
	CLevelDBBackendStr  = "cleveldb"
	GoLevelDBBackendStr = "goleveldb"
	MemDBBackendStr     = "memdb"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch

type Batch interface {
	Set(key, value []byte)
	Delete(key []byte)
	Write()
}

type DB

type DB interface {
	Get([]byte) []byte
	Set([]byte, []byte)
	SetSync([]byte, []byte)
	Delete([]byte)
	DeleteSync([]byte)
	Close()
	NewBatch() Batch

	// For debugging
	Print()
	Iterator() Iterator
}

func NewDB

func NewDB(name string, backend string, dir string) DB

type GoLevelDB

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

func NewGoLevelDB

func NewGoLevelDB(name string, dir string) (*GoLevelDB, error)

func (*GoLevelDB) Close

func (db *GoLevelDB) Close()

func (*GoLevelDB) DB

func (db *GoLevelDB) DB() *leveldb.DB

func (*GoLevelDB) Delete

func (db *GoLevelDB) Delete(key []byte)

func (*GoLevelDB) DeleteSync

func (db *GoLevelDB) DeleteSync(key []byte)

func (*GoLevelDB) Get

func (db *GoLevelDB) Get(key []byte) []byte

func (*GoLevelDB) Iterator

func (db *GoLevelDB) Iterator() Iterator

func (*GoLevelDB) NewBatch

func (db *GoLevelDB) NewBatch() Batch

func (*GoLevelDB) Print

func (db *GoLevelDB) Print()

func (*GoLevelDB) Set

func (db *GoLevelDB) Set(key []byte, value []byte)

func (*GoLevelDB) SetSync

func (db *GoLevelDB) SetSync(key []byte, value []byte)

type Iterator

type Iterator interface {
	Next() bool
	Key() []byte
	Value() []byte
}

type MemDB

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

func NewMemDB

func NewMemDB() *MemDB

func (*MemDB) Close

func (db *MemDB) Close()

func (*MemDB) Delete

func (db *MemDB) Delete(key []byte)

func (*MemDB) DeleteSync

func (db *MemDB) DeleteSync(key []byte)

func (*MemDB) Get

func (db *MemDB) Get(key []byte) []byte

func (*MemDB) Iterator

func (db *MemDB) Iterator() Iterator

func (*MemDB) NewBatch

func (db *MemDB) NewBatch() Batch

func (*MemDB) Print

func (db *MemDB) Print()

func (*MemDB) Set

func (db *MemDB) Set(key []byte, value []byte)

func (*MemDB) SetSync

func (db *MemDB) SetSync(key []byte, value []byte)