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 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 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 summary_stats(&self, workspace: &str) -> Result<SummaryStats>
pub fn list_events_for_session(&self, session_id: &str) -> 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.
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 tool_spans_in_window( &self, workspace: &str, start_ms: u64, end_ms: u64, ) -> Result<Vec<ToolSpanView>>
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 list_sessions_for_eval( &self, since_ms: u64, min_cost_usd: f64, ) -> Result<Vec<SessionRecord>>
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> 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> 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