pub struct AppState {
pub storage: StorageManager,
pub orchestrator: Orchestrator,
pub memory_repo: MemoryRepository,
pub namespace_repo: NamespaceRepository,
pub ws_sender: Sender<WebSocketMessage>,
pub start_time: Instant,
pub agent_supervisor: Option<AgentSupervisor>,
}Expand description
Shared application state
Fields§
§storage: StorageManagerStorage manager for database operations
orchestrator: OrchestratorOrchestrator for event handling
memory_repo: MemoryRepositoryMemory repository
namespace_repo: NamespaceRepositoryNamespace repository
ws_sender: Sender<WebSocketMessage>WebSocket broadcaster
start_time: InstantServer start time for uptime calculation
agent_supervisor: Option<AgentSupervisor>Optional agent supervisor (set when –agent flag is used)
Implementations§
Source§impl AppState
impl AppState
Sourcepub async fn new(
storage: StorageManager,
orchestrator: Orchestrator,
) -> Result<Self>
pub async fn new( storage: StorageManager, orchestrator: Orchestrator, ) -> Result<Self>
Create a new application state
Sourcepub fn pool(&self) -> &SqlitePool
pub fn pool(&self) -> &SqlitePool
Get the database pool
Sourcepub fn uptime_seconds(&self) -> u64
pub fn uptime_seconds(&self) -> u64
Get uptime in seconds
Sourcepub fn subscribe_ws(&self) -> Receiver<WebSocketMessage>
pub fn subscribe_ws(&self) -> Receiver<WebSocketMessage>
Subscribe to WebSocket messages
Sourcepub fn broadcast_ws(&self, msg: WebSocketMessage) -> Result<()>
pub fn broadcast_ws(&self, msg: WebSocketMessage) -> Result<()>
Broadcast a message to all WebSocket clients
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
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>
Converts
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>
Converts
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