versionabledb

package
v1.4.8-rc.4 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2021 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

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

func New

func New(db database.Database) *Database

New returns a new prefixed database

func (*Database) AbortCommit

func (db *Database) AbortCommit()

AbortCommit aborts any operations on the versiondb and sets the [versionEnabled] flag to false.

func (*Database) Close

func (db *Database) Close() error

Close implements the database.Database interface

func (*Database) Commit

func (db *Database) Commit() error

Commit writes all the operations in the versiondb to the underlying database and sets the [versionEnabled] flag to false. If StartCommit() was never called, then Commit() is a no-op.

func (*Database) CommitBatch

func (db *Database) CommitBatch() (database.Batch, error)

CommitBatch returns a batch that contains all uncommitted puts/deletes. Calling Write() on the returned batch causes the puts/deletes to be written to the underlying database. If CommitBatch returns a nil error, then it holds onto the lock until EndBatch is called. If a non-nil error is returned, CommitBatch releases the lock, so that EndBatch should not be called. Note: if CommitBatch returns an error, such that it releases the lock, then calling EndBatch immediately will cause a panic.

func (*Database) Compact

func (db *Database) Compact(start, limit []byte) error

Compact implements the database.Database interface

func (*Database) Delete

func (db *Database) Delete(key []byte) error

Delete implements the database.Database interface

func (*Database) EndBatch

func (db *Database) EndBatch()

EndBatch sets the [versionEnabled] flag back to false and calls Abort() on the versiondb. EndBatch should be called exactly once following a successful call to CommitBatch. Assumes [db.lock] is still held by the initial call to CommitBatch Note: if CommitBatch returns an error, EndBatch should not be called.

func (*Database) Get

func (db *Database) Get(key []byte) ([]byte, error)

Get implements the database.Database interface

func (*Database) Has

func (db *Database) Has(key []byte) (bool, error)

Has implements the database.Database interface

func (*Database) NewBatch

func (db *Database) NewBatch() database.Batch

NewBatch implements the database.Database interface

func (*Database) NewIterator

func (db *Database) NewIterator() database.Iterator

NewIterator implements the database.Database interface

func (*Database) NewIteratorWithPrefix

func (db *Database) NewIteratorWithPrefix(prefix []byte) database.Iterator

NewIteratorWithPrefix implements the database.Database interface

func (*Database) NewIteratorWithStart

func (db *Database) NewIteratorWithStart(start []byte) database.Iterator

NewIteratorWithStart implements the database.Database interface

func (*Database) NewIteratorWithStartAndPrefix

func (db *Database) NewIteratorWithStartAndPrefix(start, prefix []byte) database.Iterator

NewIteratorWithStartAndPrefix implements the database.Database interface

func (*Database) Put

func (db *Database) Put(key, value []byte) error

Put implements the database.Database interface

func (*Database) StartCommit

func (db *Database) StartCommit()

StartCommit sets the [versionEnabled] flag to true, so that all operations are performed on top of the versiondb instead of the underlying database.

func (*Database) Stat

func (db *Database) Stat(stat string) (string, error)

Stat implements the database.Database interface

Jump to

Keyboard shortcuts

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