extra

package
v0.0.0-...-4cb7ada Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2018 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// For Sets and Maps with Variable length keys, each node needs to be an
	// Either Primitive. It is Either a Value or another node, or both.
	// That way we can store "abcdefgh" And "abcdefgh12345678" in the same tree.
	VarMapPaths = []bdb.Decoder{bdb.DecodeTuple, bdb.DecodeMap}
)

Functions

func SplitKey

func SplitKey(key []byte, dynamic bool) ([]bdb.Key, bdb.Key)

Types

type ByteMap

type ByteMap struct {
	*ByteTree
}

func NewByteMap

func NewByteMap(rootKey bdb.Key, txn *store.Txn) *ByteMap

func NewFixedByteMap

func NewFixedByteMap(rootKey bdb.Key, txn *store.Txn) *ByteMap

func (*ByteMap) Insert

func (mm *ByteMap) Insert(fullKey []byte, value []byte) (bool, error)

func (*ByteMap) Lookup

func (mm *ByteMap) Lookup(fullKey []byte) ([]byte, bool, error)

func (*ByteMap) Remove

func (mm *ByteMap) Remove(fullKey []byte) (bool, error)

type ByteSet

type ByteSet struct {
	*ByteTree
}

func NewByteSet

func NewByteSet(rootKey bdb.Key, txn *store.Txn) *ByteSet

func NewFixedByteSet

func NewFixedByteSet(rootKey bdb.Key, txn *store.Txn) *ByteSet

func (*ByteSet) Add

func (mm *ByteSet) Add(key []byte) (bool, error)

func (*ByteSet) Contains

func (mm *ByteSet) Contains(key []byte) (bool, error)

func (*ByteSet) Remove

func (mm *ByteSet) Remove(key []byte) (bool, error)

type ByteTree

type ByteTree struct {
	*bdb.Root
	// contains filtered or unexported fields
}

A ByteTree is an abstraction of a Root to deal with keys of an arbitrary length. Keys are broken up into chunks of `PRIMKEY_LENGTH`. Byte trees keys are always zero padded to the the next highest multiple of `PRIMKEY_LENGTH`.

If the keys are of fixed length, all intermediate nodes will be maps.

If the keys are of variable length, intermediate nodes will be a combination of tuples and maps so that keys that share the same prefix like "abcdefgh" and "abcdefgh12345678" wont conflict.

func NewByteTree

func NewByteTree(rootKey bdb.Key, primType bdb.Decoder, txn *store.Txn, dynamic bool) *ByteTree

func (*ByteTree) Delete

func (ctx *ByteTree) Delete(primType bdb.Decoder, fullKey []byte) (bool, error)

Fetch the Primitive after traversing fullkey and call Delete

func (*ByteTree) FindBundleWithBytes

func (ctx *ByteTree) FindBundleWithBytes(primType bdb.Decoder, fullKey []byte) (bdb.Key, *bdb.Bundle, error)

func (*ByteTree) Read

func (ctx *ByteTree) Read(primType bdb.Decoder, fullKey []byte) (bdb.Value, bool, error)

Fetch the Primitive after traversing fullkey and call Read

func (*ByteTree) Write

func (ctx *ByteTree) Write(primType bdb.Decoder, fullKey []byte, value bdb.Value) (bool, error)

Fetch the Primitive after traversing fullkey and call Write

Jump to

Keyboard shortcuts

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