fbs

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 3 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

Overview

Package fbs holds typed accessors over flatbuf.Table for the tables of the four flatbuffers schemas a Vortex file uses. They are written by hand from the .fbs files at the pinned upstream tag, with the field ids in comments (ids follow declaration order, a union takes two). message.fbs (IPC) is not used by files and is left out.

  • vortex-file/flatbuffers/vortex-file/footer.fbs: Postscript, PostscriptSegment, PostscriptMetadata, Footer, ArraySpec, LayoutSpec, SegmentSpec, FileStatistics
  • vortex-layout/flatbuffers/vortex-layout/layout.fbs: Layout
  • vortex-array/flatbuffers/vortex-array/array.fbs: Array, ArrayNode, Buffer, ArrayStats
  • vortex-array/flatbuffers/vortex-dtype/dtype.fbs: DType and its union

None of these schemas uses nested flatbuffers, vectors of unions, shared strings or 64-bit offsets, so internal/flatbuf does not implement them.

Index

Constants

View Source
const (
	U8 uint8 = iota
	U16
	U32
	U64
	I8
	I16
	I32
	I64
	F16
	F32
	F64
)

PType values (dtype.fbs, enum PType).

View Source
const (
	Inexact = 0
	Exact   = 1
)

Precision of a min or max: 0 Inexact, 1 Exact.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregateSet

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

AggregateSet is an ordered list of aggregates recorded together.

func (AggregateSet) Specs

func (a AggregateSet) Specs() ([]uint16, error)

Specs is field 0 (required): indices into AggregateSpecs.

type AggregateSpec

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

AggregateSpec is an aggregate function and its options.

func (AggregateSpec) ID

func (a AggregateSpec) ID() (string, error)

ID is field 0 (required).

func (AggregateSpec) Options

func (a AggregateSpec) Options() ([]byte, error)

Options is field 1, the serialized options (absent when empty).

type Array

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

Array is the flatbuffer of an array message.

func ReadArray

func ReadArray(buf []byte, maxDepth int) (Array, error)

ReadArray reads the root Array of buf. maxDepth bounds the nesting of the node tree.

func (Array) Buffers

func (a Array) Buffers() (List[Buffer], error)

Buffers is field 1, a vector of structs.

func (Array) Root

func (a Array) Root() (ArrayNode, bool, error)

Root is field 0, the node tree.

type ArrayNode

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

ArrayNode is a node of an array's tree.

func (ArrayNode) AppendBuffers added in v0.1.1

func (n ArrayNode) AppendBuffers(dst []uint16) ([]uint16, error)

AppendBuffers appends field 3 to dst.

func (ArrayNode) Buffers

func (n ArrayNode) Buffers() ([]uint16, error)

Buffers is field 3, indices into the array's Buffers.

func (ArrayNode) Children

func (n ArrayNode) Children() (List[ArrayNode], error)

Children is field 2.

func (ArrayNode) Encoding

func (n ArrayNode) Encoding() (uint16, error)

Encoding is field 0, an index into the array specs.

func (ArrayNode) Metadata

func (n ArrayNode) Metadata() ([]byte, error)

Metadata is field 1, the protobuf of the encoding.

func (ArrayNode) Stats

func (n ArrayNode) Stats() (ArrayStats, bool, error)

Stats is field 4.

type ArraySpec

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

ArraySpec names an array encoding.

func (ArraySpec) ID

func (a ArraySpec) ID() (string, error)

ID is field 0 (required).

type ArrayStats

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

ArrayStats holds the statistics of an array. The scalar values are protobuf ScalarValue bytes (see internal/scalar). The optional fields report whether they are set.

func (ArrayStats) IsConstant

func (s ArrayStats) IsConstant() (v, ok bool, err error)

IsConstant is field 7.

func (ArrayStats) IsSorted

func (s ArrayStats) IsSorted() (v, ok bool, err error)

IsSorted is field 5.

func (ArrayStats) IsStrictSorted

func (s ArrayStats) IsStrictSorted() (v, ok bool, err error)

IsStrictSorted is field 6.

func (ArrayStats) Max

func (s ArrayStats) Max() ([]byte, bool, error)

Max is field 2.

func (ArrayStats) MaxPrecision

func (s ArrayStats) MaxPrecision() (uint8, error)

MaxPrecision is field 3.

func (ArrayStats) Min

func (s ArrayStats) Min() ([]byte, bool, error)

Min is field 0.

func (ArrayStats) MinPrecision

