kvredis

package module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

README

kvreddis

repleace leveldb

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AncientWriteOp added in v0.0.6

type AncientWriteOp interface {
	// Append adds an RLP-encoded item.
	Append(kind string, number uint64, item interface{}) error

	// AppendRaw adds an item without RLP-encoding it.
	AppendRaw(kind string, number uint64, item []byte) error
}

AncientWriteOp is given to the function argument of ModifyAncients.

type KV

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

func New

func New(endpoint ...string) *KV

func (*KV) Ancient

func (k *KV) Ancient(kind string, number uint64) ([]byte, error)

Ancient retrieves an ancient binary blob from the append-only immutable files.

func (*KV) AncientSize

func (k *KV) AncientSize(kind string) (uint64, error)

AncientSize returns the ancient size of the specified category.

func (*KV) Ancients

func (k *KV) Ancients() (uint64, error)

Ancients returns the ancient item numbers in the ancient store.

func (*KV) AppendAncient added in v0.0.3

func (k *KV) AppendAncient(number uint64, hash, header, body, receipt, td []byte) error

func (*KV) Close

func (k *KV) Close() error

func (*KV) Compact

func (k *KV) Compact(start []byte, limit []byte) error

func (*KV) Delete

func (k *KV) Delete(key []byte) error

func (*KV) DiffStore added in v0.0.4

func (k *KV) DiffStore() ethdb.KeyValueStore

func (*KV) Error

func (k *KV) Error() error

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

func (*KV) Get

func (k *KV) Get(key []byte) ([]byte, error)

func (*KV) Has

func (k *KV) Has(key []byte) (bool, error)

func (*KV) HasAncient

func (k *KV) HasAncient(kind string, number uint64) (bool, error)

HasAncient returns an indicator whether the specified data exists in the ancient store.

func (*KV) Key

func (k *KV) 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 (*KV) ModifyAncients

func (k *KV) ModifyAncients(_ func(AncientWriteOp) error) (int64, error)

ModifyAncients runs a write operation on the ancient store. If the function returns an error, any changes to the underlying store are reverted. The integer return value is the total size of the written data.

func (*KV) NewBatch

func (k *KV) NewBatch() ethdb.Batch

func (*KV) NewIterator

func (k *KV) NewIterator(prefix []byte, start []byte) ethdb.Iterator

func (*KV) Next

func (k *KV) Next() bool

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

func (*KV) Path

func (k *KV) Path() string

Path returns the path to the database directory.

func (*KV) Put

func (k *KV) Put(key []byte, value []byte) error

func (*KV) ReadAncients

func (k *KV) ReadAncients(kind string, start uint64, count uint64, maxBytes uint64) ([][]byte, error)

ReadAncients retrieves multiple items in sequence, starting from the index 'start'. It will return

  • at most 'count' items,
  • at least 1 item (even if exceeding the maxBytes), but will otherwise return as many items as fit into maxBytes.

func (*KV) Release

func (k *KV) Release()

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

func (*KV) SetDiffStore added in v0.0.4

func (k *KV) SetDiffStore(diff ethdb.KeyValueStore)

func (*KV) Stat

func (k *KV) Stat(property string) (string, error)

func (*KV) Sync

func (k *KV) Sync() error

Sync flushes all in-memory ancient store data to disk.

func (*KV) TruncateAncients

func (k *KV) TruncateAncients(n uint64) error

TruncateAncients discards all but the first n ancient data from the ancient store.

func (*KV) Value

func (k *KV) 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