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 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 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 summary_stats(&self, workspace: &str) -> Result<SummaryStats>

Source

pub fn list_events_for_session(&self, session_id: &str) -> 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 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 tool_spans_in_window( &self, workspace: &str, start_ms: u64, end_ms: u64, ) -> Result<Vec<ToolSpanView>>

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 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 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> 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> 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, 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<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,