Skip to main content

flowlog_runtime/
lib.rs

1//! FlowLog runtime — types and re-exports consumed by generated code.
2//!
3//! This crate is the runtime half of the FlowLog library-mode toolchain.
4//! Pair it with [`flowlog-build`] in your `[build-dependencies]`:
5//!
6//! ```toml
7//! [dependencies]
8//! flowlog-runtime = "0.2"
9//!
10//! [build-dependencies]
11//! flowlog-build = "0.2"
12//! ```
13//!
14//! ## What's in this crate
15//!
16//! | Module | Purpose |
17//! |--------|---------|
18//! | [`Relation`] | Trait implemented by every generated input struct |
19//! | [`io`] | Byte-range file reader + first-column sharding for parallel ingestion |
20//! | [`intern`] | Thread-safe string interning pool (`lasso`) |
21//! | [`txn`] | Transaction state types shared with incremental drivers |
22//!
23//! The re-exported crates (`timely`, `differential_dataflow`, etc.) are
24//! used internally by the generated code — you should not need to
25//! reference them directly.
26
27pub mod intern;
28pub mod io;
29pub mod sort;
30pub mod txn;
31
32/// Trait implemented by every generated input relation struct.
33///
34/// The generated `DatalogBatchEngine` calls [`Relation::to_tuple`] at
35/// insert time to convert user-facing structs (e.g. `Edge { x: 1, y: 2 }`)
36/// into the internal differential-dataflow tuple representation.
37///
38/// You don't implement this trait manually — `flowlog-build` generates an
39/// impl for each `.input` relation declared in your `.dl` program.
40pub trait Relation: Sized {
41    /// The internal DD tuple type (e.g. `(i32, i32)`).
42    type Tuple;
43    /// Relation name (lowercase), matching the DD input session key.
44    fn relation_name() -> &'static str;
45    /// Convert self into the internal tuple layout.
46    fn to_tuple(self) -> Self::Tuple;
47}
48
49// Re-exports for generated code. The `include!()`'d code references these
50// via `::flowlog_runtime::timely::*`, `::flowlog_runtime::differential_dataflow::*`,
51// etc. Users should not need to use them directly.
52#[doc(hidden)]
53pub use differential_dataflow;
54#[doc(hidden)]
55pub use lasso;
56#[doc(hidden)]
57pub use ordered_float;
58#[doc(hidden)]
59pub use serde;
60#[doc(hidden)]
61pub use timely;