Skip to content

Format specification ​

Tetration stores chunked tensor data in a layout v1 .tet file — one mmap-friendly sealed image with a catalog, fixed-size chunk index, and raw or zstd payloads. Multi-writer and cloud use the same sealed bytes inside a .tet.d (or store) package: shards → publish → generations/<G>/packed.tet.

Current crates: tetration / tet-py 0.8.3. Normative contract: crate SPEC/ + conformance/.

What a .tet file contains ​

RegionPurpose
SuperblockMagic TETR, layout_version = 1, dataset count, chunk index pointer, optional footer flag
Dataset directoryNamed datasets: dtype tag, shape, chunk grid
Chunk index (TIDX)Fixed 104-byte rows: grid coords → payload offset / lengths / codec
Chunk payloadsTensor bytes — codec 0 raw or 1 zstd
History footer (THST, optional)Provenance history rows + per-dataset dim_names / coords / attrs; may embed ZONE/INDEX spills (history_version = 2)

All multi-byte integers are little-endian.

Supported wire dtypes ​

Tags 1–10, row-major within each chunk:

TagType
1f32
2f64
3i32
4i64
5u8
6u16
7i16
8u32
9f16
10u64

Booleans from HDF5, Zarr, and similar sources import as u8 (0/1).

Packages vs a standalone .tet ​

ArtifactRole
Standalone .tetOne sealed layout-v1 image (convert output, pack output, or a single-writer session)
.tet.d packageDirectory (or store prefix): staging parts → publish → generations/<G>/packed.tet + CURRENT
packed.tetThe sealed layout-v1 file readers open for generation G — same byte contract as a standalone .tet

Readers pin a generation at open. Advancing CURRENT does not retarget an already-open handle. Detail: CLI packages, store-backed reads, upstream writer protocol v2.

Zone maps + secondary indexes ​

LocationRole
Embedded footer spillsSame UTF-8 ZONE/INDEX bytes inside the sealed .tet (history_version = 2). Convert / writer auto-embed; tet index re-embeds. See Embedded indexes.
Generation sidecarsOptional ZONE.json / INDEX.json beside packed.tet under generations/<G>/ (package seal may keep mirrors). Not a layout_version bump.

INDEX.json kinds: value postings (eq), sorted_axis_range, coord_label_postings. Query prefers embed → sidecar → missing. Missing or unverifiable indexes fall back; answers stay correct.

Interchange (into / out of .tet) ​

Convert and export are not regions of the layout; they produce or consume sealed images:

DirectionFormats
Import (tet convert)HDF5, NetCDF, Zarr v2/v3, NumPy, CSV/TSV, Parquet; local paths or s3:// (single object or Zarr prefix)
Export (tet export)Zarr v3 directory, HDF5, NetCDF

See tet convert & export. Declared science/media attrs in the footer: Semantics.

Sections in this spec ​

Canonical source ​

The Rust crate in Latka-Industries/tetration is the reference implementation. Byte-level tables: upstream docs/layout_v1.md. Secondary indexes: docs/secondary_indexes.md. Embed: docs/embedded_indexes.md.

Pre-1.0

Layout v1 and query JSON/TOML may change before the 1.0 release. Pin crate / CLI / tet-py versions in production. Prefer the SPEC + conformance pack over informal docs when implementing a third-party reader.