leveldb

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: GPL-3.0 Imports: 16 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBatch

func NewBatch() *batch

NewBatch creates a batch

Types

type DB

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

DB holds a pointer to the leveldb database and the path to where it is stored.

func NewDB

func NewDB(path string, batchDelaySeconds int, maxBatchSize int, maxOpenFiles int, bloomFilterSize int) (s *DB, err error)

NewDB is a constructor for the leveldb persister It creates the files in the location given as parameter

func (*DB) Close

func (s *DB) Close() error

Close closes the files/resources associated to the storage medium

func (*DB) Destroy

func (s *DB) Destroy() error

Destroy removes the storage medium stored data

func (*DB) DestroyClosed

func (s *DB) DestroyClosed() error

DestroyClosed removes the already closed storage medium stored data

func (*DB) Get

func (s *DB) Get(key []byte) ([]byte, error)

Get returns the value associated to the key

func (*DB) Has

func (s *DB) Has(key []byte) error

Has returns nil if the given key is present in the persistence medium

func (*DB) IsInterfaceNil

func (s *DB) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*DB) Put

func (s *DB) Put(key, val []byte) error

Put adds the value to the (key, val) storage medium

func (DB) RangeKeys

func (bldb DB) RangeKeys(handler func(key []byte, value []byte) bool)

RangeKeys will call the handler function for each (key, value) pair If the handler returns true, the iteration will continue, otherwise will stop

func (*DB) Remove

func (s *DB) Remove(key []byte) error

Remove removes the data associated to the given key

type SerialDB

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

SerialDB holds a pointer to the leveldb database and the path to where it is stored.

func NewSerialDB

func NewSerialDB(path string, batchDelaySeconds int, maxBatchSize int, maxOpenFiles int, bloomFilterSize int) (s *SerialDB, err error)

NewSerialDB is a constructor for the leveldb persister It creates the files in the location given as parameter

func (*SerialDB) Close

func (s *SerialDB) Close() error

Close closes the files/resources associated to the storage medium

func (*SerialDB) Destroy

func (s *SerialDB) Destroy() error

Destroy removes the storage medium stored data

func (*SerialDB) DestroyClosed

func (s *SerialDB) DestroyClosed() error

DestroyClosed removes the already closed storage medium stored data

func (*SerialDB) Get

func (s *SerialDB) Get(key []byte) ([]byte, error)

Get returns the value associated to the key

func (*SerialDB) Has

func (s *SerialDB) Has(key []byte) error

Has returns nil if the given key is present in the persistence medium

func (*SerialDB) IsInterfaceNil

func (s *SerialDB) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*SerialDB) Put

func (s *SerialDB) Put(key, val []byte) error

Put adds the value to the (key, val) storage medium

func (SerialDB) RangeKeys

func (bldb SerialDB) RangeKeys(handler func(key []byte, value []byte) bool)

RangeKeys will call the handler function for each (key, value) pair If the handler returns true, the iteration will continue, otherwise will stop

func (*SerialDB) Remove

func (s *SerialDB) Remove(key []byte) error

Remove removes the data associated to the given key

Jump to

Keyboard shortcuts

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