pub struct Scope { /* private fields */ }Expand description
One scope declaration: a key-prefix slice owned by writer, with
an optional fallback server that takes over writes when the
writer is flagged DOWN by kevy-elect.
The prefix is Vec<u8> (not String) because keys are arbitrary
bytes in kevy; restricting to UTF-8 would be a stricter contract
than the RESP wire offers.
Implementations§
Source§impl Scope
impl Scope
Sourcepub fn new(prefix: Vec<u8>, writer: String) -> Self
pub fn new(prefix: Vec<u8>, writer: String) -> Self
Build a minimal scope: prefix + writer. Add a fallback via
Self::with_fallback if F4 is in play.
Sourcepub fn with_fallback(self, fallback: String) -> Self
pub fn with_fallback(self, fallback: String) -> Self
Declare a fallback node-id. When the writer is flagged DOWN by
kevy-elect, the fallback starts accepting writes for this
scope (F4). The fallback is one specific server — not “any
alive node” — so its identity is operator-visible and not the
cluster’s discretion.
Sourcepub fn prefix(&self) -> &[u8] ⓘ
pub fn prefix(&self) -> &[u8] ⓘ
Key-prefix slice this scope owns. Lifetime tied to the scope (not a clone) so longest-prefix routing avoids allocation per lookup.