Skip to main content

Crate timelake_format

Crate timelake_format 

Source
Expand description

Timelake’s on-disk conventions, with no I/O of its own, so the engine (timelake) and the WebAssembly reader and writer (timelake-wasm) share one definition: the table contract stored in timelake.* properties, time partition math, and Iceberg bound decoding. With the write feature, also the write path: preparing rows, writing Parquet with Iceberg statistics, manifests and table metadata, and appending and committing over a [host::Host] that the caller implements (SPEC §21.10).

use std::collections::HashMap;
use timelake_format::{Chunk, Contract, property};

let properties = HashMap::from([
    (property::TIME_COLUMN.to_string(), "time".to_string()),
    (property::CHUNK.to_string(), "day".to_string()),
]);
let contract = Contract::from_properties(&properties)?;
assert_eq!(contract.chunk, Some(Chunk::Day));

let day = Chunk::Day.value(1_767_225_600_000_000)?; // 2026-01-01T00:00:00Z in µs
assert_eq!(Chunk::Day.label(day), "2026-01-01");

Re-exports§

pub use contract::Chunk;
pub use contract::Contract;
pub use contract::TableOptions;
pub use contract::format_duration;
pub use contract::parse_duration;
pub use version::FormatVersion;

Modules§

bounds
Iceberg single-value serialization of column bounds (manifest lower_bounds/upper_bounds). https://iceberg.apache.org/spec/#binary-single-value-serialization
contract
The Timelake table contract (SPEC §7.1): which column is time, which columns identify a series, and the layout/maintenance policy derived from them. Stored as timelake.* Iceberg table properties (see property), so the contract travels with the table and other engines simply ignore it.
property
Table property keys holding the Contract.
settings
The registry of Timelake’s settings (SPEC §21.9): every switch is declared once here, with its type, default, the levels it may be set at, and the version that added it. Table properties, SQL SET, the CLI’s timelake settings and the docs all come from SETTINGS.
summary
Snapshot summary keys: Timelake’s own, and the standard Iceberg counters Timelake maintains.
version
The table format version, timelake.format-version: a semantic version of its own, separate from the software’s.

Structs§

FormatError
An invalid contract property, duration, or partition value.

Constants§

FORMAT_VERSION
The table format this version of Timelake writes, recorded in each table as timelake.format-version. It reads and writes older formats, and newer ones as far as FormatVersion allows. timelake upgrade brings a table to this format.
INGEST_TIME_COLUMN
The name of the insertion-time column of new time-series tables.
TABLES_INDEX
Optional warehouse-level index of table names, for stores that cannot list (plain HTTPS).

Type Aliases§

Result
Result with FormatError.