pub struct AppState {
pub map_tile_cache: Arc<Mutex<MapTileCache>>,
pub region_cache: Arc<Mutex<RegionNameToGridCoordinatesCache>>,
pub jobs: Arc<JobStore>,
pub config: Arc<Config>,
pub db: SqlitePool,
pub cookie_key: Key,
pub library_cleanup_dirty: Arc<AtomicBool>,
pub glw_event_cache: Arc<Mutex<GlwEventCache>>,
pub fonts: Arc<FontDirectory>,
}Expand description
State shared between all axum handlers.
The two cache types both require &mut self to drive lookups, so they
are wrapped in async Mutexes. As a side effect this serialises
renders to one at a time; that is acceptable for v1 because each render
is also bounded by the upstream rate limiter.
Fields§
§map_tile_cache: Arc<Mutex<MapTileCache>>the on-disk + in-memory cache of map tiles, shared with the CLI.
region_cache: Arc<Mutex<RegionNameToGridCoordinatesCache>>the region name <-> grid coordinates cache.
jobs: Arc<JobStore>the in-memory store of running and recently completed render jobs.
config: Arc<Config>the runtime configuration.
db: SqlitePoolSQLite pool used by the auth subsystem (users, sessions, set-password tokens). Cheap to clone.
signing key for the session cookie, derived from the configured
session_signing_key at startup. Key is internally a buffer of
bytes; cloning is cheap.
library_cleanup_dirty: Arc<AtomicBool>in-process flag raised whenever a code path may have produced stale
files under <storage_dir>/renders/ without unlinking them inline
(e.g. a cascade delete from removing a group). The orphan sweeper
only scans the filesystem when this flag is set so an idle server
does no filesystem work.
glw_event_cache: Arc<Mutex<GlwEventCache>>three-tier cache (memory LRU + redb + http-cache-semantics) for
GLW events. Created at startup from config.cache_dir like the
CLI does. Used by render workers when a render requests a GLW
overlay via event id or event key.
fonts: Arc<FontDirectory>fonts discovered under config.fonts_directory at startup.
Surfaced through GET /api/fonts and used by render workers to
resolve a client-supplied font_id to the font file path.
Trait Implementations§
Source§impl FromRequestParts<AppState> for CurrentUser
impl FromRequestParts<AppState> for CurrentUser
Source§impl FromRequestParts<AppState> for LslBearer
impl FromRequestParts<AppState> for LslBearer
Source§impl FromRequestParts<AppState> for ClientIp
impl FromRequestParts<AppState> for ClientIp
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.