pub struct EndpointRegistry { /* private fields */ }Expand description
Centralized endpoint registry with self-registration.
Supports services with multiple socket types (REP, ROUTER, PUB, etc.).
§Warning
Do NOT hold the guard from global() across .await points.
Clone needed data before awaiting:
let endpoint = global().endpoint("foo", SocketType::REP); // Clone the TransportConfig
some_async_call().await; // Lock releasedImplementations§
Source§impl EndpointRegistry
impl EndpointRegistry
Sourcepub fn new(mode: EndpointMode, runtime_dir: Option<PathBuf>) -> Self
pub fn new(mode: EndpointMode, runtime_dir: Option<PathBuf>) -> Self
Create a new registry with the specified mode and runtime directory.
§Arguments
mode- Transport mode (Inproc, Ipc, or Tcp)runtime_dir- Base directory for IPC sockets (required for Ipc mode)
Sourcepub fn register(
&self,
name: &str,
socket_kind: SocketKind,
endpoint: TransportConfig,
description: Option<&str>,
)
pub fn register( &self, name: &str, socket_kind: SocketKind, endpoint: TransportConfig, description: Option<&str>, )
Register a service endpoint for a specific socket type.
Called by services on startup to advertise their endpoints.
Sourcepub fn endpoint(&self, name: &str, socket_kind: SocketKind) -> TransportConfig
pub fn endpoint(&self, name: &str, socket_kind: SocketKind) -> TransportConfig
Get endpoint for a service and socket type.
Returns the registered endpoint if available, otherwise generates a local default for REP/REQ based on the current mode and socket type.
§Panics
Panics for socket kinds that have no local default, such as
SocketKind::Quic. New resolver code should prefer
Self::try_endpoint so missing network reach is a normal error.
Sourcepub fn try_endpoint(
&self,
name: &str,
socket_kind: SocketKind,
) -> Result<TransportConfig>
pub fn try_endpoint( &self, name: &str, socket_kind: SocketKind, ) -> Result<TransportConfig>
Try to get endpoint for a service and socket type.
Registered endpoints are returned as-is. Missing REP/REQ endpoints keep
the historical local fallback (inproc or same-host UDS), while missing
QUIC/network endpoints fail closed instead of synthesizing a placeholder.
Sourcepub fn registered_endpoint(
&self,
name: &str,
socket_kind: SocketKind,
) -> Option<TransportConfig>
pub fn registered_endpoint( &self, name: &str, socket_kind: SocketKind, ) -> Option<TransportConfig>
Get an explicitly registered endpoint without applying any profile fallback.
Source§impl EndpointRegistry
impl EndpointRegistry
Sourcepub fn register_rep(
&self,
name: &str,
endpoint: TransportConfig,
description: Option<&str>,
)
pub fn register_rep( &self, name: &str, endpoint: TransportConfig, description: Option<&str>, )
Register a REP endpoint (most common case, backward compatible).
Sourcepub fn rep_endpoint(&self, name: &str) -> TransportConfig
pub fn rep_endpoint(&self, name: &str) -> TransportConfig
Get REP endpoint for a service (backward compatible).
Equivalent to endpoint(name, SocketKind::Rep).
Sourcepub fn mode(&self) -> EndpointMode
pub fn mode(&self) -> EndpointMode
Get the current endpoint mode.
Sourcepub fn runtime_dir(&self) -> Option<&PathBuf>
pub fn runtime_dir(&self) -> Option<&PathBuf>
Get the runtime directory (if set).
Sourcepub fn list_services(&self) -> Vec<String>
pub fn list_services(&self) -> Vec<String>
List all registered services.
Sourcepub fn service_entry(&self, name: &str) -> Option<ServiceEntry>
pub fn service_entry(&self, name: &str) -> Option<ServiceEntry>
Get a clone of a service entry by name.
Sourcepub fn service_endpoints(
&self,
name: &str,
) -> Option<HashMap<SocketKind, TransportConfig>>
pub fn service_endpoints( &self, name: &str, ) -> Option<HashMap<SocketKind, TransportConfig>>
Get all endpoints for a service.
Sourcepub fn register_with_schema(
&self,
name: &str,
socket_kind: SocketKind,
endpoint: TransportConfig,
description: Option<&str>,
schema: Option<&'static [u8]>,
)
pub fn register_with_schema( &self, name: &str, socket_kind: SocketKind, endpoint: TransportConfig, description: Option<&str>, schema: Option<&'static [u8]>, )
Register a service endpoint with schema bytes.
Sourcepub fn service_schema(&self, name: &str) -> Option<&'static [u8]>
pub fn service_schema(&self, name: &str) -> Option<&'static [u8]>
Get schema bytes for a service (if registered with a schema).
Trait Implementations§
Source§impl Resolver for EndpointRegistry
impl Resolver for EndpointRegistry
Auto Trait Implementations§
impl !Freeze for EndpointRegistry
impl !RefUnwindSafe for EndpointRegistry
impl Send for EndpointRegistry
impl Sync for EndpointRegistry
impl Unpin for EndpointRegistry
impl UnsafeUnpin for EndpointRegistry
impl UnwindSafe for EndpointRegistry
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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