pub struct NamespacedDhtKey {
pub genesis_prefix: String,
pub key_type: String,
pub name: String,
}Expand description
A governance-namespaced DHT key.
Format: <key_type>:<genesis_prefix>:<name>
This ensures that nodes from different governance clusters never collide in the DHT keyspace.
Fields§
§genesis_prefix: StringGovernance genesis hash prefix (first 16 hex chars).
key_type: StringKey type (svc, node, agent).
name: StringKey name.
Implementations§
Source§impl NamespacedDhtKey
impl NamespacedDhtKey
Sourcepub fn service(genesis_hash: &str, name: &str) -> Self
pub fn service(genesis_hash: &str, name: &str) -> Self
Create a service key: svc:<genesis[0..16]>:<name>.
Sourcepub fn node(genesis_hash: &str, node_id: &str) -> Self
pub fn node(genesis_hash: &str, node_id: &str) -> Self
Create a node presence key: node:<genesis[0..16]>:<node_id>.
Sourcepub fn agent(genesis_hash: &str, agent_id: &str) -> Self
pub fn agent(genesis_hash: &str, agent_id: &str) -> Self
Create an agent key: agent:<genesis[0..16]>:<agent_id>.
Sourcepub fn to_key_string(&self) -> String
pub fn to_key_string(&self) -> String
Format as a string key.
Sourcepub fn from_key_string(s: &str) -> Option<Self>
pub fn from_key_string(s: &str) -> Option<Self>
Parse from a string key.
Sourcepub fn matches_genesis(&self, genesis_hash: &str) -> bool
pub fn matches_genesis(&self, genesis_hash: &str) -> bool
Check if this key belongs to a specific governance cluster.
Trait Implementations§
Source§impl Clone for NamespacedDhtKey
impl Clone for NamespacedDhtKey
Source§impl Debug for NamespacedDhtKey
impl Debug for NamespacedDhtKey
Source§impl<'de> Deserialize<'de> for NamespacedDhtKey
impl<'de> Deserialize<'de> for NamespacedDhtKey
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for NamespacedDhtKey
impl PartialEq for NamespacedDhtKey
Source§impl Serialize for NamespacedDhtKey
impl Serialize for NamespacedDhtKey
impl StructuralPartialEq for NamespacedDhtKey
Auto Trait Implementations§
impl Freeze for NamespacedDhtKey
impl RefUnwindSafe for NamespacedDhtKey
impl Send for NamespacedDhtKey
impl Sync for NamespacedDhtKey
impl Unpin for NamespacedDhtKey
impl UnsafeUnpin for NamespacedDhtKey
impl UnwindSafe for NamespacedDhtKey
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more