Expand description
Node-local hinted-handoff store.
When a write request fans out to a peer in
crate::cluster::peer::PeerState::Down or to a peer whose
outbound channel is closed, the dispatcher records a hint:
the on-the-wire request bytes, the index of the intended
peer, and an absolute expiry deadline. A background task
periodically:
- drains hints destined for any peer that has returned to
crate::cluster::peer::PeerState::Normaland ships them over the same per-peer outbound channel the dispatcher would have used; - drops hints that have aged past their
hint_ttl_secondsso the in-memory store stays bounded.
The v1 store is RAM-only. The natural follow-up is an
on-disk variant (one segment file per peer, replayed at
startup); see docs/journal/2026-05-23-hinted-handoff.md
for the deferral note.
§Examples
use std::time::{Duration, Instant};
use dynomite::cluster::hints::HintStore;
let store = HintStore::new(1024);
store.enqueue(7, b"*3\r\n$3\r\nSET\r\n$1\r\nk\r\n$1\r\nv\r\n".to_vec(), Duration::from_secs(60))
.expect("under capacity");
let drained = store.take_for(7);
assert_eq!(drained.len(), 1);
assert_eq!(store.expire_now(Instant::now()), 0);Structs§
- Hint
- One pending hint.
- Hint
Store - Node-local hint store.
- Hint
Store Stats - Snapshot of the store’s current size.
Enums§
- Hint
Store Error - Errors produced by
HintStore::enqueue.