index

package
v0.1.0-alpha.14 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCorrupt = errors.New("meldbase index: corrupt tree")

ErrCorrupt reports malformed or inconsistent tree data.

Functions

This section is empty.

Types

type Pair

type Pair struct{ Key, Value []byte }

Pair holds one byte key and its byte value.

type Tree

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

Tree stores sorted byte keys with one or more distinct byte values per key.

func Decode

func Decode(data []byte) (*Tree, error)

Decode reconstructs and validates a tree from its binary representation.

func DecodeNodePages

func DecodeNodePages(header TreePageHeader, encoded [][]byte) (*Tree, error)

DecodeNodePages reconstructs and validates a tree from individually encoded nodes.

func New

func New() *Tree

New creates an empty tree with the default node size.

func NewWithOrder

func NewWithOrder(maxKeys int) *Tree

NewWithOrder creates an empty tree with at least three keys allowed per node.

func (*Tree) Delete

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

Delete removes a key-value pair and reports whether it existed.

func (*Tree) EncodeNodePages

func (t *Tree) EncodeNodePages() (TreePageHeader, [][]byte, error)

EncodeNodePages encodes each tree node as a separate blob with stable node IDs.

The checkpoint catalog resolves child and leaf-next links by those IDs.

func (*Tree) Get

func (t *Tree) Get(key []byte) [][]byte

Get returns copies of the values stored under a key.

func (*Tree) Insert

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

Insert adds a copied key-value pair and reports whether it was new.

func (*Tree) Len

func (t *Tree) Len() int

Len returns the number of distinct key-value pairs.

func (*Tree) MarshalBinary

func (t *Tree) MarshalBinary() ([]byte, error)

MarshalBinary encodes the tree while preserving its node structure.

func (*Tree) Scan

func (t *Tree) Scan(start, end []byte, includeEnd bool) []Pair

Scan returns copied pairs in key order within the requested bounds.

type TreePageHeader

type TreePageHeader struct {
	MaxKeys uint16
	Size    uint64
	Root    uint32
}

TreePageHeader records the root, node capacity, and pair count for encoded node pages.

Jump to

Keyboard shortcuts

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