pub struct AqlServerBuilder<S: StorageEngine> { /* private fields */ }Expand description
Server builder for creating AQL service instances.
Configuration is layered via fluent setters. Defaults match
AqlServiceImpl::new(storage) exactly; nothing is spawned until
Self::build runs.
Implementations§
Source§impl<S: StorageEngine + Send + Sync + 'static> AqlServerBuilder<S>
impl<S: StorageEngine + Send + Sync + 'static> AqlServerBuilder<S>
Sourcepub fn with_logging(self, verbosity: LogVerbosity) -> Self
pub fn with_logging(self, verbosity: LogVerbosity) -> Self
Configure request/response logging verbosity.
Returns self for chaining. The stored verbosity can be retrieved via
Self::logging_verbosity so callers can apply a LoggingLayer
around the tonic service.
Sourcepub fn logging_verbosity(&self) -> Option<LogVerbosity>
pub fn logging_verbosity(&self) -> Option<LogVerbosity>
Return the configured logging verbosity (if any).
Sourcepub fn with_slow_threshold_ms(self, ms: u64) -> Self
pub fn with_slow_threshold_ms(self, ms: u64) -> Self
Configure the slow-request threshold (ms) for the LoggingLayer.
Sourcepub fn slow_threshold_ms(&self) -> Option<u64>
pub fn slow_threshold_ms(&self) -> Option<u64>
Return the configured slow-request threshold (if any).
Sourcepub fn with_bind_addr(self, addr: SocketAddr) -> Self
pub fn with_bind_addr(self, addr: SocketAddr) -> Self
Set the gRPC server bind address. Recorded for callers that wire a
tonic Server::bind; this builder does not itself spawn a tonic
server.
Sourcepub fn bind_addr(&self) -> Option<SocketAddr>
pub fn bind_addr(&self) -> Option<SocketAddr>
Return the configured gRPC bind address (if any).
Sourcepub fn with_rate_limit_qps(self, qps: f64) -> Self
pub fn with_rate_limit_qps(self, qps: f64) -> Self
Configure the steady-state QPS for the rate limiter. Recorded for
callers that wire a crate::rate_limiter::RateLimiter.
Sourcepub fn rate_limit_qps(&self) -> Option<f64>
pub fn rate_limit_qps(&self) -> Option<f64>
Return the configured rate-limit QPS (if any).
Sourcepub fn with_jwt_secret_path(self, path: PathBuf) -> Self
pub fn with_jwt_secret_path(self, path: PathBuf) -> Self
Configure the JWT secret path used by the bearer-token auth middleware.
Sourcepub fn jwt_secret_path(&self) -> Option<&Path>
pub fn jwt_secret_path(&self) -> Option<&Path>
Return the configured JWT secret path (if any).
Sourcepub fn with_tls_creds(self, creds: &TlsCredsRef<'_>) -> NetResult<Self>
pub fn with_tls_creds(self, creds: &TlsCredsRef<'_>) -> NetResult<Self>
Install initial TLS credentials for live cert rotation.
Builds a rustls::ServerConfig from creds, wraps it in an
arc_swap::ArcSwap, and stores the handle on the builder. Callers
retrieve the store via Self::tls_config_store and pass it to a
crate::tls_acceptor::LiveTlsAcceptor so each new TLS handshake
reads the latest cert.
§Errors
Returns crate::error::NetError::TlsError if the credentials cannot
be parsed into a rustls::ServerConfig.
Sourcepub fn tls_config_store(&self) -> Option<Arc<ArcSwap<ServerConfig>>>
pub fn tls_config_store(&self) -> Option<Arc<ArcSwap<ServerConfig>>>
Return a clone of the current TLS config store (if installed).
Callers feed this into crate::tls_acceptor::LiveTlsAcceptor::new
to enable per-connection cert pickup; the same store can later be
updated atomically via store.store(Arc::new(new_config)).
Sourcepub fn with_metrics_addr(self, addr: SocketAddr) -> Self
pub fn with_metrics_addr(self, addr: SocketAddr) -> Self
Set the SocketAddr on which the Prometheus metrics HTTP server will
listen. When set, Self::build spawns a background task serving
GET /metrics.
The metrics server runs on a separate port from gRPC so that scrape traffic never reaches the tonic transport.
Sourcepub fn metrics_addr(&self) -> Option<SocketAddr>
pub fn metrics_addr(&self) -> Option<SocketAddr>
Return the configured metrics HTTP address (if any).
Sourcepub fn metrics(&self) -> Arc<NetMetrics>
pub fn metrics(&self) -> Arc<NetMetrics>
Return a clone of the shared crate::metrics_layer::NetMetrics
registry.
Use this to apply crate::metrics_layer::MetricsLayer around the
tonic service so that gRPC request metrics flow into the same registry
that the HTTP endpoint serves.
Sourcepub fn build(self) -> AqlServiceImpl<S>
pub fn build(self) -> AqlServiceImpl<S>
Build the service implementation.
If Self::with_metrics_addr was called, also spawns the Prometheus
HTTP server as a background tokio task. The returned handle is
discarded here; the task runs until the process exits or the tokio
runtime shuts down.
Sourcepub fn build_grpc_service(self) -> AqlServiceServer<AqlGrpcService<S>>
pub fn build_grpc_service(self) -> AqlServiceServer<AqlGrpcService<S>>
Build a tonic-ready gRPC service (wrapped in AqlServiceServer).
When the compression feature is enabled the server is configured to
accept and send gzip-compressed messages.
Auto Trait Implementations§
impl<S> Freeze for AqlServerBuilder<S>
impl<S> !RefUnwindSafe for AqlServerBuilder<S>
impl<S> Send for AqlServerBuilder<S>
impl<S> Sync for AqlServerBuilder<S>
impl<S> Unpin for AqlServerBuilder<S>
impl<S> UnsafeUnpin for AqlServerBuilder<S>
impl<S> !UnwindSafe for AqlServerBuilder<S>
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§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
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.