Expand description
Idempotency tracking system Idempotency key tracking system
Ensures scraping operations can be safely retried without re-executing expensive work. Each operation is tagged with a ULID-based key; results are stored in the cache with configurable TTL (default 24 h).
§Example
use stygian_graph::domain::idempotency::{IdempotencyKey, IdempotencyStore};
use stygian_graph::adapters::cache::MemoryCache;
use stygian_graph::ports::ServiceOutput;
use serde_json::json;
use std::sync::Arc;
let cache = Arc::new(MemoryCache::new());
let store = IdempotencyStore::new(cache);
let key = IdempotencyKey::generate();
let result = ServiceOutput { data: "page html".into(), metadata: json!({}) };
store.store(key, result.clone(), None).await.unwrap();
let cached = store.get(key).await.unwrap();
assert!(cached.is_some());Structs§
- Cached
Output - Serializable version of
ServiceOutputfor cache storage - Idempotency
Key - An idempotency key for a scraping operation.
- Idempotency
Record - A stored idempotency record.
- Idempotency
Store - Cache-backed store for idempotency records.
Enums§
- Operation
Status - Status of an idempotent operation
Constants§
- DEFAULT_
TTL - Default time-to-live for idempotency records (24 hours)
- MAX_TTL
- Maximum time-to-live for idempotency records (72 hours)