prefix

package
v0.1.14 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2022 License: LGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PrefixBatch

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

func (*PrefixBatch) Delete

func (p *PrefixBatch) Delete(key []byte) error

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

func (*PrefixBatch) Put

func (p *PrefixBatch) Put(key []byte, value []byte) error

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

func (*PrefixBatch) Replay

func (p *PrefixBatch) Replay(w ethdb.KeyValueWriter) error

Replay replays the batch contents.

func (*PrefixBatch) Reset

func (p *PrefixBatch) Reset()

Reset resets the batch for reuse.

func (*PrefixBatch) ValueSize

func (p *PrefixBatch) ValueSize() int

ValueSize retrieves the amount of data queued up for writing.

func (*PrefixBatch) Write

func (p *PrefixBatch) Write() error

Write flushes any accumulated data to disk.

type PrefixBatchReplay

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

func (*PrefixBatchReplay) Delete

func (p *PrefixBatchReplay) Delete(key []byte) error

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

func (*PrefixBatchReplay) Put

func (p *PrefixBatchReplay) Put(key []byte, value []byte) error

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

type PrefixDatabase

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

PrefixDatabase is a wrapper to split the storage with prefix

func NewPrefixDatabase

func NewPrefixDatabase(prefix []byte, db common.TiKVStore) *PrefixDatabase

func (*PrefixDatabase) Close

func (p *PrefixDatabase) Close() error

Close the storage

func (*PrefixDatabase) Compact

func (p *PrefixDatabase) 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 (*PrefixDatabase) Delete

func (p *PrefixDatabase) Delete(key []byte) error

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

func (*PrefixDatabase) Get

func (p *PrefixDatabase) Get(key []byte) ([]byte, error)

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

func (*PrefixDatabase) Has

func (p *PrefixDatabase) Has(key []byte) (bool, error)

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

func (*PrefixDatabase) NewBatch

func (p *PrefixDatabase) NewBatch() ethdb.Batch

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

func (*PrefixDatabase) NewIterator

func (p *PrefixDatabase) NewIterator(start, end []byte) ethdb.Iterator

NewIterator creates a binary-alphabetical iterator over the start to end keyspace contained within the key-value database.

func (*PrefixDatabase) Put

func (p *PrefixDatabase) Put(key []byte, value []byte) error

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

func (*PrefixDatabase) Stat

func (p *PrefixDatabase) Stat(property string) (string, error)

Stat returns a particular internal stat of the database.

type PrefixIterator

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

func (*PrefixIterator) Error

func (i *PrefixIterator) Error() error

Error returns any accumulated error. Exhausting all the key/value pairs is not considered to be an error.

func (*PrefixIterator) Key

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

Key returns the key of the current key/value pair, or nil if done. The caller should not modify the contents of the returned slice, and its contents may change on the next call to Next.

func (*PrefixIterator) Next

func (i *PrefixIterator) Next() bool

Next moves the iterator to the next key/value pair. It returns whether the iterator is exhausted.

func (*PrefixIterator) Release

func (i *PrefixIterator) Release()

Release releases associated resources. Release should always succeed and can be called multiple times without causing error.

func (*PrefixIterator) Value

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

Value returns the value of the current key/value pair, or nil if done. The caller should not modify the contents of the returned slice, and its contents may change on the next call to Next.

Jump to

Keyboard shortcuts

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