Skip to main content

Store

Struct Store 

Source
pub struct Store { /* private fields */ }

Implementations§

Source§

impl Store

Source

pub fn remote_insert_event( &self, team_id: &str, workspace_hash: &str, session_id_hash: &str, event_seq: i64, json: &str, ) -> Result<()>

Upsert one remote event row (caller runs inside transaction as needed).

Source

pub fn list_remote_event_jsons( &self, team_id: &str, workspace_hash: &str, ) -> Result<Vec<String>>

JSON payloads in remote_events for this team/workspace (for provider-side retro/merge).

Source

pub fn remote_event_aggregate( &self, team_id: &str, workspace_hash: &str, ) -> Result<RemoteEventAgg>

Event-derived aggregates for summary / insights / metrics when DataSource is not local.

Source§

impl Store

Source

pub fn open(path: &Path) -> Result<Self>

Source

pub fn open_read_only(path: &Path) -> Result<Self>

Source

pub fn open_query(path: &Path) -> Result<Self>

Source

pub fn open_with_mode(path: &Path, mode: StoreOpenMode) -> Result<Self>

Source

pub fn upsert_session(&self, s: &SessionRecord) -> Result<()>

Source

pub fn ensure_session_stub( &self, id: &str, agent: &str, workspace: &str, started_at_ms: u64, ) -> Result<()>

Insert a minimal session row if none exists. Used by hook ingestion when the first observed event is not SessionStart (hooks installed mid-session).

Source

pub fn next_event_seq(&self, session_id: &str) -> Result<u64>

Next seq for a new event in this session (0 when there are no events yet).

Source

pub fn append_event(&self, e: &Event) -> Result<()>

Source

pub fn append_event_with_sync( &self, e: &Event, ctx: Option<&SyncIngestContext>, ) -> Result<()>

Append event; when ctx is set and sync is configured, enqueue one redacted outbox row.

Source

pub fn flush_projector_session( &self, session_id: &str, now_ms: u64, ) -> Result<()>

Source

pub fn list_outbox_pending( &self, limit: usize, ) -> Result<Vec<(i64, String, String)>>

Source

pub fn mark_outbox_sent(&self, ids: &[i64]) -> Result<()>

Source

pub fn replace_outbox_rows( &self, owner_id: &str, kind: &str, payloads: &[String], ) -> Result<()>

Source

pub fn outbox_pending_count(&self) -> Result<u64>

Source

pub fn set_sync_state_ok(&self) -> Result<()>

Source

pub fn set_sync_state_error(&self, msg: &str) -> Result<()>

Source

pub fn sync_status(&self) -> Result<SyncStatusSnapshot>

Source

pub fn sync_state_get_u64(&self, key: &str) -> Result<Option<u64>>

Source

pub fn sync_state_set_u64(&self, key: &str, v: u64) -> Result<()>

Source

pub fn prune_sessions_started_before( &self, cutoff_ms: i64, ) -> Result<PruneStats>

Delete sessions with started_at_ms strictly before cutoff_ms and all dependent rows.

Source

pub fn vacuum(&self) -> Result<()>

Reclaim file space after large deletes (exclusive lock; can be slow).

Source

pub fn list_sessions(&self, workspace: &str) -> Result<Vec<SessionRecord>>

Source

pub fn list_sessions_page( &self, workspace: &str, offset: usize, limit: usize, filter: SessionFilter, ) -> Result<SessionPage>

Source

pub fn list_sessions_started_after( &self, workspace: &str, after_started_at_ms: u64, ) -> Result<Vec<SessionRecord>>

Source

pub fn session_statuses(&self, ids: &[String]) -> Result<Vec<SessionStatusRow>>

Source

pub fn summary_stats(&self, workspace: &str) -> Result<SummaryStats>

Source

pub fn list_events_for_session(&self, session_id: &str) -> Result<Vec<Event>>

Source

pub fn get_event(&self, session_id: &str, seq: u64) -> Result<Option<Event>>

Source

pub fn search_tool_events( &self, workspace: &str, tool: &str, since_ms: Option<u64>, agent: Option<&str>, limit: usize, ) -> Result<Vec<(String, Event)>>

Source

pub fn workspace_events( &self, workspace: &str, ) -> Result<Vec<(SessionRecord, Event)>>

Source

