pub enum Routing<'a> {
Owned,
Misdirected {
target: &'a str,
},
Unknown,
}Expand description
Result of an crate::OwnershipTable::route lookup. Borrows the
writer/target ids out of the table — caller copies only when it
needs to log or encode them.
Variants§
Owned
self_node_id is the declared writer (or active fallback) for
the matching scope. Execute the write locally.
Misdirected
Another node owns this write. The cement layer encodes
-MISDIRECTED writer is <writer> to the wire so the client
can follow. The target field is the node id — the server
resolves that to host:port from its peer table at encode
time (kevy-scope intentionally doesn’t carry peer addrs).
Unknown
No scope matched. Default policy is “accept locally” — the scope system is opt-in, so keys outside declared scopes behave like the pre-Phase-3 keyspace.
Implementations§
Source§impl Routing<'_>
impl Routing<'_>
Sourcepub fn is_local_writer(&self) -> bool
pub fn is_local_writer(&self) -> bool
true when the current node owns the write.
Sourcepub fn is_misdirected(&self) -> bool
pub fn is_misdirected(&self) -> bool
true for the -MISDIRECTED branch.
Sourcepub fn misdirected_target(&self) -> Option<&str>
pub fn misdirected_target(&self) -> Option<&str>
Some(target) for Misdirected, else None. Convenience for
the cement layer’s RESP encoder.