Skip to main content

Module registry

Module registry 

Source
Expand description

Centralized endpoint registry for service discovery.

This module provides:

  • EndpointMode for determining transport type (inproc, ipc, tcp)
  • SocketKind for identifying RPC socket types (implements Hash)
  • EndpointRegistry for service endpoint management (supports multiple socket types)
  • ServiceRegistration RAII guard for automatic cleanup

§Usage

ⓘ
use hyprstream_rpc::registry::{init, global, EndpointMode, SocketKind, ServiceRegistration};

// Initialize at startup
init(EndpointMode::Ipc, Some(runtime_dir));

// Services self-register (single endpoint, backward compatible)
let _reg = ServiceRegistration::new("policy", endpoint, None)?;

// Services with multiple endpoints
let _reg = ServiceRegistration::multi("model", vec![
    (SocketKind::Rep, rep_endpoint),
    (SocketKind::Quic, quic_endpoint),
], None)?;

// Clients discover local endpoints by socket type
let rep_endpoint = global().endpoint("model", SocketKind::Rep);
let quic_endpoint = global().try_endpoint("model", SocketKind::Quic)?;

Structs§

EndpointRegistry
Centralized endpoint registry with self-registration.
IpcResolver
Explicit IPC resolver profile.
LocalInprocResolver
Explicit single-process resolver profile.
ServiceEntry
Service registration entry with multiple endpoints by socket type.
ServiceRegistration
RAII guard for service registration.

Enums§

EndpointMode
Endpoint mode determines default transport type.
SocketKind
Socket type identifier for endpoint registration.

Functions§

global
Get the global registry.
init
Initialize the global endpoint registry.
shutdown
Shutdown the global registry.
try_global
Try to get the global registry (non-panicking).