pub struct Store { /* private fields */ }Implementations§
Source§impl Store
impl Store
Sourcepub fn remote_insert_event(
&self,
team_id: &str,
workspace_hash: &str,
session_id_hash: &str,
event_seq: i64,
json: &str,
) -> Result<()>
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).
Sourcepub fn list_remote_event_jsons(
&self,
team_id: &str,
workspace_hash: &str,
) -> Result<Vec<String>>
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).
Sourcepub fn remote_event_aggregate(
&self,
team_id: &str,
workspace_hash: &str,
) -> Result<RemoteEventAgg>
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
impl Store
pub fn open(path: &Path) -> Result<Self>
pub fn open_read_only(path: &Path) -> Result<Self>
pub fn open_query(path: &Path) -> Result<Self>
pub fn open_with_mode(path: &Path, mode: StoreOpenMode) -> Result<Self>
pub fn upsert_session(&self, s: &SessionRecord) -> Result<()>
Sourcepub fn ensure_session_stub(
&self,
id: &str,
agent: &str,
workspace: &str,
started_at_ms: u64,
) -> Result<()>
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).
Sourcepub fn next_event_seq(&self, session_id: &str) -> Result<u64>
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).
pub fn append_event(&self, e: &Event) -> Result<()>
Sourcepub fn append_event_with_sync(
&self,
e: &Event,
ctx: Option<&SyncIngestContext>,
) -> Result<()>
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.
pub fn flush_search(&self) -> Result<()>
pub fn flush_projector_session( &self, session_id: &str, now_ms: u64, ) -> Result<()>
pub fn list_outbox_pending( &self, limit: usize, ) -> Result<Vec<(i64, String, String)>>
pub fn mark_outbox_sent(&self, ids: &[i64]) -> Result<()>
pub fn replace_outbox_rows( &self, owner_id: &str, kind: &str, payloads: &[String], ) -> Result<()>
pub fn outbox_pending_count(&self) -> Result<u64>
pub fn set_sync_state_ok(&self) -> Result<()>
pub fn set_sync_state_error(&self, msg: &str) -> Result<()>
pub fn sync_status(&self) -> Result<SyncStatusSnapshot>
pub fn sync_state_get_u64(&self, key: &str) -> Result<Option<u64>>
pub fn sync_state_set_u64(&self, key: &str, v: u64) -> Result<()>
Sourcepub fn prune_sessions_started_before(
&self,
cutoff_ms: i64,
) -> Result<PruneStats>
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.
Sourcepub fn vacuum(&self) -> Result<()>
pub fn vacuum(&self) -> Result<()>
Reclaim file space after large deletes (exclusive lock; can be slow).
pub fn list_sessions(&self, workspace: &str) -> Result<Vec<SessionRecord>>
pub fn list_sessions_page( &self, workspace: &str, offset: usize, limit: usize, filter: SessionFilter, ) -> Result<SessionPage>
pub fn list_sessions_started_after( &self, workspace: &str, after_started_at_ms: u64, ) -> Result<Vec<SessionRecord>>
pub fn session_statuses(&self, ids: &[String]) -> Result<Vec<SessionStatusRow>>
pub fn summary_stats(&self, workspace: &str) -> Result<SummaryStats>
pub fn list_events_for_session(&self, session_id: &str) -> Result<Vec<Event>>
pub fn get_event(&self, session_id: &str, seq: u64) -> Result<Option<Event>>
pub fn search_tool_events( &self, workspace: &str, tool: &str, since_ms: Option<u64>, agent: Option<&str>, limit: usize, ) -> Result<Vec<(String, Event)>>
pub fn workspace_events( &self, workspace: &str, ) -> Result<Vec<(SessionRecord, Event)>>
pub fn list_events_page( &self, session_id: &str, after_seq: u64, limit: usize, ) -> Result<Vec<Event>>
Sourcepub fn update_session_status(
&self,
id: &str,
status: SessionStatus,
) -> Result<()>
pub fn update_session_status( &self, id: &str, status: SessionStatus, ) -> Result<()>
Update only status for existing session.
Sourcepub fn insights(&self, workspace: &str) -> Result<InsightsStats>
pub fn insights(&self, workspace: &str) -> Result<InsightsStats>
Workspace activity dashboard — feeds cmd_insights.
Sourcepub fn retro_events_in_window(
&self,
workspace: &str,
start_ms: u64,
end_ms: u64,
) -> Result<Vec<(SessionRecord, Event)>>
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.
pub fn experiment_metric_values_in_window( &self, workspace: &str, start_ms: u64, end_ms: u64, metric: Metric, ) -> Result<Vec<(SessionRecord, f64)>>
Sourcepub fn files_touched_in_window(
&self,
workspace: &str,
start_ms: u64,
end_ms: u64,
) -> Result<Vec<(String, String)>>
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.
Sourcepub fn skills_used_since(
&self,
workspace: &str,
since_ms: u64,
) -> Result<Vec<String>>
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).
Sourcepub fn skills_used_in_window(
&self,
workspace: &str,
start_ms: u64,
end_ms: u64,
) -> Result<Vec<(String, String)>>
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.
Sourcepub fn rules_used_since(
&self,
workspace: &str,
since_ms: u64,
) -> Result<Vec<String>>
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.
Sourcepub fn rules_used_in_window(
&self,
workspace: &str,
start_ms: u64,
end_ms: u64,
) -> Result<Vec<(String, String)>>
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.
Sourcepub fn sessions_active_in_window(
&self,
workspace: &str,
start_ms: u64,
end_ms: u64,
) -> Result<HashSet<String>>
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).
Sourcepub fn session_costs_usd_e6_in_window(
&self,
workspace: &str,
start_ms: u64,
end_ms: u64,
) -> Result<HashMap<String, i64>>
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).
Sourcepub 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>
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).
pub fn get_session(&self, id: &str) -> Result<Option<SessionRecord>>
pub fn latest_repo_snapshot( &self, workspace: &str, ) -> Result<Option<RepoSnapshotRecord>>
pub fn save_repo_snapshot( &self, snapshot: &RepoSnapshotRecord, facts: &[FileFact], edges: &[RepoEdge], ) -> Result<()>
pub fn file_facts_for_snapshot( &self, snapshot_id: &str, ) -> Result<Vec<FileFact>>
pub fn repo_edges_for_snapshot( &self, snapshot_id: &str, ) -> Result<Vec<RepoEdge>>
pub fn hottest_files_for_snapshot( &self, snapshot_id: &str, ) -> Result<Vec<RankedFile>>
pub fn most_changed_files_for_snapshot( &self, snapshot_id: &str, ) -> Result<Vec<RankedFile>>
pub fn most_complex_files_for_snapshot( &self, snapshot_id: &str, ) -> Result<Vec<RankedFile>>
pub fn highest_risk_files_for_snapshot( &self, snapshot_id: &str, ) -> Result<Vec<RankedFile>>
pub fn pain_hotspots_for_snapshot( &self, snapshot_id: &str, workspace: &str, start_ms: u64, end_ms: u64, ) -> Result<Vec<RankedFile>>
pub fn tool_rank_rows_in_window( &self, workspace: &str, start_ms: u64, end_ms: u64, ) -> Result<Vec<RankedTool>>
pub fn tool_spans_in_window( &self, workspace: &str, start_ms: u64, end_ms: u64, ) -> Result<Vec<ToolSpanView>>
pub fn session_span_tree(&self, session_id: &str) -> Result<Vec<SpanNode>>
pub fn last_event_seq_for_session( &self, session_id: &str, ) -> Result<Option<u64>>
Sourcepub fn tool_spans_sync_rows_in_window(
&self,
workspace: &str,
start_ms: u64,
end_ms: u64,
) -> Result<Vec<ToolSpanSyncRow>>
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.
pub fn tool_spans_for_session( &self, session_id: &str, ) -> Result<Vec<ToolSpanSyncRow>>
pub fn upsert_eval(&self, eval: &EvalRow) -> Result<()>
pub fn list_evals_in_window( &self, start_ms: u64, end_ms: u64, ) -> Result<Vec<EvalRow>>
pub fn list_evals_for_session(&self, session_id: &str) -> Result<Vec<EvalRow>>
pub fn upsert_feedback(&self, r: &FeedbackRecord) -> Result<()>
pub fn list_feedback_in_window( &self, start_ms: u64, end_ms: u64, ) -> Result<Vec<FeedbackRecord>>
pub fn feedback_for_sessions( &self, ids: &[String], ) -> Result<HashMap<String, FeedbackRecord>>
pub fn upsert_session_outcome(&self, row: &SessionOutcomeRow) -> Result<()>
pub fn get_session_outcome( &self, session_id: &str, ) -> Result<Option<SessionOutcomeRow>>
Sourcepub fn list_session_outcomes_in_window(
&self,
workspace: &str,
start_ms: u64,
end_ms: u64,
) -> Result<Vec<SessionOutcomeRow>>
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.
pub fn append_session_sample( &self, session_id: &str, ts_ms: u64, pid: u32, cpu_percent: Option<f64>, rss_bytes: Option<u64>, ) -> Result<()>
Sourcepub fn list_session_sample_aggs_in_window(
&self,
workspace: &str,
start_ms: u64,
end_ms: u64,
) -> Result<Vec<SessionSampleAgg>>
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.
pub fn list_sessions_for_eval( &self, since_ms: u64, min_cost_usd: f64, ) -> Result<Vec<SessionRecord>>
pub fn upsert_prompt_snapshot(&self, snap: &PromptSnapshot) -> Result<()>
pub fn get_prompt_snapshot( &self, fingerprint: &str, ) -> Result<Option<PromptSnapshot>>
pub fn list_prompt_snapshots(&self) -> Result<Vec<PromptSnapshot>>
Trait Implementations§
Source§impl RemoteCacheStore for Store
impl RemoteCacheStore for Store
fn get_pull_state(&self) -> Result<RemotePullState>
Source§fn set_pull_state(&self, state: &RemotePullState) -> Result<()>
fn set_pull_state(&self, state: &RemotePullState) -> Result<()>
Source§fn with_remote_refresh<T>(
&self,
f: impl for<'a> FnOnce(&'a Transaction<'_>) -> Result<T>,
) -> Result<T>
fn with_remote_refresh<T>( &self, f: impl for<'a> FnOnce(&'a Transaction<'_>) -> Result<T>, ) -> Result<T>
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> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&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
impl<T> DowncastSend for T
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 moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.