diff --git a/asap-query-engine/benches/simple_store_bench.rs b/asap-query-engine/benches/simple_store_bench.rs index 82180e8..1ddbb56 100644 --- a/asap-query-engine/benches/simple_store_bench.rs +++ b/asap-query-engine/benches/simple_store_bench.rs @@ -1,8 +1,9 @@ -//! Benchmarks for `SimpleMapStore` — insert, range query, exact query, +//! Benchmarks for `LegacySimpleMapStore` — insert, range query, exact query, //! store-analyze, and concurrent reads. //! -//! These benchmarks profile the existing (pre-PR-175) store implementation and -//! provide concrete measurements of algorithm complexity for: +//! These benchmarks profile the legacy store implementation +//! (`LegacySimpleMapStoreGlobal` / `LegacySimpleMapStorePerKey`) and provide +//! concrete measurements of algorithm complexity for: //! //! | Operation | Expected complexity | //! |------------------------------------|--------------------------| @@ -67,7 +68,7 @@ fn make_streaming_config(num_agg_ids: u64) -> Arc { Arc::new(StreamingConfig::new(configs)) } -/// Build a `SimpleMapStore` with no cleanup policy. +/// Build a `SimpleMapStore` (backed by legacy implementation) with no cleanup policy. fn make_store(config: Arc, strategy: LockStrategy) -> SimpleMapStore { SimpleMapStore::new_with_strategy(config, CleanupPolicy::NoCleanup, strategy) } diff --git a/asap-query-engine/src/stores/simple_map_store/global.rs b/asap-query-engine/src/stores/simple_map_store/legacy/global.rs similarity index 99% rename from asap-query-engine/src/stores/simple_map_store/global.rs rename to asap-query-engine/src/stores/simple_map_store/legacy/global.rs index f2a2063..d0bdc41 100644 --- a/asap-query-engine/src/stores/simple_map_store/global.rs +++ b/asap-query-engine/src/stores/simple_map_store/legacy/global.rs @@ -13,7 +13,7 @@ type StoreKey = u64; // aggregation_id type StoreValue = Vec<(Option, Box)>; /// In-memory storage implementation using single mutex (like Python version) -pub struct SimpleMapStoreGlobal { +pub struct LegacySimpleMapStoreGlobal { // Single global mutex protecting all data structures lock: Mutex, @@ -41,7 +41,7 @@ struct StoreData { read_counts: HashMap>, } -impl SimpleMapStoreGlobal { +impl LegacySimpleMapStoreGlobal { pub fn new(streaming_config: Arc, cleanup_policy: CleanupPolicy) -> Self { Self { lock: Mutex::new(StoreData { @@ -196,7 +196,7 @@ impl SimpleMapStoreGlobal { } #[async_trait::async_trait] -impl Store for SimpleMapStoreGlobal { +impl Store for LegacySimpleMapStoreGlobal { fn insert_precomputed_output( &self, output: PrecomputedOutput, @@ -543,7 +543,7 @@ impl Store for SimpleMapStoreGlobal { fn close(&self) -> StoreResult<()> { // For in-memory store, no cleanup needed - info!("SimpleMapStoreGlobal closed"); + info!("LegacySimpleMapStoreGlobal closed"); Ok(()) } } diff --git a/asap-query-engine/src/stores/simple_map_store/legacy/mod.rs b/asap-query-engine/src/stores/simple_map_store/legacy/mod.rs new file mode 100644 index 0000000..24a12f4 --- /dev/null +++ b/asap-query-engine/src/stores/simple_map_store/legacy/mod.rs @@ -0,0 +1,5 @@ +mod global; +mod per_key; + +pub use global::LegacySimpleMapStoreGlobal; +pub use per_key::LegacySimpleMapStorePerKey; diff --git a/asap-query-engine/src/stores/simple_map_store/per_key.rs b/asap-query-engine/src/stores/simple_map_store/legacy/per_key.rs similarity index 99% rename from asap-query-engine/src/stores/simple_map_store/per_key.rs rename to asap-query-engine/src/stores/simple_map_store/legacy/per_key.rs index 002b123..7075543 100644 --- a/asap-query-engine/src/stores/simple_map_store/per_key.rs +++ b/asap-query-engine/src/stores/simple_map_store/legacy/per_key.rs @@ -32,7 +32,7 @@ impl StoreKeyData { } /// In-memory storage implementation using per-key locks for concurrency -pub struct SimpleMapStorePerKey { +pub struct LegacySimpleMapStorePerKey { // Lock-free concurrent outer map - per aggregation_id store: DashMap>>, @@ -48,7 +48,7 @@ pub struct SimpleMapStorePerKey { cleanup_policy: CleanupPolicy, } -impl SimpleMapStorePerKey { +impl LegacySimpleMapStorePerKey { pub fn new(streaming_config: Arc, cleanup_policy: CleanupPolicy) -> Self { Self { store: DashMap::new(), @@ -302,7 +302,7 @@ impl SimpleMapStorePerKey { } #[async_trait::async_trait] -impl Store for SimpleMapStorePerKey { +impl Store for LegacySimpleMapStorePerKey { fn insert_precomputed_output( &self, output: PrecomputedOutput, @@ -632,7 +632,7 @@ impl Store for SimpleMapStorePerKey { fn close(&self) -> StoreResult<()> { // For in-memory store, no cleanup needed - info!("SimpleMapStorePerKey closed"); + info!("LegacySimpleMapStorePerKey closed"); Ok(()) } } diff --git a/asap-query-engine/src/stores/simple_map_store/mod.rs b/asap-query-engine/src/stores/simple_map_store/mod.rs index 991dd14..ad93dbd 100644 --- a/asap-query-engine/src/stores/simple_map_store/mod.rs +++ b/asap-query-engine/src/stores/simple_map_store/mod.rs @@ -1,5 +1,4 @@ -mod global; -mod per_key; +pub mod legacy; use crate::data_model::{ AggregateCore, CleanupPolicy, LockStrategy, PrecomputedOutput, StreamingConfig, @@ -8,13 +7,13 @@ use crate::stores::{Store, StoreResult, TimestampedBucketsMap}; use std::collections::HashMap; use std::sync::Arc; -pub use global::SimpleMapStoreGlobal; -pub use per_key::SimpleMapStorePerKey; +pub use legacy::LegacySimpleMapStoreGlobal; +pub use legacy::LegacySimpleMapStorePerKey; /// Enum wrapper that dispatches to either global or per-key lock implementation pub enum SimpleMapStore { - Global(SimpleMapStoreGlobal), - PerKey(SimpleMapStorePerKey), + Global(LegacySimpleMapStoreGlobal), + PerKey(LegacySimpleMapStorePerKey), } impl SimpleMapStore { @@ -30,12 +29,14 @@ impl SimpleMapStore { lock_strategy: LockStrategy, ) -> Self { match lock_strategy { - LockStrategy::Global => { - SimpleMapStore::Global(SimpleMapStoreGlobal::new(streaming_config, cleanup_policy)) - } - LockStrategy::PerKey => { - SimpleMapStore::PerKey(SimpleMapStorePerKey::new(streaming_config, cleanup_policy)) - } + LockStrategy::Global => SimpleMapStore::Global(LegacySimpleMapStoreGlobal::new( + streaming_config, + cleanup_policy, + )), + LockStrategy::PerKey => SimpleMapStore::PerKey(LegacySimpleMapStorePerKey::new( + streaming_config, + cleanup_policy, + )), } } }