Skip to main content

FiveSignalRuntime

Struct FiveSignalRuntime 

Source
pub struct FiveSignalRuntime {
    pub weights: FiveSignalWeights,
    pub access_cache: AccessFrequencyCache,
    pub causal_computer: Mutex<CausalDistanceComputer>,
    pub novelty_computer: NoveltyComputer,
    pub metrics: Arc<FiveSignalMetrics>,
    pub pool: DbPool,
    pub qdrant: Option<Arc<EmbeddingStore>>,
    pub session_start: i64,
    pub session_id: SessionId,
    pub config: FiveSignalConfig,
}
Expand description

Runtime state for the five-signal retrieval subsystem.

Created once at bootstrap when five_signal.enabled = true and attached to crate::semantic::SemanticMemory via an Option<Arc<FiveSignalRuntime>>. None when disabled — guarantees zero overhead per NFR-005.

Fields§

§weights: FiveSignalWeights

Normalized signal weights (computed once at startup).

§access_cache: AccessFrequencyCache

Access frequency aggregator.

§causal_computer: Mutex<CausalDistanceComputer>

Causal distance computer (contains BFS cache per goal entity).

§novelty_computer: NoveltyComputer

Novelty computer (pure arithmetic, no I/O).

§metrics: Arc<FiveSignalMetrics>

Prometheus-compatible counters.

§pool: DbPool

SQLite pool (shared with the rest of SemanticMemory).

§qdrant: Option<Arc<EmbeddingStore>>

Qdrant store (optional; used by the consolidation daemon).

§session_start: i64

Unix timestamp of session start, used by NoveltyComputer.

§session_id: SessionId

Session identifier used to scope fact_access_log inserts and queries.

Set at bootstrap from a per-process UUID so access counts are isolated per session and do not bleed across process restarts.

§config: FiveSignalConfig

Config snapshot (used by the consolidation daemon).

Implementations§

Source§

impl FiveSignalRuntime

Source

pub fn new( config: FiveSignalConfig, pool: DbPool, graph_store: Arc<GraphStore>, qdrant: Option<Arc<EmbeddingStore>>, session_start: i64, session_id: impl Into<SessionId>, ) -> Self

Create a new runtime from config, pool, and optional graph + Qdrant stores.

Normalizes signal weights (logging WARN if they do not sum to 1.0). Logs a WARN if consolidation_daemon.top_k_per_run < batch_size (MINOR-03).

§Examples
use std::sync::Arc;
use zeph_config::memory::FiveSignalConfig;
use zeph_memory::five_signal::FiveSignalRuntime;

let cfg = FiveSignalConfig::default();
let session_start = std::time::SystemTime::now()
    .duration_since(std::time::UNIX_EPOCH)
    .map_or(0, |d| d.as_secs() as i64);
let session_id = uuid::Uuid::new_v4().to_string();
let runtime = FiveSignalRuntime::new(cfg, pool, graph, None, session_start, session_id);

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more