From 5bcfb69e59c1fa8d21fedcd65bf3f1d2cb2fa1dc Mon Sep 17 00:00:00 2001 From: zz_y Date: Sun, 30 Aug 2026 15:08:18 -0600 Subject: [PATCH] feat(post-asap): define summary maintenance modes --- crates/types/src/post_asap/mod.rs | 2 ++ .../src/post_asap/summary_maintenance.rs | 36 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 crates/types/src/post_asap/summary_maintenance.rs diff --git a/crates/types/src/post_asap/mod.rs b/crates/types/src/post_asap/mod.rs index 5ce45387..40c4a7a4 100644 --- a/crates/types/src/post_asap/mod.rs +++ b/crates/types/src/post_asap/mod.rs @@ -32,6 +32,7 @@ pub mod guarantee; pub mod query_time; pub mod schema; pub mod sketch; +pub mod summary_maintenance; pub use expr::{SummaryExpr, SummaryNode}; pub use guarantee::{ @@ -48,3 +49,4 @@ pub use sketch::{ HydraParams, SamplingKind, SamplingParams, SketchAlgorithm, SketchCategory, SketchKind, SketchParams, SketchQuery, StatModelKind, StatModelParams, WaveletKind, WaveletParams, }; +pub use summary_maintenance::SummaryMaintenanceMode; diff --git a/crates/types/src/post_asap/summary_maintenance.rs b/crates/types/src/post_asap/summary_maintenance.rs new file mode 100644 index 00000000..d3f919c8 --- /dev/null +++ b/crates/types/src/post_asap/summary_maintenance.rs @@ -0,0 +1,36 @@ +//! Physical construction mode for a materialized summary. +//! +//! A [`super::SummaryNode`] is a logical summary expression and deliberately +//! does not carry this choice: the same candidate may be built directly for +//! one workload or maintained incrementally for another. Physical planning +//! attaches the selected mode to its deployment guarantee. + +/// How a physical summary deployment obtains its state. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +pub enum SummaryMaintenanceMode { + /// Rebuild the summary from its complete input when the deployment needs + /// a value. No update stream is required. + DirectBuild, + /// Create the state once and apply input changes as they arrive. + Incremental, +} + +impl SummaryMaintenanceMode { + pub const fn as_str(self) -> &'static str { + match self { + Self::DirectBuild => "direct_build", + Self::Incremental => "incremental", + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn maintenance_modes_have_stable_export_names() { + assert_eq!(SummaryMaintenanceMode::DirectBuild.as_str(), "direct_build"); + assert_eq!(SummaryMaintenanceMode::Incremental.as_str(), "incremental"); + } +}