Skip to main content

AgenticSystemRepositoryPort

Trait AgenticSystemRepositoryPort 

Source
pub trait AgenticSystemRepositoryPort: Send + Sync {
    // Required methods
    fn save<'life0, 'async_trait>(
        &'life0 self,
        system: AgenticSystem,
        expected: Option<AgenticSystemRevision>,
    ) -> Pin<Box<dyn Future<Output = Result<AgenticSystemSaveOutcome, DomainError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 AgenticSystemId,
        revision: Option<AgenticSystemRevision>,
    ) -> Pin<Box<dyn Future<Output = Result<Option<AgenticSystem>, DomainError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list<'life0, 'life1, 'async_trait>(
        &'life0 self,
        query: &'life1 AgenticSystemQuery,
    ) -> Pin<Box<dyn Future<Output = Result<AgenticSystemPage, DomainError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Persistence for agentic system designs, one row per revision.

Compare-and-swap is the whole contract. Two people editing one design is the normal case, not the exceptional one, and a save that simply overwrote would lose whichever edit landed first without anybody finding out. expected is the revision the editor read; None means “this design should not exist yet” and is the only way to create one.

Not event sourced, deliberately (ADR-021): a design has a handful of revisions produced by somebody editing it and no decision stream of its own, and the one property that matters here — no lost update — is exactly what compare-and-swap gives.

Required Methods§

Source

fn save<'life0, 'async_trait>( &'life0 self, system: AgenticSystem, expected: Option<AgenticSystemRevision>, ) -> Pin<Box<dyn Future<Output = Result<AgenticSystemSaveOutcome, DomainError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Store a revision, or report which revision is actually current.

Reading the head and writing must be one indivisible step: checked beforehand, the answer is already stale by the time the write lands.

Source

fn get<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 AgenticSystemId, revision: Option<AgenticSystemRevision>, ) -> Pin<Box<dyn Future<Output = Result<Option<AgenticSystem>, DomainError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

One design, at a named revision or at its head.

Source

fn list<'life0, 'life1, 'async_trait>( &'life0 self, query: &'life1 AgenticSystemQuery, ) -> Pin<Box<dyn Future<Output = Result<AgenticSystemPage, DomainError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

A bounded page of heads.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§