pub struct ServiceRegistry { /* private fields */ }Expand description
Service registry backed by the NDN namespace.
Services advertise under /local/services/<name>/info (capabilities)
and /local/services/<name>/alive (heartbeat with short FreshnessPeriod).
Discovery is a CanBePrefix Interest for /local/services.
This in-memory implementation is used for testing and single-process deployments.
A production implementation would publish and fetch Data packets via the engine.
Implementations§
Source§impl ServiceRegistry
impl ServiceRegistry
pub fn new() -> Self
Sourcepub fn register(&mut self, name: impl Into<String>, capabilities: Bytes)
pub fn register(&mut self, name: impl Into<String>, capabilities: Bytes)
Advertise name with the given capabilities blob.
Sourcepub fn lookup(&self, name: &str) -> Option<&ServiceEntry>
pub fn lookup(&self, name: &str) -> Option<&ServiceEntry>
Look up a registered service by name.
Sourcepub fn unregister(&mut self, name: &str) -> bool
pub fn unregister(&mut self, name: &str) -> bool
Remove a service. Returns true if it was registered.
pub fn service_count(&self) -> usize
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ServiceRegistry
impl RefUnwindSafe for ServiceRegistry
impl Send for ServiceRegistry
impl Sync for ServiceRegistry
impl Unpin for ServiceRegistry
impl UnwindSafe for ServiceRegistry
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