Skip to content

Commit 2b68d6d

Browse files
zz_yclaude
andcommitted
Rename SimpleMapStore impls to Legacy* and move to legacy/ submodule
Move `SimpleMapStoreGlobal` → `LegacySimpleMapStoreGlobal` and `SimpleMapStorePerKey` → `LegacySimpleMapStorePerKey` under a new `simple_map_store/legacy/` submodule, in preparation for introducing optimised replacements that will reclaim the original names (PR #175 part b). - `legacy/global.rs` / `legacy/per_key.rs`: original implementations, renamed with the `Legacy` prefix throughout (struct, impl, log messages) - `legacy/mod.rs`: re-exports both legacy types - `simple_map_store/mod.rs`: references legacy module; `SimpleMapStore` enum now wraps `LegacySimpleMapStoreGlobal` / `LegacySimpleMapStorePerKey` - `benches/simple_store_bench.rs`: doc comment updated to reflect that the bench profiles the legacy store implementation Public API (`SimpleMapStore`, `Store`) is unchanged. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 83ab884 commit 2b68d6d

5 files changed

Lines changed: 25 additions & 20 deletions

File tree

asap-query-engine/benches/simple_store_bench.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
//! Benchmarks for `SimpleMapStore` — insert, range query, exact query,
1+
//! Benchmarks for `LegacySimpleMapStore` — insert, range query, exact query,
22
//! store-analyze, and concurrent reads.
33
//!
4-
//! These benchmarks profile the existing (pre-PR-175) store implementation and
5-
//! provide concrete measurements of algorithm complexity for:
4+
//! These benchmarks profile the legacy store implementation
5+
//! (`LegacySimpleMapStoreGlobal` / `LegacySimpleMapStorePerKey`) and provide
6+
//! concrete measurements of algorithm complexity for:
67
//!
78
//! | Operation | Expected complexity |
89
//! |------------------------------------|--------------------------|
@@ -67,7 +68,7 @@ fn make_streaming_config(num_agg_ids: u64) -> Arc<StreamingConfig> {
6768
Arc::new(StreamingConfig::new(configs))
6869
}
6970

70-
/// Build a `SimpleMapStore` with no cleanup policy.
71+
/// Build a `SimpleMapStore` (backed by legacy implementation) with no cleanup policy.
7172
fn make_store(config: Arc<StreamingConfig>, strategy: LockStrategy) -> SimpleMapStore {
7273
SimpleMapStore::new_with_strategy(config, CleanupPolicy::NoCleanup, strategy)
7374
}

asap-query-engine/src/stores/simple_map_store/global.rs renamed to asap-query-engine/src/stores/simple_map_store/legacy/global.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type StoreKey = u64; // aggregation_id
1313
type StoreValue = Vec<(Option<KeyByLabelValues>, Box<dyn AggregateCore>)>;
1414

1515
/// In-memory storage implementation using single mutex (like Python version)
16-
pub struct SimpleMapStoreGlobal {
16+
pub struct LegacySimpleMapStoreGlobal {
1717
// Single global mutex protecting all data structures
1818
lock: Mutex<StoreData>,
1919

@@ -41,7 +41,7 @@ struct StoreData {
4141
read_counts: HashMap<StoreKey, HashMap<TimestampRange, u64>>,
4242
}
4343

44-
impl SimpleMapStoreGlobal {
44+
impl LegacySimpleMapStoreGlobal {
4545
pub fn new(streaming_config: Arc<StreamingConfig>, cleanup_policy: CleanupPolicy) -> Self {
4646
Self {
4747
lock: Mutex::new(StoreData {
@@ -196,7 +196,7 @@ impl SimpleMapStoreGlobal {
196196
}
197197

198198
#[async_trait::async_trait]
199-
impl Store for SimpleMapStoreGlobal {
199+
impl Store for LegacySimpleMapStoreGlobal {
200200
fn insert_precomputed_output(
201201
&self,
202202
output: PrecomputedOutput,
@@ -543,7 +543,7 @@ impl Store for SimpleMapStoreGlobal {
543543

544544
fn close(&self) -> StoreResult<()> {
545545
// For in-memory store, no cleanup needed
546-
info!("SimpleMapStoreGlobal closed");
546+
info!("LegacySimpleMapStoreGlobal closed");
547547
Ok(())
548548
}
549549
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
mod global;
2+
mod per_key;
3+
4+
pub use global::LegacySimpleMapStoreGlobal;
5+
pub use per_key::LegacySimpleMapStorePerKey;

asap-query-engine/src/stores/simple_map_store/per_key.rs renamed to asap-query-engine/src/stores/simple_map_store/legacy/per_key.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl StoreKeyData {
3232
}
3333

3434
/// In-memory storage implementation using per-key locks for concurrency
35-
pub struct SimpleMapStorePerKey {
35+
pub struct LegacySimpleMapStorePerKey {
3636
// Lock-free concurrent outer map - per aggregation_id
3737
store: DashMap<StoreKey, Arc<RwLock<StoreKeyData>>>,
3838

@@ -48,7 +48,7 @@ pub struct SimpleMapStorePerKey {
4848
cleanup_policy: CleanupPolicy,
4949
}
5050

51-
impl SimpleMapStorePerKey {
51+
impl LegacySimpleMapStorePerKey {
5252
pub fn new(streaming_config: Arc<StreamingConfig>, cleanup_policy: CleanupPolicy) -> Self {
5353
Self {
5454
store: DashMap::new(),
@@ -302,7 +302,7 @@ impl SimpleMapStorePerKey {
302302
}
303303

304304
#[async_trait::async_trait]
305-
impl Store for SimpleMapStorePerKey {
305+
impl Store for LegacySimpleMapStorePerKey {
306306
fn insert_precomputed_output(
307307
&self,
308308
output: PrecomputedOutput,
@@ -632,7 +632,7 @@ impl Store for SimpleMapStorePerKey {
632632

633633
fn close(&self) -> StoreResult<()> {
634634
// For in-memory store, no cleanup needed
635-
info!("SimpleMapStorePerKey closed");
635+
info!("LegacySimpleMapStorePerKey closed");
636636
Ok(())
637637
}
638638
}

asap-query-engine/src/stores/simple_map_store/mod.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
mod global;
2-
mod per_key;
1+
pub mod legacy;
32

43
use crate::data_model::{
54
AggregateCore, CleanupPolicy, LockStrategy, PrecomputedOutput, StreamingConfig,
@@ -8,13 +7,13 @@ use crate::stores::{Store, StoreResult, TimestampedBucketsMap};
87
use std::collections::HashMap;
98
use std::sync::Arc;
109

11-
pub use global::SimpleMapStoreGlobal;
12-
pub use per_key::SimpleMapStorePerKey;
10+
pub use legacy::LegacySimpleMapStoreGlobal;
11+
pub use legacy::LegacySimpleMapStorePerKey;
1312

1413
/// Enum wrapper that dispatches to either global or per-key lock implementation
1514
pub enum SimpleMapStore {
16-
Global(SimpleMapStoreGlobal),
17-
PerKey(SimpleMapStorePerKey),
15+
Global(LegacySimpleMapStoreGlobal),
16+
PerKey(LegacySimpleMapStorePerKey),
1817
}
1918

2019
impl SimpleMapStore {
@@ -31,10 +30,10 @@ impl SimpleMapStore {
3130
) -> Self {
3231
match lock_strategy {
3332
LockStrategy::Global => {
34-
SimpleMapStore::Global(SimpleMapStoreGlobal::new(streaming_config, cleanup_policy))
33+
SimpleMapStore::Global(LegacySimpleMapStoreGlobal::new(streaming_config, cleanup_policy))
3534
}
3635
LockStrategy::PerKey => {
37-
SimpleMapStore::PerKey(SimpleMapStorePerKey::new(streaming_config, cleanup_policy))
36+
SimpleMapStore::PerKey(LegacySimpleMapStorePerKey::new(streaming_config, cleanup_policy))
3837
}
3938
}
4039
}

0 commit comments

Comments
 (0)