pub struct AppState {
pub config: Arc<Config>,
pub db: Pool,
pub http: Client,
pub sidecar: SidecarClient,
pub sessions: SessionRegistry,
}Expand description
Shared application state handed to every axum handler.
Holds the resolved Config, the SQLite pool, a shared reqwest::Client
(feed fetch + sidecar calls), the SidecarClient (the live atproto
com.atproto.repo.* path), and the in-memory SessionRegistry (DID ↔
handle, resolved via the sidecar’s /internal/session). It is Clone (cheap
— everything is behind Arc/handles) and is cloned into each request. It
lives in the library so both web and the featherreader binary share it.
Fields§
§config: Arc<Config>Immutable runtime configuration.
db: PoolThe per-DID SQLite cache pool.
http: ClientShared HTTP client (feed fetch + sidecar internal API).
sidecar: SidecarClientThe atproto OAuth sidecar client — the live repo-op path.
sessions: SessionRegistryDID ↔ handle session registry (cookie-resolved identity).
Implementations§
Source§impl AppState
impl AppState
Sourcepub fn new(config: Config, db: Pool) -> Result<Self>
pub fn new(config: Config, db: Pool) -> Result<Self>
Assemble the shared state from config + an initialized store pool.
Builds the shared HTTP client and the SidecarClient from the config’s
crate::config::SidecarConfig, and starts with an empty session
registry. The binary’s main calls this after opening the store.
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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