pub struct AppState {
pub store: Arc<dyn RunStore>,
pub user_store: Arc<dyn UserStore>,
pub engine: Arc<Engine>,
pub jwt_config: Arc<JwtConfig>,
pub worker_token: String,
}Expand description
Global application state.
Holds the shared run store and engine, extracted by handlers using Axum’s state extraction mechanism.
§Examples
use ironflow_api::state::AppState;
use ironflow_auth::jwt::JwtConfig;
use ironflow_store::prelude::*;
use ironflow_engine::engine::Engine;
use ironflow_core::providers::claude::ClaudeCodeProvider;
use std::sync::Arc;
let store = Arc::new(InMemoryStore::new());
let user_store: Arc<dyn UserStore> = Arc::new(InMemoryStore::new());
let provider = Arc::new(ClaudeCodeProvider::new());
let engine = Arc::new(Engine::new(store.clone(), provider));
let jwt_config = Arc::new(JwtConfig {
secret: "secret".to_string(),
access_token_ttl_secs: 900,
refresh_token_ttl_secs: 604800,
cookie_domain: None,
cookie_secure: false,
});
let state = AppState { store, user_store, engine, jwt_config, worker_token: "token".to_string() };Fields§
§store: Arc<dyn RunStore>The backing store for runs and steps.
user_store: Arc<dyn UserStore>The backing store for users.
engine: Arc<Engine>The workflow orchestration engine.
jwt_config: Arc<JwtConfig>JWT configuration for auth tokens.
worker_token: StringStatic token for worker-to-API authentication.
Implementations§
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
Mutably borrows from an owned value. Read more