func (s ArrayStats) MinPrecision() (uint8, error)

MinPrecision is field 1.

func (ArrayStats) NanCount

func (s ArrayStats) NanCount() (v uint64, ok bool, err error)

NanCount is field 10.

func (ArrayStats) NullCount

func (s ArrayStats) NullCount() (v uint64, ok bool, err error)

NullCount is field 8.

func (ArrayStats) Sum

func (s ArrayStats) Sum() ([]byte, bool, error)

Sum is field 4.

func (ArrayStats) UncompressedSizeInBytes

func (s ArrayStats) UncompressedSizeInBytes() (v uint64, ok bool, err error)

UncompressedSizeInBytes is field 9.

type Buffer

type Buffer struct {
	Padding           uint16 // bytes written before the buffer
	AlignmentExponent uint8
	Compression       uint8 // 0 None, 1 LZ4
	Length            uint32
}

Buffer locates a data buffer after the message. It is an 8-byte struct.

type DType

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

DType is the table that wraps the union (field 0 is the type, field 1 the value).

func ReadDType

func ReadDType(buf []byte, maxDepth int) (DType, error)

ReadDType reads the root DType of buf. maxDepth bounds the nesting of the type.

func (DType) Decimal

func (d DType) Decimal() (precision uint8, scale int8, err error)

Decimal returns the precision and scale of a decimal type.

func (DType) Extension

func (d DType) Extension() (id string, storage DType, metadata []byte, err error)

Extension returns the id, the storage type and the metadata of an extension type.

func (DType) FixedSizeList

func (d DType) FixedSizeList() (DType, uint32, error)

FixedSizeList returns the element type and the size of a fixed-size list type.

func (DType) Kind

func (d DType) Kind() (Kind, error)

Kind returns the arm of the union. It is an error for the union to be NONE.

func (DType) List

func (d DType) List() (DType, error)

List returns the element type of a list type.

func (DType) Map

func (d DType) Map() (key, value DType, keysSorted bool, err error)

Map returns the key and value types of a map type, and whether its keys are sorted.

func (DType) Nullable

func (d DType) Nullable() (bool, error)

Nullable reports the nullability of the type.

func (DType) Primitive

func (d DType) Primitive() (uint8, error)

Primitive returns the PType of a primitive type.

func (DType) Struct

func (d DType) Struct() (List[string], List[DType], error)

Struct returns the field names and types of a struct type.

func (DType) Union

func (d DType) Union() (List[string], List[DType], []byte, error)

Union returns the names, types and type ids of a union type.

type FileStatistics

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

FileStatistics holds the file-level statistics.

func ReadFileStatistics

func ReadFileStatistics(buf []byte) (FileStatistics, error)

ReadFileStatistics reads the root FileStatistics of buf.

func (FileStatistics) AggregateSets

func (s FileStatistics) AggregateSets() (List[AggregateSet], error)

AggregateSets is field 2.

func (FileStatistics) AggregateSpecs

func (s FileStatistics) AggregateSpecs() (List[AggregateSpec], error)

AggregateSpecs is field 1.

func (FileStatistics) EntrySets

func (s FileStatistics) EntrySets() ([]uint16, error)

EntrySets is field 3, an index into AggregateSets per entry.

func (FileStatistics) FieldStats

func (s FileStatistics) FieldStats() (List[ArrayStats], error)

FieldStats is field 0, one ArrayStats per top-level field (the legacy shape).

func (FileStatistics) Partials

func (s FileStatistics) Partials() ([]byte, error)

Partials is field 4: per entry and spec, a LEB128 length then a ScalarValue.

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

Footer is the dictionary of the specs the layout and the arrays refer to by index.

func ReadFooter

func ReadFooter(buf []byte) (Footer, error)

ReadFooter reads the root Footer of buf.

func (Footer) ArraySpecs

func (f Footer) ArraySpecs() (List[ArraySpec], error)

ArraySpecs is field 0.

func (Footer) LayoutSpecs

func (f Footer) LayoutSpecs() (List[LayoutSpec], error)

LayoutSpecs is field 1.

func (Footer) SegmentSpecs

func (f Footer) SegmentSpecs() (List[SegmentSpec], error)

SegmentSpecs is field 2, a vector of structs.

type Kind

type Kind uint8

Kind is the arm of the DType union (dtype.fbs, enum Type).

