pub struct ServerState {
pub sites: HashMap<String, SiteBackend>,
pub console_inactivity_timeout: Duration,
pub auditor: Option<Kafka>,
pub auth_rate_limit_per_minute: Option<u32>,
}Expand description
Shared state for all HTTP handlers.
Holds one SiteBackend per configured site so that the server can serve
multiple clusters. Each request supplies the target site via the
X-Manta-Site header; handlers call ServerState::infra_context to
retrieve the per-site data.
Fields§
§sites: HashMap<String, SiteBackend>Per-site connection data, keyed by site name.
console_inactivity_timeout: DurationHow long a WebSocket console session may be idle before the server closes it. Protects against leaked Kubernetes pod attachments.
auditor: Option<Kafka>Kafka producer for security/audit events (currently used only by
/api/v1/auth/*). None disables audit emission.
auth_rate_limit_per_minute: Option<u32>Per-source-IP rate limit on /api/v1/auth/* (requests/minute).
None disables in-process rate limiting.
Implementations§
Source§impl ServerState
impl ServerState
Sourcepub fn infra_context<'a>(
&'a self,
site_name: &'a str,
) -> Result<InfraContext<'a>, Error>
pub fn infra_context<'a>( &'a self, site_name: &'a str, ) -> Result<InfraContext<'a>, Error>
Build a borrowed InfraContext for the named site.
Returns Err(Error::NotFound) when site_name is not in the map.
Called per-request so the service layer can work with its existing
&InfraContext<'_> API.
Auto Trait Implementations§
impl !Freeze for ServerState
impl !RefUnwindSafe for ServerState
impl Send for ServerState
impl Sync for ServerState
impl Unpin for ServerState
impl !UnwindSafe for ServerState
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