avl

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MerkleHashSize = 16

	NodeNonLeaf nodeType = iota
	NodeLeafValue
)
View Source
const DefaultCacheSize = 2048
View Source
const MaxWriteBatchSize = 1024

Variables

View Source
var DiffsKeyPrefix = []byte("diffs:")
View Source
var GCAliveMarkPrefix = []byte("@2:")
View Source
var NextOldRootIndexKey = []byte(".next_old_root")
View Source
var NodeKeyPrefix = []byte("@1:")
View Source
var OldRootsPrefix = []byte("@3:")
View Source
var RootKey = []byte(".root")

Functions

func DeserializeFromDifference

func DeserializeFromDifference(r io.Reader, localViewID uint64) (*node, error)

Types

type GCProfile

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

func (*GCProfile) PerformFullGC

func (profile *GCProfile) PerformFullGC() (int, error)

type Tree

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

func New

func New(kv store.KV) *Tree

func (*Tree) ApplyDiff

func (t *Tree) ApplyDiff(diff io.Reader) error

func (*Tree) ApplyDiffWithUpdateNotifier

func (t *Tree) ApplyDiffWithUpdateNotifier(diff io.Reader, updateNotifier func(key, value []byte)) error

func (*Tree) Checksum

func (t *Tree) Checksum() [MerkleHashSize]byte

func (*Tree) Commit

func (t *Tree) Commit() error

func (*Tree) Delete

func (t *Tree) Delete(k []byte) bool

func (*Tree) DumpDiff

func (t *Tree) DumpDiff(prevViewID uint64, wr io.Writer) error

DumpDiff writes the AVL tree difference into a io.Writer.

func (*Tree) GetGCProfile

func (t *Tree) GetGCProfile(preserveDepth uint64) *GCProfile

func (*Tree) Insert

func (t *Tree) Insert(key, value []byte)

func (*Tree) Iterate

func (t *Tree) Iterate(callback func(key, value []byte))

func (*Tree) IterateFrom

func (t *Tree) IterateFrom(key []byte, callback func(key, value []byte) bool)

func (*Tree) IterateLeafDiff

func (t *Tree) IterateLeafDiff(prevViewID uint64, callback func(key, value []byte) bool)

func (*Tree) IteratePrefix

func (t *Tree) IteratePrefix(prefix []byte, callback func(key, value []byte))

func (*Tree) Lookup

func (t *Tree) Lookup(k []byte) ([]byte, bool)

func (*Tree) PrintContents

func (t *Tree) PrintContents()

func (*Tree) Revert

func (t *Tree) Revert(snapshot *Tree)

func (*Tree) SetViewID

func (t *Tree) SetViewID(viewID uint64)

func (*Tree) Snapshot

func (t *Tree) Snapshot() *Tree

func (*Tree) WithLRUCache

func (t *Tree) WithLRUCache(size *int) *Tree

func (*Tree) WithMaxWriteBatchSize

func (t *Tree) WithMaxWriteBatchSize(maxWriteBatchSize int) *Tree

Jump to

Keyboard shortcuts

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