diff --git a/data_plane/src/storage_engines/sketch_db/schema/eviction.rs b/data_plane/src/storage_engines/sketch_db/lifecycle/eviction.rs similarity index 99% rename from data_plane/src/storage_engines/sketch_db/schema/eviction.rs rename to data_plane/src/storage_engines/sketch_db/lifecycle/eviction.rs index b982be5a..07334a56 100644 --- a/data_plane/src/storage_engines/sketch_db/schema/eviction.rs +++ b/data_plane/src/storage_engines/sketch_db/lifecycle/eviction.rs @@ -54,7 +54,7 @@ use tracing::{info, warn}; use crate::storage_engines::sketch_db::backfill::{BackfillRegistry, BackfillStatus}; use crate::storage_engines::sketch_db::index::SketchStore; -use super::{AggStatus, SchemaRegistry}; +use crate::storage_engines::sketch_db::schema::{AggStatus, SchemaRegistry}; /// Configuration for the eviction loop. Separate from /// `SchemaRegistry`'s `retirement_retention` because the service diff --git a/data_plane/src/storage_engines/sketch_db/lifecycle/mod.rs b/data_plane/src/storage_engines/sketch_db/lifecycle/mod.rs new file mode 100644 index 00000000..45b73c19 --- /dev/null +++ b/data_plane/src/storage_engines/sketch_db/lifecycle/mod.rs @@ -0,0 +1,27 @@ +//! Sid lifecycle — `Active`/`Retired`/`Expired` over per-sid metadata, +//! eviction services, and the ingest barrier. +//! +//! Post-M2.3 reorg #5. The sid-level lifecycle state itself (the +//! `retired_at_ms` / `expires_at_ms` fields on +//! [`crate::storage_engines::sketch_db::index::SketchInstanceMetadata`], +//! plus `force_retire` / `force_expire` / `is_writable` / `list_by_status` +//! / `remove_instance` / `remove_instances_for_agg_config` methods on +//! `SketchStore`) lives in `index/` next to the data it gates. This +//! module owns the **services** that drive lifecycle transitions: +//! +//! - [`eviction::SchemaEvictionService`] — background tokio task that +//! sweeps `Expired` agg-configs (from the `SchemaRegistry`) and +//! removes their residual sids from `SketchStore` via +//! `remove_instances_for_agg_config`. Schedule-driven half of the +//! "controller dropped a config → its sids go away" flow. +//! +//! Future content: +//! - `reconcile_from_streaming_config` — once schema/ is retired, the +//! "controller-reconcile-driven bulk-retire" entrypoint moves here +//! and operates on sids directly. + +pub mod eviction; + +pub use eviction::{ + warn_if_retention_inverted, SchemaEvictionConfig, SchemaEvictionHandle, SchemaEvictionService, +}; diff --git a/data_plane/src/storage_engines/sketch_db/mod.rs b/data_plane/src/storage_engines/sketch_db/mod.rs index 7075eda8..38a7ca43 100644 --- a/data_plane/src/storage_engines/sketch_db/mod.rs +++ b/data_plane/src/storage_engines/sketch_db/mod.rs @@ -32,6 +32,7 @@ pub mod accuracy; pub mod backfill; pub mod data; pub mod index; +pub mod lifecycle; pub mod metrics; pub mod persistence; pub mod query; diff --git a/data_plane/src/storage_engines/sketch_db/schema/mod.rs b/data_plane/src/storage_engines/sketch_db/schema/mod.rs index 13fda708..2e07a1f4 100644 --- a/data_plane/src/storage_engines/sketch_db/schema/mod.rs +++ b/data_plane/src/storage_engines/sketch_db/schema/mod.rs @@ -1276,8 +1276,9 @@ mod tests { } } -// 2026-05 reorg: schema_eviction.rs moved alongside as a submodule. -pub mod eviction; -pub use eviction::{ +// Post-M2.3 reorg: eviction moved to `sketch_db::lifecycle::eviction`. +// Legacy re-exports keep `sketch_db::schema::SchemaEvictionService` callers +// compiling until they migrate to `sketch_db::lifecycle::*`. +pub use crate::storage_engines::sketch_db::lifecycle::{ warn_if_retention_inverted, SchemaEvictionConfig, SchemaEvictionHandle, SchemaEvictionService, };