pub struct AppState {
pub engine: Engine,
pub sessions: Arc<Mutex<SessionStore>>,
pub task_app: Arc<TaskApplication>,
pub ws_operator_factory: Option<Arc<OperatorSpawnerFactory>>,
pub data_store: Arc<dyn OutputStore>,
pub operator_sessions: Arc<Mutex<HashMap<String, Arc<OperatorSessionEntry>>>>,
pub roles_to_sid: Arc<Mutex<HashMap<String, String>>>,
}Expand description
Shared axum handler state for the whole router. Cloned per-request (all
fields are Arc/cheap-clone), constructed once in build_router_with_ws_factory.
Fields§
§engine: EngineThe engine SoT (attach/detach, dispatch, registries).
sessions: Arc<Mutex<SessionStore>>Live /v1/sessions attach records (Operator/Worker/etc session tokens).
task_app: Arc<TaskApplication>Application used at the task entry to resolve BlueprintRef. Without a Store, runs in Inline-only mode.
ws_operator_factory: Option<Arc<OperatorSpawnerFactory>>When Some, on WS connect a new WSOperatorSession is automatically registered
with this factory under the sid name (= a kind=operator + operator_ref=<sid> AgentDef
binds to the WSOperatorSession backend).
When None, no auto-registration happens; the session is only registered on
engine.OperatorRegistry (= only the OperatorDelegateMiddleware path is effective;
the OperatorSpawnerFactory path is dead).
data_store: Arc<dyn OutputStore>Owner of the Store on the Data path (Big Response handling). Added in v9.
Independent layer — the Engine core and the Domain path (/v1/worker/result)
are not involved.
Default = InMemoryOutputStore (constructed inside build_router_with_ws_factory);
callers can swap in an sqlite/fs backend later (future carry).
operator_sessions: Arc<Mutex<HashMap<String, Arc<OperatorSessionEntry>>>>Login-flow session store (POST /v1/operators mint records). sid →
OperatorSessionEntry. This is the sole session store for the WS
Operator role. See operator_ws::login module doc.
roles_to_sid: Arc<Mutex<HashMap<String, String>>>S1 login-flow roles-exclusivity map. Role name → owning sid. Checked
(and updated) atomically under a single lock in
operator_ws::login::operators_create — a role already present here
causes POST /v1/operators to return 409 CONFLICT. Entries are
released on DELETE /v1/operators/:sid.
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,
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