pub fn list_events_page( &self, session_id: &str, after_seq: u64, limit: usize, ) -> Result<Vec<Event>>

Source

pub fn update_session_status( &self, id: &str, status: SessionStatus, ) -> Result<()>

Update only status for existing session.

Source

pub fn insights(&self, workspace: &str) -> Result<InsightsStats>

Workspace activity dashboard — feeds cmd_insights.

Source

pub fn retro_events_in_window( &self, workspace: &str, start_ms: u64, end_ms: u64, ) -> Result<Vec<(SessionRecord, Event)>>

Events in [start_ms, end_ms] for a workspace, with session metadata per row.

Source

pub fn experiment_metric_values_in_window( &self, workspace: &str, start_ms: u64, end_ms: u64, metric: Metric, ) -> Result<Vec<(SessionRecord, f64)>>

Source

pub fn files_touched_in_window( &self, workspace: &str, start_ms: u64, end_ms: u64, ) -> Result<Vec<(String, String)>>

Distinct (session_id, path) for sessions with activity in the time window.

Source

pub fn skills_used_since( &self, workspace: &str, since_ms: u64, ) -> Result<Vec<String>>

Distinct skill slugs referenced in skills_used for a workspace since since_ms (any session with an indexed skill row; join events optional — use row existence).

Source

pub fn skills_used_in_window( &self, workspace: &str, start_ms: u64, end_ms: u64, ) -> Result<Vec<(String, String)>>

Distinct (session_id, skill) for sessions with activity in the time window.

Source

pub fn rules_used_since( &self, workspace: &str, since_ms: u64, ) -> Result<Vec<String>>

Distinct rule stems referenced in rules_used for a workspace since since_ms.

Source

pub fn rules_used_in_window( &self, workspace: &str, start_ms: u64, end_ms: u64, ) -> Result<Vec<(String, String)>>

Distinct (session_id, rule) for sessions with activity in the time window.

Source

pub fn sessions_active_in_window( &self, workspace: &str, start_ms: u64, end_ms: u64, ) -> Result<HashSet<String>>

Sessions with at least one event timestamp falling in [start_ms, end_ms] (same rules as retro window).

Source

pub fn session_costs_usd_e6_in_window( &self, workspace: &str, start_ms: u64, end_ms: u64, ) -> Result<HashMap<String, i64>>

Per-session sum of cost_usd_e6 for events in the window (missing costs treated as 0).

Source

pub fn guidance_report( &self, workspace: &str, window_start_ms: u64, window_end_ms: u64, skill_slugs_on_disk: &HashSet<String>, rule_slugs_on_disk: &HashSet<String>, ) -> Result<GuidanceReport>

Skill/rule adoption and cost proxy vs workspace average (observed payload references only).

Source

pub fn get_session(&self, id: &str) -> Result<Option<SessionRecord>>

Source

pub fn latest_repo_snapshot( &self, workspace: &str, ) -> Result<Option<RepoSnapshotRecord>>

Source

pub fn save_repo_snapshot( &self, snapshot: &RepoSnapshotRecord, facts: &[FileFact], edges: &[RepoEdge], ) -> Result<()>

Source

pub fn file_facts_for_snapshot( &self, snapshot_id: &str, ) -> Result<Vec<FileFact>>

Source

pub fn repo_edges_for_snapshot( &self, snapshot_id: &str, ) -> Result<Vec<RepoEdge>>

Source

pub fn hottest_files_for_snapshot( &self, snapshot_id: &str, ) -> Result<Vec<RankedFile>>

Source

pub fn most_changed_files_for_snapshot( &self, snapshot_id: &str, ) -> Result<Vec<RankedFile>>

Source

pub fn most_complex_files_for_snapshot( &self, snapshot_id: &str, ) -> Result<Vec<RankedFile>>

Source

pub fn highest_risk_files_for_snapshot( &self, snapshot_id: &str, ) -> Result<Vec<RankedFile>>

Source

pub fn pain_hotspots_for_snapshot( &self, snapshot_id: &str, workspace: &str, start_ms: u64, end_ms: u64, ) -> Result<Vec<RankedFile>>

Source

pub fn tool_rank_rows_in_window( &self, workspace: &str, start_ms: u64, end_ms: u64, ) -> Result<Vec<RankedTool>>

Source

