pub struct NodeRegistry { /* private fields */ }Expand description
In-memory node-id → public-key map.
Cheap to clone — the inner map is wrapped in Arc/DashMap.
Also holds the DerivedWriteGrant table — the mesh-canonical
write-permissions seam. Both tables share the registry’s clone
semantics so a service handed a NodeRegistry clone sees grant
updates the daemon issues mid-boot.
Implementations§
Source§impl NodeRegistry
impl NodeRegistry
Sourcepub fn register(
&self,
pubkey: [u8; 32],
label: Option<String>,
) -> RegisteredNode
pub fn register( &self, pubkey: [u8; 32], label: Option<String>, ) -> RegisteredNode
Register a node. The node-id is derived deterministically from the pubkey — re-registering the same key updates the label but keeps the id stable. Returns the (possibly-updated) entry.
Sourcepub fn get(&self, node_id: &str) -> Option<RegisteredNode>
pub fn get(&self, node_id: &str) -> Option<RegisteredNode>
Look up a node by its id.
Sourcepub fn list(&self) -> Vec<RegisteredNode>
pub fn list(&self) -> Vec<RegisteredNode>
List all registered nodes.
Sourcepub fn issue_derived_grant(
&self,
grantee_node_id: impl Into<String>,
topic: impl Into<String>,
scope: GrantScope,
) -> Result<DerivedWriteGrant, DerivedGrantError>
pub fn issue_derived_grant( &self, grantee_node_id: impl Into<String>, topic: impl Into<String>, scope: GrantScope, ) -> Result<DerivedWriteGrant, DerivedGrantError>
Issue a DerivedWriteGrant permitting grantee_node_id to
publish under the mesh-canonical topic.
MVP authority model. Per R3.6 the daemon issues to itself
in-process; there’s no signature check at this seam. Future
federated grants will add an “issuer signature” arm that
clawft-weave’s RPC boundary will check before this call.
Today, callers are trusted because they had to be inside the
daemon process to reach the registry.
Idempotent: re-issuing a (grantee, topic) pair overwrites
issued_at_ms and scope. Returns the freshly-stored grant.
Sourcepub fn has_derived_grant(&self, grantee_node_id: &str, path: &str) -> bool
pub fn has_derived_grant(&self, grantee_node_id: &str, path: &str) -> bool
Whether grantee_node_id holds a grant covering path.
path must look like substrate/_derived/<topic>/... (or
substrate/_derived/<topic> for GrantScope::ExactTopic).
Anything else returns false. The check is the second half
of the mesh-canonical write gate — the first half is the
substrate/_derived/ tier detection that lives on
crate::SubstrateService::publish_gated_with_grants.
Sourcepub fn list_derived_grants(&self) -> Vec<DerivedWriteGrant>
pub fn list_derived_grants(&self) -> Vec<DerivedWriteGrant>
Snapshot of all currently-issued grants. Test helper / future admin-RPC seam; not intended for hot-path use.
Trait Implementations§
Source§impl Clone for NodeRegistry
impl Clone for NodeRegistry
Source§impl Debug for NodeRegistry
impl Debug for NodeRegistry
Auto Trait Implementations§
impl !RefUnwindSafe for NodeRegistry
impl !UnwindSafe for NodeRegistry
impl Freeze for NodeRegistry
impl Send for NodeRegistry
impl Sync for NodeRegistry
impl Unpin for NodeRegistry
impl UnsafeUnpin for NodeRegistry
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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> ⓘ
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