Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions crates/types/src/post_asap/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand All @@ -48,3 +49,4 @@ pub use sketch::{
HydraParams, SamplingKind, SamplingParams, SketchAlgorithm, SketchCategory, SketchKind,
SketchParams, SketchQuery, StatModelKind, StatModelParams, WaveletKind, WaveletParams,
};
pub use summary_maintenance::SummaryMaintenanceMode;
36 changes: 36 additions & 0 deletions crates/types/src/post_asap/summary_maintenance.rs
Original file line number Diff line number Diff line change
@@ -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");
}
}
Loading