pub fn tool_spans_in_window( &self, workspace: &str, start_ms: u64, end_ms: u64, ) -> Result<Vec<ToolSpanView>>

Source

pub fn session_span_tree(&self, session_id: &str) -> Result<Vec<SpanNode>>

Source

pub fn last_event_seq_for_session( &self, session_id: &str, ) -> Result<Option<u64>>

Source

pub fn tool_spans_sync_rows_in_window( &self, workspace: &str, start_ms: u64, end_ms: u64, ) -> Result<Vec<ToolSpanSyncRow>>

Sync-shaped tool spans whose session falls in [start_ms, end_ms]. Mirrors retro_events_in_window for the spans table so kaizen telemetry push can ship IngestExportBatch::ToolSpans next to the events batch. Window matches on started_at_ms first, falling back to ended_at_ms for spans that never started a timer (status-only rows). Workspace filter joins through sessions.workspace.

Source

pub fn tool_spans_for_session( &self, session_id: &str, ) -> Result<Vec<ToolSpanSyncRow>>

Source

pub fn upsert_eval(&self, eval: &EvalRow) -> Result<()>

Source

pub fn list_evals_in_window( &self, start_ms: u64, end_ms: u64, ) -> Result<Vec<EvalRow>>

Source

pub fn list_evals_for_session(&self, session_id: &str) -> Result<Vec<EvalRow>>

Source

pub fn upsert_feedback(&self, r: &FeedbackRecord) -> Result<()>

Source

pub fn list_feedback_in_window( &self, start_ms: u64, end_ms: u64, ) -> Result<Vec<FeedbackRecord>>

Source

pub fn feedback_for_sessions( &self, ids: &[String], ) -> Result<HashMap<String, FeedbackRecord>>

Source

pub fn upsert_session_outcome(&self, row: &SessionOutcomeRow) -> Result<()>

Source

pub fn get_session_outcome( &self, session_id: &str, ) -> Result<Option<SessionOutcomeRow>>

Source

pub fn list_session_outcomes_in_window( &self, workspace: &str, start_ms: u64, end_ms: u64, ) -> Result<Vec<SessionOutcomeRow>>

Outcomes for sessions in workspace whose started_at falls in the window.

Source

pub fn append_session_sample( &self, session_id: &str, ts_ms: u64, pid: u32, cpu_percent: Option<f64>, rss_bytes: Option<u64>, ) -> Result<()>

Source

pub fn list_session_sample_aggs_in_window( &self, workspace: &str, start_ms: u64, end_ms: u64, ) -> Result<Vec<SessionSampleAgg>>

Per-session maxima for retro heuristics.

Source

pub fn list_sessions_for_eval( &self, since_ms: u64, min_cost_usd: f64, ) -> Result<Vec<SessionRecord>>

Source

pub fn upsert_prompt_snapshot(&self, snap: &PromptSnapshot) -> Result<()>

Source

pub fn get_prompt_snapshot( &self, fingerprint: &str, ) -> Result<Option<PromptSnapshot>>

Source

pub fn list_prompt_snapshots(&self) -> Result<Vec<PromptSnapshot>>

Source

pub fn sessions_with_prompt_fingerprint( &self, workspace: &str, start_ms: u64, end_ms: u64, ) -> Result<Vec<(String, String)>>

Sessions with a non-null prompt_fingerprint in the given window.

Trait Implementations§

Source§

impl Drop for Store

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl RemoteCacheStore for Store

Source§

fn get_pull_state(&self) -> Result<RemotePullState>

Source§

fn set_pull_state(&self, state: &RemotePullState) -> Result<()>

Update cursor and last success time (call only after a successful import in the same txn or immediately after commit).
Source§

fn with_remote_refresh<T>( &self, f: impl for<'a> FnOnce(&'a Transaction<'_>) -> Result<T>, ) -> Result<T>

Run f inside a transaction (use for clear + bulk insert + cursor update).

Auto Trait Implementations§

§

impl !Freeze for Store

§

impl !RefUnwindSafe for Store

§

impl Send for Store

§

impl !Sync for Store

§

impl Unpin for Store

§

impl UnsafeUnpin for Store

§

impl !UnwindSafe for Store

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> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSend for T
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
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> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
Source§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

Source§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
Source§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
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<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
Source§

impl<T> Fruit for T
where T: Send + Downcast,

Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,