const (
	KindNull          Kind = 1
	KindBool          Kind = 2
	KindPrimitive     Kind = 3
	KindDecimal       Kind = 4
	KindUtf8          Kind = 5
	KindBinary        Kind = 6
	KindStruct        Kind = 7
	KindList          Kind = 8
	KindExtension     Kind = 9
	KindFixedSizeList Kind = 10
	KindVariant       Kind = 11
	KindUnion         Kind = 12
	KindMap           Kind = 13
)

The arms of the union. 0 is NONE.

type Layout

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

Layout is a node of the layout tree.

func ReadLayout

func ReadLayout(buf []byte, maxDepth int) (Layout, error)

ReadLayout reads the root Layout of buf. maxDepth bounds the nesting of the tree.

func (Layout) Children

func (l Layout) Children() (List[Layout], error)

Children is field 3.

func (Layout) Encoding

func (l Layout) Encoding() (uint16, error)

Encoding is field 0, an index into the footer's layout specs.

func (Layout) Metadata

func (l Layout) Metadata() ([]byte, error)

Metadata is field 2, opaque at this layer.

func (Layout) RowCount

func (l Layout) RowCount() (uint64, error)

RowCount is field 1.

func (Layout) Segments

func (l Layout) Segments() (flatbuf.Uint32Vec, error)

Segments is field 4, indices into the footer's segment specs.

type LayoutSpec

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

LayoutSpec names a layout encoding.

func (LayoutSpec) ID

func (l LayoutSpec) ID() (string, error)

ID is field 0 (required).

type List

type List[T any] struct {
	// contains filtered or unexported fields
}

List is a vector of tables, structs or strings, decoded element by element. It holds the vector and a function with no state for its elements, so that it is a value: reading the children of a node allocates nothing.

func (List[T]) At

func (l List[T]) At(i int) (T, error)

At returns the i-th element, or an error when i is out of range or the element is bad.

func (List[T]) Len

func (l List[T]) Len() int

Len is the number of elements.

type Postscript

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

Postscript is the table at the end of the file, before the 8-byte trailer.

func ReadPostscript

func ReadPostscript(buf []byte) (Postscript, error)

ReadPostscript reads the root Postscript of buf.

func (Postscript) DType

func (p Postscript) DType() (PostscriptSegment, bool, error)

DType is the segment of the root DType flatbuffer (field 0).

func (Postscript) Footer

func (p Postscript) Footer() (PostscriptSegment, bool, error)

Footer is the segment of the Footer flatbuffer (field 3, required).

func (Postscript) Layout

func (p Postscript) Layout() (PostscriptSegment, bool, error)

Layout is the segment of the root Layout flatbuffer (field 1, required).

func (Postscript) Metadata

func (p Postscript) Metadata() (List[PostscriptMetadata], error)

Metadata lists the user-defined metadata segments (field 4).

func (Postscript) Statistics

func (p Postscript) Statistics() (PostscriptSegment, bool, error)

Statistics is the segment of the FileStatistics flatbuffer (field 2).

type PostscriptMetadata

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

PostscriptMetadata is a keyed user-defined metadata segment.

func (PostscriptMetadata) Key

func (m PostscriptMetadata) Key() (string, error)

Key is field 0 (required).

func (PostscriptMetadata) Segment

Segment is field 1 (required).

type PostscriptSegment

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

PostscriptSegment locates a segment, with its compression and encryption inline.

func (PostscriptSegment) AlignmentExponent

func (s PostscriptSegment) AlignmentExponent() (uint8, error)

AlignmentExponent is field 2, the base-2 exponent of the alignment.

func (PostscriptSegment) Compression

func (s PostscriptSegment) Compression() (uint8, error)

Compression is the scheme of the CompressionSpec in field 3: 0 None, 1 LZ4, 2 ZLib, 3 ZStd. It is 0 when the field is absent.

func (PostscriptSegment) Encrypted

func (s PostscriptSegment) Encrypted() bool

Encrypted reports whether the EncryptionSpec of field 4 is present.

func (PostscriptSegment) Length

func (s PostscriptSegment) Length() (uint32, error)

Length is field 1, in bytes.

func (PostscriptSegment) Offset

func (s PostscriptSegment) Offset() (uint64, error)

Offset is field 0, from the start of the file.

type SegmentSpec

type SegmentSpec struct {
	Offset            uint64 // from the start of the file
	Length            uint32
	AlignmentExponent uint8
	Compression       uint8 // reserved
	Encryption        uint16
}

SegmentSpec locates a buffer within the file. It is a 16-byte struct.

Jump to

Keyboard shortcuts

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