Documentation ¶
Index ¶
- type PrefixBatch
- type PrefixBatchReplay
- type PrefixDatabase
- func (p *PrefixDatabase) AncientDatadir() (string, error)
- func (p *PrefixDatabase) Close() error
- func (p *PrefixDatabase) Compact(start []byte, limit []byte) error
- func (p *PrefixDatabase) Delete(key []byte) error
- func (p *PrefixDatabase) Get(key []byte) ([]byte, error)
- func (p *PrefixDatabase) Has(key []byte) (bool, error)
- func (p *PrefixDatabase) NewBatch() ethdb.Batch
- func (p *PrefixDatabase) NewBatchWithSize(size int) ethdb.Batch
- func (p *PrefixDatabase) NewIterator(start, end []byte) ethdb.Iterator
- func (p *PrefixDatabase) Put(key []byte, value []byte) error
- func (p *PrefixDatabase) Stat(property string) (string, error)
- type PrefixIterator
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) 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.
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) AncientDatadir ¶
func (p *PrefixDatabase) AncientDatadir() (string, error)
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) NewBatchWithSize ¶
func (p *PrefixDatabase) NewBatchWithSize(size int) ethdb.Batch
NewBatchWithSize creates a write-only database batch with pre-allocated buffer.
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.
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.