pub struct ServerRegistry { /* private fields */ }Expand description
Process-global registry mapping (host, port) → running Axum server handle.
Implementations§
Source§impl ServerRegistry
impl ServerRegistry
Sourcepub async fn get_or_spawn(
&'static self,
host: &str,
port: u16,
max_request_body: usize,
max_response_body: usize,
max_inflight_requests: usize,
runtime: Arc<dyn RuntimeObservability>,
route_id: String,
tls_config: Option<ServerTlsConfig>,
) -> Result<HttpRouteRegistry, CamelError>
pub async fn get_or_spawn( &'static self, host: &str, port: u16, max_request_body: usize, max_response_body: usize, max_inflight_requests: usize, runtime: Arc<dyn RuntimeObservability>, route_id: String, tls_config: Option<ServerTlsConfig>, ) -> Result<HttpRouteRegistry, CamelError>
Returns route registry for port, spawning new Axum server if
none is running on that port yet.
Sourcepub async fn get_or_spawn_with_listener(
&'static self,
listener: TcpListener,
max_request_body: usize,
max_response_body: usize,
max_inflight_requests: usize,
runtime: Arc<dyn RuntimeObservability>,
route_id: String,
tls_config: Option<ServerTlsConfig>,
) -> Result<HttpRouteRegistry, CamelError>
pub async fn get_or_spawn_with_listener( &'static self, listener: TcpListener, max_request_body: usize, max_response_body: usize, max_inflight_requests: usize, runtime: Arc<dyn RuntimeObservability>, route_id: String, tls_config: Option<ServerTlsConfig>, ) -> Result<HttpRouteRegistry, CamelError>
Like ServerRegistry::get_or_spawn, but serves listener instead
of binding host:port. The registry key is derived from the listener’s
actual local address, so callers must query that port afterwards. If an
entry for the key already holds a live server, the same compatibility
checks as get_or_spawn apply and the entry is reused; the passed
listener is simply dropped.
Sourcepub async fn stage_listener(
&'static self,
listener: TcpListener,
) -> Result<(), CamelError>
pub async fn stage_listener( &'static self, listener: TcpListener, ) -> Result<(), CamelError>
Stage a pre-bound listener so the next get_or_spawn for its
(ip, port) key serves this socket instead of binding a new one.
The staged listener is consumed by exactly one spawn: the exact-key
get_or_spawn takes it under the registry lock, eliminating the bind
window between a port probe and server startup (itest-bound-ports).
Sourcepub fn bound_addr(&'static self, host: &str, port: u16) -> Option<SocketAddr>
pub fn bound_addr(&'static self, host: &str, port: u16) -> Option<SocketAddr>
Returns the bound address of the live server entry for (host, port),
if one is initialized.
Sourcepub async fn unregister(&self, host: &str, port: u16)
pub async fn unregister(&self, host: &str, port: u16)
Unregister one consumer from a server. HTTP servers are process-lifetime: the server stays in the registry for potential restart. Path deregistration happens separately in the consumer’s cleanup.
Auto Trait Implementations§
impl !Freeze for ServerRegistry
impl RefUnwindSafe for ServerRegistry
impl Send for ServerRegistry
impl Sync for ServerRegistry
impl Unpin for ServerRegistry
impl UnsafeUnpin for ServerRegistry
impl UnwindSafe for ServerRegistry
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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