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
- func Duplicable(catalog commonv1.Catalog, kind Kind) bool
- func HasSecondaryParts(catalog commonv1.Catalog) bool
- func ParsePartInfo(id uint64, partType string, meta []byte, ...) (*transferv1.ImportPartsRequest_PartInfo, error)
- func PartTypeAt(init *transferv1.ImportPartsRequest_Init, idx uint32) string
- func Segmented(catalog commonv1.Catalog) bool
- func ShardDir(id uint32) string
- func Supports(catalog commonv1.Catalog, kind Kind) error
- func SyncFileName(catalog commonv1.Catalog, kind Kind, partType, disk string) (name string, skip bool, err error)
- func Topic(catalog commonv1.Catalog, kind Kind) (string, error)
- func ValidName(name string) bool
- type Kind
Constants ¶
const ( KindPart = transferv1.ImportPartsRequest_KIND_PART KindSeriesIndex = transferv1.ImportPartsRequest_KIND_SERIES_INDEX KindElementIndex = transferv1.ImportPartsRequest_KIND_ELEMENT_INDEX KindProperty = transferv1.ImportPartsRequest_KIND_PROPERTY )
The payload kinds.
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.
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 ¶
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 ¶
HasSecondaryParts tells whether a part payload of catalog may carry secondary index parts.
func ParsePartInfo ¶
func ParsePartInfo(id uint64, partType string, meta []byte, core *transferv1.ImportPartsRequest_PartInfo) (*transferv1.ImportPartsRequest_PartInfo, error)
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 ¶
Segmented tells whether the data of catalog lives in segments, so its payloads carry the file format version of their source segment.
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.
Types ¶
type Kind ¶
type Kind = transferv1.ImportPartsRequest_Kind
Kind is what one ImportParts payload carries.