pub struct AppState {
pub pool: PgPool,
pub read_only: bool,
pub cache: DashboardCache,
pub callback_hmac_secret: Option<[u8; 32]>,
pub poll_interval_ms: u64,
pub metrics: AwaMetrics,
}Fields§
§pool: PgPool§read_only: bool§cache: DashboardCache§callback_hmac_secret: Option<[u8; 32]>§poll_interval_ms: u64Suggested frontend poll interval — at least as long as the cache TTL so clients don’t poll faster than the cache can refresh.
metrics: AwaMetricsCached AwaMetrics handle. AwaMetrics::from_global() rebuilds the
full instrument set on every call, so we construct it once here and
share it across request handlers.
Implementations§
Source§impl AppState
impl AppState
pub fn new( pool: PgPool, read_only: bool, cache_ttl: Duration, callback_hmac_secret: Option<[u8; 32]>, ) -> Self
pub fn require_writable(&self) -> Result<(), ApiError>
Sourcepub fn invalidate_dashboard_caches(&self)
pub fn invalidate_dashboard_caches(&self)
UI mutations change multiple dashboard surfaces, and the server caches those aggregate endpoints independently. Invalidate them as a unit so follow-up reads do not serve stale queue/job state after a mutation.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for AppState
impl !UnwindSafe for AppState
impl Freeze for AppState
impl Send for AppState
impl Sync for AppState
impl Unpin for AppState
impl UnsafeUnpin for AppState
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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>
Converts
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>
Converts
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