pub struct AppContext { /* private fields */ }Expand description
Application-wide runtime container shared across the HTTP server, the scheduler, and CLI commands.
Every field is an Arc (or an Arc-internal handle such as DbPool),
so clone is a reference-count bump rather than a deep copy; the type is
designed to be cloned freely into request handlers, jobs, and spawned
tasks. Construct it via AppContext::builder (or AppContext::new for
the default build); AppContext::from_parts bypasses the bootstrap and
is intended for tests and embedders that assemble the parts themselves.
Some handles are optional: geoip_reader,
content_config, fingerprint_repo, and user_service are None when
the corresponding resource is absent or failed to initialise, and callers
must degrade gracefully rather than assume presence.
Implementations§
Source§impl AppContext
impl AppContext
Sourcepub async fn new() -> RuntimeResult<Self>
pub async fn new() -> RuntimeResult<Self>
Builds a context with default settings: schema installation off,
extensions discovered via inventory, and the inventory-registered
marketplace filter. Equivalent to Self::builder().build().await.
pub fn builder() -> AppContextBuilder
Sourcepub fn from_parts(parts: AppContextParts) -> Self
pub fn from_parts(parts: AppContextParts) -> Self
Assembles a context directly from pre-built parts, bypassing the
AppContextBuilder bootstrap. Intended for tests and embedders that
own the construction of the individual handles.
pub fn load_geoip_database( config: &Config, show_warnings: bool, ) -> Option<GeoIpReader>
pub fn load_content_config( config: &Config, app_paths: &AppPaths, ) -> Option<Arc<ContentConfigRaw>>
pub fn config(&self) -> &Config
pub fn content_config(&self) -> Option<&ContentConfigRaw>
pub fn content_routing(&self) -> Option<Arc<dyn ContentRouting>>
pub const fn db_pool(&self) -> &DbPool
pub const fn database(&self) -> &DbPool
pub fn api_registry(&self) -> &ModuleApiRegistry
pub fn extension_registry(&self) -> &ExtensionRegistry
pub fn server_address(&self) -> String
pub const fn geoip_reader(&self) -> Option<&GeoIpReader>
pub const fn analytics_service(&self) -> &Arc<AnalyticsService>
pub const fn route_classifier(&self) -> &Arc<RouteClassifier>
pub fn app_paths(&self) -> &AppPaths
pub const fn app_paths_arc(&self) -> &Arc<AppPaths>
pub fn marketplace_filter(&self) -> &Arc<dyn MarketplaceFilter>
pub const fn event_bridge(&self) -> &Arc<OnceLock<JoinHandle<()>>>
pub fn system_admin(&self) -> &SystemAdmin
pub const fn mcp_registry(&self) -> &RegistryService
pub const fn authz_hook(&self) -> &SharedAuthzHook
Trait Implementations§
Source§impl AppContext for AppContext
impl AppContext for AppContext
fn config(&self) -> Arc<dyn ConfigProvider>
fn database_handle(&self) -> Arc<dyn DatabaseHandle>
fn analytics_provider(&self) -> Option<Arc<dyn AnalyticsProvider>>
fn fingerprint_provider(&self) -> Option<Arc<dyn FingerprintProvider>>
fn user_provider(&self) -> Option<Arc<dyn UserProvider>>
Source§impl Clone for AppContext
impl Clone for AppContext
Source§fn clone(&self) -> AppContext
fn clone(&self) -> AppContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AppContext
impl Debug for AppContext
Source§impl ExtensionContext for AppContext
impl ExtensionContext for AppContext
Source§impl HasAnalytics for AppContext
impl HasAnalytics for AppContext
Source§impl HasFingerprint for AppContext
impl HasFingerprint for AppContext
type Fingerprint = Arc<FingerprintRepository>
fn fingerprint(&self) -> Option<&Self::Fingerprint>
Source§impl HasRouteClassifier for AppContext
impl HasRouteClassifier for AppContext
type RouteClassifier = Arc<RouteClassifier>
fn route_classifier(&self) -> &Self::RouteClassifier
Source§impl HasUserService for AppContext
impl HasUserService for AppContext
type UserService = Arc<UserService>
fn user_service(&self) -> Option<&Self::UserService>
Auto Trait Implementations§
impl Freeze for AppContext
impl !RefUnwindSafe for AppContext
impl Send for AppContext
impl Sync for AppContext
impl Unpin for AppContext
impl UnsafeUnpin for AppContext
impl !UnwindSafe for AppContext
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
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 more