nativefmt

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2026 License: Apache-2.0 Imports: 10 Imported by: ? 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 nativefmt is the contract between the files of a native artifact and the chunked sync protocol the data nodes receive them over: which files of a payload are sent, under which name a data node expects each of them, and how a part's metadata file becomes the part description the receiver places the part with. The names mirror the storage engines (banyand/stream, banyand/measure, banyand/trace and banyand/internal/sidx); this package must not import banyand/ so that bydbctl can use it too.

Index

Constants

The payload kinds.

View Source
const (
	// CoreMetaFile is the metadata file of a core part.
	CoreMetaFile = "metadata.json"
	// SecondaryMetaFile is the manifest of a trace secondary index part.
	SecondaryMetaFile = "manifest.json"
	// SegmentMetaFile is the version file of a segment.
	SegmentMetaFile = "metadata"
	// SnapshotExt is the extension of a native index manifest and of a part list.
	SnapshotExt = ".snp"
	// SegDirPrefix prefixes the directory name of a segment.
	SegDirPrefix = "seg-"
	// ShardDirPrefix prefixes the directory name of a shard.
	ShardDirPrefix = "shard-"
	// SeriesIndexDir is the directory of a segment's series index.
	SeriesIndexDir = "sidx"
	// ElementIndexDir is the directory of a stream shard's element index.
	ElementIndexDir = "idx"
	// SecondaryIndexDir is the directory of a trace shard's secondary index parts.
	SecondaryIndexDir = "sidx"
)

File names shared by the engines.

View Source
const MaxChunkSize = 4 << 20

MaxChunkSize is the most bytes one ImportParts chunk may carry. The liaison relays a chunk as one SyncPart frame, so it stays well below a data node's default 10 MiB receive limit once the file slices and the part descriptions are added.

Variables

This section is empty.

Functions

func Duplicable

func Duplicable(catalog commonv1.Catalog, kind Kind) bool

Duplicable tells whether a payload of kind stored twice in catalog stores its rows or documents twice, so it must not be pushed again once it may have been committed.

func HasSecondaryParts

func HasSecondaryParts(catalog commonv1.Catalog) bool

HasSecondaryParts tells whether a part payload of catalog may carry secondary index parts.

func ParsePartInfo

ParsePartInfo builds the description of one part from its metadata file: the metadata.json of a core part, or the manifest.json of a trace secondary index part, whose time range falls back to that of its core part (core may be nil for a core part).

func PartTypeAt

func PartTypeAt(init *transferv1.ImportPartsRequest_Init, idx uint32) string

PartTypeAt returns the part type of part idx of a payload, "" for the core part or an index out of range.

func Segmented

func Segmented(catalog commonv1.Catalog) bool

Segmented tells whether the data of catalog lives in segments, so its payloads carry the file format version of their source segment.

func ShardDir

func ShardDir(id uint32) string

ShardDir returns the directory name of shard id.

func Supports

func Supports(catalog commonv1.Catalog, kind Kind) error

Supports returns an error unless catalog takes payloads of kind.

func SyncFileName

func SyncFileName(catalog commonv1.Catalog, kind Kind, partType, disk string) (name string, skip bool, err error)

SyncFileName maps the on-disk name of one file of a payload to the name the receiving data node expects. skip reports a file that is not sent: the metadata of a part, which travels as the part description instead, the series metadata a receiver does not take, and the manifest of an index, whose segments are introduced one by one. An unknown file is an error: sending it would fail on the data node.

func Topic

func Topic(catalog commonv1.Catalog, kind Kind) (string, error)

Topic returns the chunked sync topic a payload of kind of catalog is received on.

func ValidName

func ValidName(name string) bool

ValidName tells whether name is one path component a receiver may create in its own directory: not empty, not "." or "..", and without a separator.

Types

type Kind

Kind is what one ImportParts payload carries.

Jump to

Keyboard shortcuts

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