Thread-safe configuration store with atomic replacement, versioning, and flexible unload policies.
atomhold provides a robust, concurrent key-value store designed for managing configuration states in multi-threaded applications. It leverages RCU (Read-Copy-Update) semantics for wait-free reads and ensures atomic consistency for updates.
- Wait-free Reads: Uses
arc-swapto allow concurrent lock-free access to configuration entries. - Atomic Updates: Ensures consistent snapshots during updates; readers never see partial states.
- Flexible Unload Policies:
Removable: Entries can be updated or removed freely.Persistent: Entries are protected against accidental removal, ensuring critical configs remain available.
- Versioning: Automatically tracks version numbers and timestamps for every entry.
- Change Events: Optional integration with
tokioto broadcastLoaded,Updated,Removed, orRetainedevents. - Thread Safety: Fully thread-safe, requiring
T: Clone + Send + Sync.
Check the examples directory for runnable code:
- Basic Usage:
examples/basic.rs- Demonstrates inserting, retrieving, and removing configurations with different unload policies. - Event Broadcasting:
examples/events.rs- Asynchronous event subscription example usingtokioto react to configuration changes in real-time.
[dependencies]
atomhold = { version = "0.2", features = ["full"] }| Feature | Description |
|---|---|
events |
Enable event broadcasting via tokio::sync::broadcast |
full |
All of the above |
Released under the MIT License © 2026 Canmi