tuplefast

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package tuplefast is a zero-allocation FDB tuple decoder, shared by the record layer and the vector index package.

The standard FDB Go tuple.Unpack allocates bytes.NewBuffer + binary.Read per integer element (~3 heap objects per int). This decoder uses binary.BigEndian.Uint64 on stack arrays instead. Wire-format compatible with the canonical FDB tuple layer.

Index

Constants

View Source
const (
	TypeCodeNested = 0x05
)

FDB tuple type codes.

Variables

This section is empty.

Functions

func DecodeBytes

func DecodeBytes(b []byte) ([]byte, int, error)

func NestedPKSpans

func NestedPKSpans(content []byte) ([][]byte, error)

NestedPKSpans splits the content of a neighbor-list tuple (the bytes between the 0x05 marker and its terminating 0x00) into one byte-span per element, WITHOUT decoding/boxing the elements. Children are stored verbatim, so each returned span is exactly the bytes Tuple{pk}.Pack() produces — which is both the fetch-key suffix (after the per-layer prefix) and a stable visited-set key. Spans are sub-slices of content.

func Skip

func Skip(b []byte) int

Skip returns the byte size of the first tuple element, or -1 on truncated input.

func SplitKeySuffix

func SplitKeySuffix(tupleBytes []byte) (suffix int64, pkEnd int, err error)

SplitKeySuffix splits a tuple-encoded key into PK portion and trailing int64 suffix. Zero allocation.

func SubspaceUnpack

func SubspaceUnpack(key []byte, prefixLen int) (tuple.Tuple, error)

SubspaceUnpack strips the subspace prefix and decodes the remainder using Unpack. Drop-in replacement for subspace.Unpack() with zero-alloc integer decode. Returns error if key is shorter than prefix.

func Unpack

func Unpack(b []byte) (tuple.Tuple, error)

Unpack decodes a tuple from raw bytes. Drop-in replacement for tuple.Unpack with zero allocation on the integer decode path.

Types

This section is empty.

Jump to

Keyboard shortcuts

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