| Crates.io | armature-distributed |
| lib.rs | armature-distributed |
| version | 0.1.1 |
| created_at | 2025-12-27 00:51:59.425827+00 |
| updated_at | 2025-12-30 22:28:06.1421+00 |
| description | Distributed systems primitives for Armature |
| homepage | https://pegasusheavy.github.io/armature |
| repository | https://github.com/pegasusheavy/armature |
| max_upload_size | |
| id | 2006508 |
| size | 58,257 |
Distributed system primitives for the Armature framework.
[dependencies]
armature-distributed = "0.1"
use armature_distributed::DistributedLock;
let lock = DistributedLock::redis("redis://localhost:6379").await?;
// Acquire lock
let guard = lock.acquire("resource-key", Duration::from_secs(30)).await?;
// Do exclusive work...
// Lock released when guard is dropped
use armature_distributed::LeaderElection;
let election = LeaderElection::redis("redis://localhost:6379").await?;
election.run("my-service", || async {
// This only runs on the leader
process_jobs().await
}).await?;
use armature_distributed::DistributedRateLimiter;
let limiter = DistributedRateLimiter::redis(
"redis://localhost:6379",
100, // requests
Duration::from_secs(60), // window
).await?;
if limiter.check("user:123").await? {
// Allow request
}
MIT OR Apache-2.0