pub struct Server { /* private fields */ }server only.Expand description
A running Relay + QAD server.
This is a full Relay server, including QAD, Relay and various associated HTTP services.
Dropping this will stop the server.
Implementations§
Source§impl Server
impl Server
Sourcepub async fn spawn(config: ServerConfig) -> Result<Self, SpawnError>
pub async fn spawn(config: ServerConfig) -> Result<Self, SpawnError>
Starts the server.
Sourcepub async fn shutdown(self) -> Result<(), SupervisorError>
pub async fn shutdown(self) -> Result<(), SupervisorError>
Requests graceful shutdown.
Returns once all server tasks have stopped.
Sourcepub async fn join(&mut self) -> Result<Result<(), SupervisorError>, JoinError>
pub async fn join(&mut self) -> Result<Result<(), SupervisorError>, JoinError>
Waits for the server’s supervisor task to finish.
Returns the exit result of the supervisor task. Unlike Self::shutdown, this does
not request shutdown, it only waits for the server to terminate on its own (for
example, after an internal error or because the supervisor was aborted from
elsewhere). The outer [JoinError] is only produced if the supervisor task itself
panics or is aborted.
Sourcepub fn https_addr(&self) -> Option<SocketAddr>
pub fn https_addr(&self) -> Option<SocketAddr>
The socket address the HTTPS server is listening on.
Sourcepub fn http_addr(&self) -> Option<SocketAddr>
pub fn http_addr(&self) -> Option<SocketAddr>
The socket address the HTTP server is listening on.
Sourcepub fn quic_addr(&self) -> Option<SocketAddr>
pub fn quic_addr(&self) -> Option<SocketAddr>
The socket address the QUIC server is listening on.
Sourcepub fn https_url(&self) -> Option<RelayUrl>
Available on crate feature test-utils only.
pub fn https_url(&self) -> Option<RelayUrl>
test-utils only.Get the server’s https RelayUrl.
This uses Self::https_addr so it’s mostly useful for local development.
Sourcepub fn http_url(&self) -> Option<RelayUrl>
Available on crate feature test-utils only.
pub fn http_url(&self) -> Option<RelayUrl>
test-utils only.Get the server’s http RelayUrl.
This uses Self::http_addr so it’s mostly useful for local development.
Sourcepub fn metrics(&self) -> &RelayMetrics
pub fn metrics(&self) -> &RelayMetrics
Returns the metrics collected in the relay server.
Sourcepub fn relay_service(&self) -> Option<&RelayService>
pub fn relay_service(&self) -> Option<&RelayService>
Returns a handle to the embedded RelayService for runtime control.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Server
impl !RefUnwindSafe for Server
impl Send for Server
impl Sync for Server
impl Unpin for Server
impl !UnwindSafe for Server
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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