pub struct AppState {
pub db: PgPool,
pub repo: Repo,
pub ref_actors: RefActorsMap,
pub initialized_user_states: Arc<RwLock<HashMap<String, DocumentId>>>,
pub http_client: Client,
pub julia_url: Option<String>,
pub openrouter_provisioning_key: Option<String>,
pub openrouter_base_url: String,
}Expand description
Top-level application state.
Cheaply cloneable and intended to be moved around the program.
Fields§
§db: PgPoolConnection to the Postgres database.
repo: RepoAutomerge-repo provider.
ref_actors: RefActorsMapChannel senders for per-ref actors that coordinate document mutations.
initialized_user_states: Arc<RwLock<HashMap<String, DocumentId>>>Tracks user IDs whose state docs were refreshed from DB in this process, mapped to their Automerge document IDs.
http_client: ClientHTTP client for outgoing requests (e.g., Julia proxy).
julia_url: Option<String>Base URL for the Julia compute service, if configured.
openrouter_provisioning_key: Option<String>OpenRouter provisioning key for minting per-user inference keys.
None when OPENROUTER_PROVISIONING_KEY is not set, in which case
inference-related operations return AppError::InferenceUnavailable.
openrouter_base_url: StringBase URL for the OpenRouter key-management API. In production this is the public endpoint; tests override it to point at a mock server.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AppState
impl !RefUnwindSafe for AppState
impl Send for AppState
impl Sync for AppState
impl Unpin for AppState
impl UnsafeUnpin for AppState
impl !UnwindSafe 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<Ctx> FromRequestExtensions<Ctx> for Ctxwhere
Ctx: Send,
impl<Ctx> FromRequestExtensions<Ctx> for Ctxwhere
Ctx: Send,
§async fn from_request_extensions(
ctx: Ctx,
_extensions: Extensions,
) -> Result<Ctx, RpcError>
async fn from_request_extensions( ctx: Ctx, _extensions: Extensions, ) -> Result<Ctx, RpcError>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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