pub struct AppState {
pub storage: Arc<dyn Storage>,
pub declared_kbs: Arc<BTreeMap<String, KbSlug>>,
pub access_policies: Arc<BTreeMap<String, Arc<AccessPolicy>>>,
pub kb_details: Arc<BTreeMap<String, KbDetails>>,
pub authenticator: Arc<Authenticator>,
pub max_body_size: u64,
pub max_patchable_size: u64,
pub indexer_tx: Sender<IndexEvent>,
pub searcher: Arc<dyn Searcher>,
pub events: Option<Arc<dyn EventPublisher>>,
pub index_health: Arc<IndexHealth>,
}Expand description
Application state shared across all axum handlers.
This is cloned cheaply for each request (all fields are behind Arc).
Fields§
§storage: Arc<dyn Storage>The backing storage implementation (injected at startup).
declared_kbs: Arc<BTreeMap<String, KbSlug>>Canonical map of slug string → KbSlug for declared knowledge bases.
access_policies: Arc<BTreeMap<String, Arc<AccessPolicy>>>Startup snapshot of manifest access policies, keyed by KB slug.
One Arc per policy so a request-scoped authorization handle can hold
its knowledge base’s policy cheaply instead of borrowing the whole map.
kb_details: Arc<BTreeMap<String, KbDetails>>Startup snapshot of each manifest’s display name and description,
keyed by KB slug: what GET /api/v1/knowledgebases shows (#98).
authenticator: Arc<Authenticator>The credential rules every request’s principal is resolved through.
max_body_size: u64Maximum accepted PUT body size in bytes (16 MiB in M2).
max_patchable_size: u64Maximum object size eligible for patch operations, in bytes.
indexer_tx: Sender<IndexEvent>Sender half of the async indexing queue.
searcher: Arc<dyn Searcher>The search implementation (injected at startup).
events: Option<Arc<dyn EventPublisher>>The object change event log, when NOTEDTHAT_EVENTS_BACKEND selects one.
None is the default: writes are not announced and the events route
answers 404.
index_health: Arc<IndexHealth>The per-knowledge-base index health record, shared with the indexer worker and every write path (#97).
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
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,
impl<T> ErasedDestructor for Twhere
T: 'static,
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::Request