pub struct AppState {
pub event_tx: Sender<ColonyEvent>,
/* private fields */
}Expand description
Shared application state.
Fields§
§event_tx: Sender<ColonyEvent>Broadcast channel for colony events.
Implementations§
Source§impl AppState
impl AppState
Sourcepub fn new(_db_path: Option<String>) -> Result<Self>
pub fn new(_db_path: Option<String>) -> Result<Self>
Create a new app state, optionally with SQLite persistence.
Sourcepub async fn stats(&self) -> ColonyStats
pub async fn stats(&self) -> ColonyStats
Get colony statistics.
Sourcepub async fn snapshot(&self) -> ColonySnapshot
pub async fn snapshot(&self) -> ColonySnapshot
Get colony snapshot.
Sourcepub async fn ingest(
&self,
title: String,
content: String,
position: Position,
ticks: u64,
) -> IngestResult
pub async fn ingest( &self, title: String, content: String, position: Position, ticks: u64, ) -> IngestResult
Ingest a document.
Sourcepub async fn query(
&self,
query: String,
max_results: usize,
alpha: f64,
) -> QueryResult
pub async fn query( &self, query: String, max_results: usize, alpha: f64, ) -> QueryResult
Query the knowledge graph.
Sourcepub fn subscribe(&self) -> Receiver<ColonyEvent>
pub fn subscribe(&self) -> Receiver<ColonyEvent>
Subscribe to events.
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 !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