Skip to main content

Crate timelake_format

Crate timelake_format 

Source
Expand description

Timelake’s on-disk conventions, with no I/O and no heavy dependencies, so the engine (timelake) and the WebAssembly reader (timelake-wasm) share one definition: the table contract stored in timelake.* properties, time partition math, and Iceberg bound decoding.

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.
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.
TABLES_INDEX
Optional warehouse-level index of table names, for stores that cannot list (plain HTTPS).

Type Aliases§

Result
Result with FormatError.