Skip to content

canmi21/atomhold

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Atomhold

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.

Features

  • Wait-free Reads: Uses arc-swap to 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 tokio to broadcast Loaded, Updated, Removed, or Retained events.
  • Thread Safety: Fully thread-safe, requiring T: Clone + Send + Sync.

Usage Examples

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 using tokio to react to configuration changes in real-time.

Installation

[dependencies]
atomhold = { version = "0.2", features = ["full"] }

Feature Flags

Feature Description
events Enable event broadcasting via tokio::sync::broadcast
full All of the above

License

Released under the MIT License © 2026 Canmi

About

Thread-safe configuration store with atomic replacement, versioning, and flexible unload policies.

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages