leveldb_shard

package
v0.1.34 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2023 License: LGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LeveldbShard

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

func NewLeveldbShard

func NewLeveldbShard(savePath string, diskCount int, diskShards int) (shard *LeveldbShard, err error)

func (*LeveldbShard) Close

func (l *LeveldbShard) Close() error

Close all the DB

func (*LeveldbShard) Compact

func (l *LeveldbShard) Compact(start []byte, limit []byte) (err 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 (*LeveldbShard) Delete

func (l *LeveldbShard) Delete(key []byte) error

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

func (*LeveldbShard) Get

func (l *LeveldbShard) Get(key []byte) ([]byte, error)

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

func (*LeveldbShard) Has

func (l *LeveldbShard) Has(key []byte) (bool, error)

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

func (*LeveldbShard) NewBatch

func (l *LeveldbShard) NewBatch() ethdb.Batch

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

func (*LeveldbShard) NewIterator

func (l *LeveldbShard) NewIterator() ethdb.Iterator

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

func (*LeveldbShard) NewIteratorWithPrefix

func (l *LeveldbShard) NewIteratorWithPrefix(prefix []byte) ethdb.Iterator

NewIteratorWithPrefix creates a binary-alphabetical iterator over a subset of database content with a particular key prefix.

func (*LeveldbShard) NewIteratorWithStart

func (l *LeveldbShard) NewIteratorWithStart(start []byte) ethdb.Iterator

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

func (*LeveldbShard) Put

func (l *LeveldbShard) Put(key []byte, value []byte) error

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

func (*LeveldbShard) Stat

func (l *LeveldbShard) Stat(property string) (string, error)

Stat returns a particular internal stat of the database.

type LeveldbShardBatch

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

func NewLeveldbShardBatch

func NewLeveldbShardBatch(shard *LeveldbShard) *LeveldbShardBatch

func (*LeveldbShardBatch) Delete

func (l *LeveldbShardBatch) Delete(key []byte) error

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

func (*LeveldbShardBatch) Put

func (l *LeveldbShardBatch) Put(key []byte, value []byte) error

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

func (*LeveldbShardBatch) Replay

Replay replays the batch contents.

func (*LeveldbShardBatch) Reset

func (l *LeveldbShardBatch) Reset()

Reset resets the batch for reuse.

func (*LeveldbShardBatch) ValueSize

func (l *LeveldbShardBatch) ValueSize() int

ValueSize retrieves the amount of data queued up for writing.

func (*LeveldbShardBatch) Write

func (l *LeveldbShardBatch) Write() (err error)

Write flushes any accumulated data to disk.

Jump to

Keyboard shortcuts

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