pub struct NodeHash { /* private fields */ }Expand description
Hash-based node identifier for efficient lookup.
NodeHash uses FNV-1a hashing to convert node IDs into fixed-size
hash values for efficient cache lookups. It also supports a wildcard
value for broadcast scenarios.
§Example
use xds_core::NodeHash;
let node1 = NodeHash::from_id("envoy-node-1");
let node2 = NodeHash::from_id("envoy-node-2");
let wildcard = NodeHash::wildcard();
assert_ne!(node1, node2);
assert!(wildcard.is_wildcard());Implementations§
Source§impl NodeHash
impl NodeHash
Sourcepub fn from_id(node_id: &str) -> Self
pub fn from_id(node_id: &str) -> Self
Create a node hash from a node ID string.
Uses FNV-1a hashing for fast, well-distributed hashes.
Sourcepub fn wildcard() -> Self
pub fn wildcard() -> Self
Create a wildcard node hash that matches all nodes.
This is used when you want to set a snapshot that applies to all nodes that don’t have a specific snapshot.
Sourcepub fn is_wildcard(&self) -> bool
pub fn is_wildcard(&self) -> bool
Check if this is a wildcard hash.
Trait Implementations§
impl Copy for NodeHash
impl Eq for NodeHash
impl StructuralPartialEq for NodeHash
Auto Trait Implementations§
impl Freeze for NodeHash
impl RefUnwindSafe for NodeHash
impl Send for NodeHash
impl Sync for NodeHash
impl Unpin for NodeHash
impl UnsafeUnpin for NodeHash
impl UnwindSafe for NodeHash
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request