statedb

package
v0.0.0-...-15ab7cc Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KeyNotFound = errors.New("key not found")

Functions

This section is empty.

Types

type DB

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

func (*DB) Close

func (ledger *DB) Close() error

func (*DB) Delete

func (ledger *DB) Delete(key []byte, sync bool) error

func (*DB) Get

func (ledger *DB) Get(bytes []byte) ([]byte, error)

func (*DB) GetIterator

func (ledger *DB) GetIterator(sk []byte, ek []byte) iterator.Iterator

func (*DB) Open

func (ledger *DB) Open()

func (*DB) Put

func (ledger *DB) Put(key []byte, value []byte, sync bool) error

type DBHandle

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

DBHandle is an handle to a named db

func (*DBHandle) Delete

func (h *DBHandle) Delete(key []byte, sync bool) error

Delete deletes the given key

func (*DBHandle) Get

func (h *DBHandle) Get(key []byte) ([]byte, error)

Get returns the value for the given key

func (*DBHandle) GetIterator

func (h *DBHandle) GetIterator(startKey []byte, endKey []byte) *Iterator

GetIterator gets an handle to iterator. The iterator should be released after the use. The resultset contains all the keys that are present in the db between the startKey (inclusive) and the endKey (exclusive). A nil startKey represents the first available key and a nil endKey represent a logical key after the last available key

func (*DBHandle) Put

func (h *DBHandle) Put(key []byte, value []byte, sync bool) error

Put saves the key/value

func (*DBHandle) WriteBatch

func (h *DBHandle) WriteBatch(batch *UpdateBatch, sync bool) error

WriteBatch writes a batch in an atomic way

type Iterator

type Iterator struct {
	iterator.Iterator
}

type Iterimpl

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

func (*Iterimpl) Error

func (i *Iterimpl) Error() error

func (*Iterimpl) First

func (i *Iterimpl) First() bool

func (*Iterimpl) Key

func (i *Iterimpl) Key() []byte

func (*Iterimpl) Last

func (i *Iterimpl) Last() bool

func (*Iterimpl) Next

func (i *Iterimpl) Next() bool

func (*Iterimpl) Prev

func (i *Iterimpl) Prev() bool

func (Iterimpl) Release

func (Iterimpl) Release()

func (*Iterimpl) Seek

func (i *Iterimpl) Seek(key []byte) bool

func (Iterimpl) SetReleaser

func (Iterimpl) SetReleaser(releaser util.Releaser)

func (*Iterimpl) Valid

func (i *Iterimpl) Valid() bool

func (*Iterimpl) Value

func (i *Iterimpl) Value() []byte

type Provider

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

Provider enables to use a single leveldb as multiple logical leveldbs

func NewProvider

func NewProvider(dbPath string) *Provider

NewProvider constructs a Provider

func (*Provider) Close

func (p *Provider) Close()

func (*Provider) GetDBHandle

func (p *Provider) GetDBHandle(dbName string) *DBHandle

GetDBHandle returns a handle to a named db

type UpdateBatch

type UpdateBatch struct {
	KVs map[string][]byte
	// contains filtered or unexported fields
}

UpdateBatch encloses the details of multiple `updates`

func NewUpdateBatch

func NewUpdateBatch() *UpdateBatch

NewUpdateBatch constructs an instance of a Batch

func (*UpdateBatch) Delete

func (batch *UpdateBatch) Delete(key []byte)

Delete deletes a Key and associated value

func (*UpdateBatch) Len

func (batch *UpdateBatch) Len() int

Len returns the number of entries in the batch

func (*UpdateBatch) Put

func (batch *UpdateBatch) Put(key []byte, value []byte)

Put adds a KV

type ValueHashtable

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

ValueHashtable the set of Items

func NewHT

func NewHT() *ValueHashtable

func (*ValueHashtable) Cleanup

func (ht *ValueHashtable) Cleanup()

func (*ValueHashtable) Get

func (ht *ValueHashtable) Get(key []byte) ([]byte, error)

Get item with key k from the hashtable

func (*ValueHashtable) Put

func (ht *ValueHashtable) Put(key []byte, value []byte) error

func (*ValueHashtable) Remove

func (ht *ValueHashtable) Remove(key []byte) error

Remove item with key k from hashtable

func (*ValueHashtable) Size

func (ht *ValueHashtable) Size() int

Size returns the number of the hashtable elements

Jump to

Keyboard shortcuts

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