memdb

package
v3.1.0-fork Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2020 License: Apache-2.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 Iterator

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

Iterator iterates the entries in the DB.

func (*Iterator) Key

func (it *Iterator) Key() []byte

Key returns the key at the current position.

func (*Iterator) Next

func (it *Iterator) Next()

Next moves the iterator to the next entry.

func (*Iterator) Prev

func (it *Iterator) Prev()

Prev moves the iterator to the previous entry.

func (*Iterator) Seek

func (it *Iterator) Seek(seekKey []byte)

Seek locates the iterator to the first entry with a key >= seekKey.

func (*Iterator) SeekForExclusivePrev

func (it *Iterator) SeekForExclusivePrev(target []byte)

SeekForExclusivePrev locates the iterator to the last entry with key < target.

func (*Iterator) SeekForPrev

func (it *Iterator) SeekForPrev(target []byte)

SeekForPrev locates the iterator to the last entry with key <= target.

func (*Iterator) SeekToFirst

func (it *Iterator) SeekToFirst()

SeekToFirst locates the iterator to the first entry.

func (*Iterator) SeekToLast

func (it *Iterator) SeekToLast()

SeekToLast locates the iterator to the last entry.

func (*Iterator) Valid

func (it *Iterator) Valid() bool

Valid returns true if the iterator is positioned at a valid node.

func (*Iterator) Value

func (it *Iterator) Value() []byte

Value returns value.

type Sandbox

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

Sandbox is a space to keep pending kvs.

func NewSandbox

func NewSandbox() *Sandbox

NewSandbox create a new Sandbox.

func (*Sandbox) Derive

func (sb *Sandbox) Derive() *Sandbox

Derive derive a new sandbox to buffer a batch of modifactions.

func (*Sandbox) Discard

func (sb *Sandbox) Discard()

Discard discards all kvs in this sandbox. It is safe to discard a flushed sandbox, and it is recommend to call discard using defer to maintain correct state of parent.

func (*Sandbox) Flush

func (sb *Sandbox) Flush() int

Flush flushes all kvs into parent sandbox.

func (*Sandbox) Get

func (sb *Sandbox) Get(key []byte) []byte

Get returns value for key in this sandbox's space.

func (*Sandbox) GetParent

func (sb *Sandbox) GetParent() *Sandbox

GetParent returns the parent sandbox.

func (*Sandbox) Len

func (sb *Sandbox) Len() int

Len returns the number of entries in the DB.

func (*Sandbox) NewIterator

func (sb *Sandbox) NewIterator() Iterator

NewIterator returns a new Iterator for the lock store.

func (*Sandbox) Put

func (sb *Sandbox) Put(key, value []byte)

Put inserts kv into this sandbox.

func (*Sandbox) Size

func (sb *Sandbox) Size() int

Size returns sum of keys and values length. Note that deleted key/value will not be accounted for, but it will still consume the buffer, since the buffer is append only.

Jump to

Keyboard shortcuts

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