Skip to content

Commit 5383da7

Browse files
committed
Add Store - process-owned concurrent key-value storage
Implements ETS-like typed key-value storage for Ambitious: - Store<K, V> with typed, concurrent HashMap semantics - Process ownership with automatic cleanup on owner exit - Public/Private access control - Named store registration with whereis() lookup - Heir support for fault-tolerant ownership transfer - Full CRUD operations: insert, get, remove, update, etc. - Bulk operations: insert_many, keys, values, iter, retain, clear The Store integrates with the runtime's process exit handling to automatically clean up stores when their owner terminates, or transfer ownership to an heir process if configured.
1 parent 9bca230 commit 5383da7

4 files changed

Lines changed: 977 additions & 0 deletions

File tree

crates/ambitious/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@ pub mod pubsub;
166166
/// Timer module for scheduling delayed and repeated operations.
167167
pub mod timer;
168168

169+
/// Process-owned concurrent key-value storage (ETS-like).
170+
pub mod store;
171+
169172
/// Peer node management for spawning and controlling linked nodes.
170173
///
171174
/// This module is only available when the `peer` feature is enabled.
@@ -242,6 +245,9 @@ pub mod prelude {
242245

243246
// Timer essentials
244247
pub use crate::timer::{TimerError, TimerRef, TimerResult};
248+
249+
// Store essentials
250+
pub use crate::store::{Access, Store, StoreError, StoreId, StoreOptions};
245251
}
246252

247253
#[cfg(test)]

crates/ambitious/src/process/runtime.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,9 @@ impl RuntimeHandle {
243243
.notify_local_process_down(pid, &reason);
244244
}
245245

246+
// Clean up any stores owned by this process
247+
crate::store::cleanup_owned_stores(pid, &reason);
248+
246249
// Unregister the process
247250
registry.unregister(pid);
248251
}

0 commit comments

Comments
 (0)