Skip to main content

Store

Trait Store 

Source
pub trait Store {
    type H: Harness;
    type Ref;

    // Required methods
    fn discover(&self) -> Result<Vec<Discovered<Self::Ref>>>;
    fn load(&self, reference: &Self::Ref) -> Result<Transcript<Self::H>>;
    fn save(&self, transcript: &Transcript<Self::H>) -> Result<Saved<Self::Ref>>;
    fn delete(&self, reference: &Self::Ref) -> Result<()>;

    // Provided method
    fn fingerprints(
        &self,
        _refs: &[Self::Ref],
    ) -> Result<HashMap<String, String>> { ... }
}
Expand description

Reading and writing native transcripts against a real backend (a session directory, a SQLite database, an import subprocess).

Required Associated Types§

Source

type H: Harness

The harness this store reads and writes.

Source

type Ref

A locator for one transcript at rest: a file path, a database id, a slug.

Required Methods§

Source

fn discover(&self) -> Result<Vec<Discovered<Self::Ref>>>

Cheap metadata scan — no full message parsing.

§Errors

When the backend itself fails; a missing root is Ok(vec![]).

Source

fn load(&self, reference: &Self::Ref) -> Result<Transcript<Self::H>>

Load and parse one transcript into its faithful native representation.

§Errors

When the reference doesn’t exist or its content doesn’t parse.

Source

fn save(&self, transcript: &Transcript<Self::H>) -> Result<Saved<Self::Ref>>

Persist a native transcript so the harness can resume it.

§Errors

When the backend rejects the write.

Source

fn delete(&self, reference: &Self::Ref) -> Result<()>

Remove one transcript from the backend so the harness no longer lists or resumes it. File-backed stores remove the session file or directory; OpenCode archives the session in place.

§Errors

When the reference doesn’t exist or the backend rejects the removal.

Provided Methods§

Source

fn fingerprints(&self, _refs: &[Self::Ref]) -> Result<HashMap<String, String>>

Per-reference change cursors, for callers that cache parsed transcripts. Default: no fingerprints, forcing a re-parse. Backends with a cheap change signal (file mtime, a MAX(updated) query) should override.

§Errors

When the backend itself fails; per-reference failures are empty strings.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Store for AmpStore

Source§

impl Store for AntigravityStore

Available on crate feature opencode only.
Source§

impl Store for CampfireStore

Source§

impl Store for ClaudeStore

Source§

impl Store for CodexStore

Source§

impl Store for CoworkStore

Source§

impl Store for CursorDesktopStore

Available on crate feature opencode only.
Source§

impl Store for CursorStore

Available on crate feature opencode only.
Source§

impl Store for GrokStore

Source§

impl Store for HermesStore

Available on crate feature hermes only.
Source§

impl Store for OpenCodeStore

Source§

impl Store for PiStore