pub struct AppState {
pub graph: Arc<RwLock<GraphDB>>,
pub logic: Arc<RwLock<RuleEngine>>,
pub memory: Arc<RwLock<TitansMemory>>,
pub broadcaster: Arc<EventBroadcaster>,
pub proof_store: Arc<ProofStore>,
pub user_store: Arc<UserStore>,
}Expand description
The shared state accessible by all API handlers.
This struct uses Arc and RwLock to provide safe, concurrent access
to the application’s core components like the database and logic engine.
Fields§
§graph: Arc<RwLock<GraphDB>>A thread-safe reference to the graph database.
logic: Arc<RwLock<RuleEngine>>A thread-safe reference to the logic and validation engine.
memory: Arc<RwLock<TitansMemory>>The Titans dual-memory system (STM + LTM with consolidation).
broadcaster: Arc<EventBroadcaster>The event broadcaster for sending real-time updates to WebSocket subscribers.
proof_store: Arc<ProofStore>The store for managing and verifying zero-knowledge proofs.
user_store: Arc<UserStore>The user store for authentication and authorization.
This field is only available if the auth feature is enabled.
Implementations§
Source§impl AppState
impl AppState
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new AppState with an in-memory graph database.
This is useful for testing or development environments.
Sourcepub fn with_graph(graph: GraphDB) -> Self
pub fn with_graph(graph: GraphDB) -> Self
Creates a new AppState with a pre-configured GraphDB instance.
Sourcepub fn cortex_client(&self) -> CortexInternalClient
pub fn cortex_client(&self) -> CortexInternalClient
Returns an internal Cortex client configured for same-process access.
This client calls the Cortex REST API and can be used by host functions to bridge WASM zome code with the semantic graph.
Sourcepub async fn stats(&self) -> GraphStats
pub async fn stats(&self) -> GraphStats
Gathers and returns statistics about the graph and connected clients.
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,
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