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, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<SpecRecord>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list_specs<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<SpecRecord>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn update_spec<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
        content: String,
    ) -> Pin<Box<dyn Future<Output = Result<Option<SpecRecord>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete_spec<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: '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, 'async_trait>(
        &'life0 self,
        id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<ReportRecord>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list_reports_for_spec<'life0, 'life1, 'async_trait>(
        &'life0 self,
        spec_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ReportRecord>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: '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.

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, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<SpecRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieve a spec by ID.

Source

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

List all stored specs (metadata only — content included).

Source

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

Update the content of an existing spec.

Source

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

Delete a spec 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, 'async_trait>( &'life0 self, id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<ReportRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieve a compile report by ID.

Source

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

List all reports for a given spec.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§