pub struct AppState {
pub db: Db,
pub embedder: Arc<Option<Embedder>>,
pub vector_index: Arc<Mutex<Option<VectorIndex>>>,
pub federation: Arc<Option<FederationConfig>>,
pub tier_config: Arc<TierConfig>,
pub scoring: Arc<ResolvedScoring>,
}Expand description
Composite daemon state (issue #219/v0.7 prep).
Previously the Axum router held only Db. Closing the HTTP embedding gap
(semantic recall silently missed HTTP-stored memories because the daemon
never generated embeddings) requires the embedder and the in-memory HNSW
index to be reachable from write handlers. We introduce AppState and
use FromRef so every existing State<Db> handler keeps working
unchanged — only the write paths opt into State<AppState> to pick up
the embedder and vector index.
Fields§
§db: Db§embedder: Arc<Option<Embedder>>§vector_index: Arc<Mutex<Option<VectorIndex>>>§federation: Arc<Option<FederationConfig>>v0.7 federation config — Some when --quorum-writes N +
--quorum-peers are configured at serve time. Writes fan out
to peers via FederationConfig::broadcast_store_quorum when
this is Some.
tier_config: Arc<TierConfig>Resolved TierConfig for this daemon. Exposed so HTTP
endpoints that mirror MCP tools (notably /capabilities) can
reuse the MCP-side report builder without re-parsing config.
scoring: Arc<ResolvedScoring>v0.6.2 (S18): resolved recall scoring config — tier half-lives,
legacy-scoring toggle. Exposed so recall_memories_get /
recall_memories_post can call db::recall_hybrid (semantic
blend) when the embedder is loaded, mirroring how the MCP
memory_recall handler already wires it (src/mcp.rs:1157).
Prior to this, HTTP recall was keyword-only regardless of
embedder availability — scenario-18 surfaced the gap.
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