bitemporal-runtime
Bitemporal truth primitives for append-supersede temporal data.
bitemporal-runtime is the only Rust implementation of strict
bitemporal truth — separate valid_time and recorded_time,
append-supersede, as-of queries. As of release, zero analogues
exist on crates.io.
When to use it
Bitemporal data modeling is for domains where you need to answer "what did we believe at time T about the fact that was valid at time V" — audit, regulatory reporting, scientific reproducibility, financial historical reconstruction, version-of-truth queries.
If you have one timeline (just updated_at or just valid_from),
you don't need this crate. If you have two, and you need both, you
do.
Quick Start
use ;
use ;
Overview
This crate provides first-class support for bitemporal data modeling:
- valid_time: When a fact is true in the business domain
- recorded_time: When the system captured the fact
- append-supersede: Updates append new rows instead of mutating existing ones
Key types
BitemporalRecord<T>— a temporal record withvalid_time,recorded_time, and domain valueSupersessionReceipt— cryptographic SHA-256 receipt for supersession eventsInMemoryDb— in-memory store for testingSqliteDb(featuresqlite) — durable SQLite-backed store
Core functions
append_supersede()— append a new record, emit receipts for superseded prior versionsas_of_query()— query records valid at a givenvalid_timeas of a givenrecorded_timetemporal_snapshot()— retrieve full state as of a givenrecorded_time
Cargo features
sqlite— enables theSqliteDbdurable store (addsrusqlitedep)schema— enables JSON Schema generation for the public types (addsschemarsdep)
Both features are off by default to keep the dep graph small.
MSRV
Rust 1.75 (2021 edition).
Dependencies
Default: chrono, serde, serde_json, sha2, thiserror.
With sqlite: adds rusqlite.
With schema: adds schemars.
License
MIT OR Apache-2.0 (dual-licensed). See LICENSE-MIT and
LICENSE-APACHE for the full texts.
Changelog
See CHANGELOG.md for the release history.