leveldb

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: BSD-3-Clause Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLevelDBIterator

func NewLevelDBIterator(iter iterator.Iterator, options *opts.Options) honuiter.Iterator

NewLevelDBIterator creates a new iterator that wraps a leveldb Iterator with object management access and Honu-specific serialization.

Types

type LevelDBEngine

type LevelDBEngine struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

LevelDBEngine implements Engine and Store

func Open

func Open(path string, conf config.Config) (_ *LevelDBEngine, err error)

Open a leveldb engine as the backend to the Honu database.

func (*LevelDBEngine) Begin added in v0.2.2

func (db *LevelDBEngine) Begin(readonly bool) (engine.Transaction, error)

Begin a multi-operation transaction (used primarily for Put and Delete)

func (*LevelDBEngine) Close

func (db *LevelDBEngine) Close() error

Close the database and flush all remaining writes to disk. LevelDB requires a close for graceful shutdown to ensure there is no data loss.

func (*LevelDBEngine) DB added in v0.2.8

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

Returns the underlying database object for direct access by the caller, to enable backups, etc.

func (*LevelDBEngine) Delete

func (db *LevelDBEngine) Delete(key []byte, options *opts.Options) (err error)

Delete the object represented by the key, removing it from the database entirely. This is the Store Delete method which can be used directly without a transaction. It is a unary operation that will lock the database to synchronize it with respect to other transactions. Note that normal Honu deletes Put a tombstone rather than directly deleting data from the database.

func (*LevelDBEngine) Engine

func (db *LevelDBEngine) Engine() string

Returns the name of the engine type.

func (*LevelDBEngine) Get

func (db *LevelDBEngine) Get(key []byte, options *opts.Options) (value []byte, err error)

Get the latest version of the object stored by the key. This is the Store Get method which can be used directly without a transaction. It is a unary operation that will read lock the database.

func (*LevelDBEngine) Has added in v0.4.0

func (db *LevelDBEngine) Has(key []byte, options *opts.Options) (bool, error)

Has returns true if the DB does contains the given key.

func (*LevelDBEngine) Iter

func (db *LevelDBEngine) Iter(prefix []byte, options *opts.Options) (i iterator.Iterator, err error)

func (*LevelDBEngine) Put

func (db *LevelDBEngine) Put(key, value []byte, options *opts.Options) (err error)

Put a new value to the specified key and update the version. This is the Store Put method which can be used directly without a transaction. It is a unary operation that will lock the database to synchronize it with respect to other transactions.

type Transaction added in v0.2.2

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

Transaction implements Transaction

func (*Transaction) Delete added in v0.2.2

func (tx *Transaction) Delete(key []byte, options *opts.Options) (err error)

Delete the object represented by the key, removing it from the database entirely. This is the Transaction Delete method which is used by Honu to clean up and vacuum the database or to reset an object back to the first version. Note that normal Honu deletes Put a tombstone rather than directly deleting data from the database.

func (*Transaction) Finish added in v0.2.2

func (tx *Transaction) Finish() error

Finish a multi-operation transaction

func (*Transaction) Get added in v0.2.2

func (tx *Transaction) Get(key []byte, options *opts.Options) (value []byte, err error)

Get the latest version of the object stored by the key. This is the Transaction Get method which can be used in either readonly or write modes. This is the preferred mechanism to access the underlying engine.

func (*Transaction) Has added in v0.4.0

func (tx *Transaction) Has(key []byte, options *opts.Options) (bool, error)

Has returns true if the DB does contains the given key.

func (*Transaction) Put added in v0.2.2

func (tx *Transaction) Put(key, value []byte, options *opts.Options) (err error)

Put a new value to the specified key. This is the Transaction Put method which is used by Honu to ensure consistency across version updates and can only be used in a write transaction.

Jump to

Keyboard shortcuts

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