Skip to main content

SpecStorage

Trait SpecStorage 

Source
pub trait SpecStorage:
    Send
    + Sync
    + Debug {
    // Required methods
    fn create_spec<'life0, 'async_trait>(
        &'life0 self,
        record: SpecRecord,
    ) -> Pin<Box<dyn Future<Output = Result<SpecRecord>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_spec<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
        owner: &'life2 CompilerOwner,
    ) -> Pin<Box<dyn Future<Output = Result<Option<SpecRecord>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn list_specs<'life0, 'life1, 'async_trait>(
        &'life0 self,
        owner: &'life1 CompilerOwner,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<SpecRecord>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn update_spec<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
        owner: &'life2 CompilerOwner,
        content: String,
    ) -> Pin<Box<dyn Future<Output = Result<Option<SpecRecord>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn delete_spec<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
        owner: &'life2 CompilerOwner,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn save_report<'life0, 'async_trait>(
        &'life0 self,
        record: ReportRecord,
    ) -> Pin<Box<dyn Future<Output = Result<ReportRecord>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_report<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
        owner: &'life2 CompilerOwner,
    ) -> Pin<Box<dyn Future<Output = Result<Option<ReportRecord>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn list_reports_for_spec<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        spec_id: &'life1 str,
        owner: &'life2 CompilerOwner,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ReportRecord>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Storage abstraction for agent specs and compile reports.

Implement this trait to plug in any storage backend (SurrealDB, SQLite, etc.). The default implementation is InMemorySpecStorage.

Every read and mutation takes the verified CompilerOwner. A record that belongs to another owner is indistinguishable from an absent one.

Required Methods§

Source

fn create_spec<'life0, 'async_trait>( &'life0 self, record: SpecRecord, ) -> Pin<Box<dyn Future<Output = Result<SpecRecord>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Store a new spec record. Returns the stored record (with generated ID).

Source

fn get_spec<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: &'life1 str, owner: &'life2 CompilerOwner, ) -> Pin<Box<dyn Future<Output = Result<Option<SpecRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Retrieve a spec by ID if owner owns it.

Source

fn list_specs<'life0, 'life1, 'async_trait>( &'life0 self, owner: &'life1 CompilerOwner, ) -> Pin<Box<dyn Future<Output = Result<Vec<SpecRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

List the specs owner owns (metadata only — content included).

Source

fn update_spec<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: &'life1 str, owner: &'life2 CompilerOwner, content: String, ) -> Pin<Box<dyn Future<Output = Result<Option<SpecRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Update the content of an existing spec owner owns.

Source

fn delete_spec<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: &'life1 str, owner: &'life2 CompilerOwner, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Delete a spec owner owns and its associated reports.

Source

fn save_report<'life0, 'async_trait>( &'life0 self, record: ReportRecord, ) -> Pin<Box<dyn Future<Output = Result<ReportRecord>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Store a compile report and link it to the spec.

Source

fn get_report<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: &'life1 str, owner: &'life2 CompilerOwner, ) -> Pin<Box<dyn Future<Output = Result<Option<ReportRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Retrieve a compile report by ID if owner owns it.

Source

fn list_reports_for_spec<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, spec_id: &'life1 str, owner: &'life2 CompilerOwner, ) -> Pin<Box<dyn Future<Output = Result<Vec<ReportRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

List the reports of a given spec that owner owns.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§