CouncilRepositoryPort

Trait CouncilRepositoryPort 

Source
pub trait CouncilRepositoryPort:
    Send
    + Sync
    + 'static {
    // Required methods
    fn create_run<'life0, 'async_trait>(
        &'life0 self,
        run: CouncilRun,
    ) -> Pin<Box<dyn Future<Output = Result<(), RepositoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn update_run_status<'life0, 'life1, 'async_trait>(
        &'life0 self,
        run_id: &'life1 str,
        status: CouncilRunStatus,
    ) -> Pin<Box<dyn Future<Output = Result<(), RepositoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn update_graph<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        run_id: &'life1 str,
        graph_json: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), RepositoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn append_event<'life0, 'async_trait>(
        &'life0 self,
        event: CouncilRunEvent,
    ) -> Pin<Box<dyn Future<Output = Result<(), RepositoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_run<'life0, 'life1, 'async_trait>(
        &'life0 self,
        run_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<CouncilRun>, RepositoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list_runs<'life0, 'async_trait>(
        &'life0 self,
        status_filter: Option<CouncilRunStatus>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<CouncilRun>, RepositoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn list_events<'life0, 'life1, 'async_trait>(
        &'life0 self,
        run_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<CouncilRunEvent>, RepositoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn mark_interrupted_runs<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<u64, RepositoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn truncate_events_after_wave<'life0, 'life1, 'async_trait>(
        &'life0 self,
        run_id: &'life1 str,
        wave_index: u32,
    ) -> Pin<Box<dyn Future<Output = Result<(), RepositoryError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Persistence operations for orchestrator runs.

All methods return a RepositoryError on failure. The append_event method is best-effort in the executor: a storage failure is logged but does NOT abort the run. All other methods that change run status propagate errors to the executor.

Required Methods§

Source

fn create_run<'life0, 'async_trait>( &'life0 self, run: CouncilRun, ) -> Pin<Box<dyn Future<Output = Result<(), RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Persist a new run record.

The run’s id MUST be unique; callers generate a UUID v4 before calling this method.

Source

fn update_run_status<'life0, 'life1, 'async_trait>( &'life0 self, run_id: &'life1 str, status: CouncilRunStatus, ) -> Pin<Box<dyn Future<Output = Result<(), RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Update the lifecycle status of an existing run.

Source

fn update_graph<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, run_id: &'life1 str, graph_json: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Replace the serialised task graph for an existing run.

Called after plan approval and after each node completes so that the persisted graph stays up to date for resume purposes.

Source

fn append_event<'life0, 'async_trait>( &'life0 self, event: CouncilRunEvent, ) -> Pin<Box<dyn Future<Output = Result<(), RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Append a single event record to the run’s event log.

Source

fn get_run<'life0, 'life1, 'async_trait>( &'life0 self, run_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<CouncilRun>, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Retrieve a single run by id.

Returns Ok(None) if the run does not exist.

Source

fn list_runs<'life0, 'async_trait>( &'life0 self, status_filter: Option<CouncilRunStatus>, ) -> Pin<Box<dyn Future<Output = Result<Vec<CouncilRun>, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List runs optionally filtered by status.

Results are ordered by created_at descending (most recent first).

Source

fn list_events<'life0, 'life1, 'async_trait>( &'life0 self, run_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<CouncilRunEvent>, RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Return all events for a run in sequence order.

Source

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

Mark all runs currently in CouncilRunStatus::Running as CouncilRunStatus::Interrupted.

Called once on application boot to handle the case where a process was killed mid-execution.

Source

fn truncate_events_after_wave<'life0, 'life1, 'async_trait>( &'life0 self, run_id: &'life1 str, wave_index: u32, ) -> Pin<Box<dyn Future<Output = Result<(), RepositoryError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete all events for a run whose wave_index is strictly greater than wave_index.

Used by the Phase M rewind endpoint to truncate the event log back to the state it was in at the end of the specified wave so the run can be re-executed from that point.

Implementors§