fallible

package
v0.0.0-...-e884aa9 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fallible

type Fallible struct {
	Underlying kvdb.DropableStore
	// contains filtered or unexported fields
}

Fallible is a kvdb.Store wrapper around any kvdb.Store. It falls when write counter is full for test purpose.

func Wrap

func Wrap(db kvdb.DropableStore) *Fallible

Wrap returns a wrapped kvdb.Store with counter 0. Set it manually.

func (*Fallible) Close

func (f *Fallible) Close() error

Close closes database.

func (*Fallible) Compact

func (f *Fallible) Compact(start []byte, limit []byte) error

Compact flattens the underlying data store for the given key range. In essence, deleted and overwritten versions are discarded, and the data is rearranged to reduce the cost of operations needed to access them.

A nil start is treated as a key before all keys in the data store; a nil limit is treated as a key after all keys in the data store. If both is nil then it will compact entire data store.

func (*Fallible) Delete

func (f *Fallible) Delete(key []byte) error

Delete removes the key from the key-value data store.

func (*Fallible) Drop

func (f *Fallible) Drop()

Drop drops database.

func (*Fallible) Get

func (f *Fallible) Get(key []byte) ([]byte, error)

Get retrieves the given key if it's present in the key-value data store.

func (*Fallible) GetSnapshot

func (f *Fallible) GetSnapshot() (kvdb.Snapshot, error)

GetSnapshot returns a latest snapshot of the underlying DB. A snapshot is a frozen snapshot of a DB state at a particular point in time. The content of snapshot are guaranteed to be consistent.

The snapshot must be released after use, by calling Release method.

func (*Fallible) GetWriteCount

func (f *Fallible) GetWriteCount() int

GetWriteCount to left.

func (*Fallible) Has

func (f *Fallible) Has(key []byte) (bool, error)

Has retrieves if a key is present in the key-value data store.

func (*Fallible) NewBatch

func (f *Fallible) NewBatch() kvdb.Batch

NewBatch creates a write-only database that buffers changes to its host db until a final write is called.

func (*Fallible) NewIterator

func (f *Fallible) NewIterator(prefix []byte, start []byte) kvdb.Iterator

NewIterator creates a binary-alphabetical iterator over a subset of database content with a particular key prefix, starting at a particular initial key (or after, if it does not exist).

func (*Fallible) Put

func (f *Fallible) Put(key []byte, value []byte) error

Put inserts the given value into the key-value data store.

func (*Fallible) SetWriteCount

func (f *Fallible) SetWriteCount(n int)

SetWriteCount to n.

func (*Fallible) Stat

func (f *Fallible) Stat(property string) (string, error)

Stat returns a particular internal stat of the database.

Jump to

Keyboard shortcuts

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