pub trait RunStore: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn create<'life0, 'async_trait>(
&'life0 self,
record: RunRecord,
) -> Pin<Box<dyn Future<Output = Result<(), RunStoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 RunId,
) -> Pin<Box<dyn Future<Output = Result<RunRecord, RunStoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn list_by_task<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 TaskId,
) -> Pin<Box<dyn Future<Output = Result<Vec<RunRecord>, RunStoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn append_step_entry<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 RunId,
entry: StepEntry,
) -> Pin<Box<dyn Future<Output = Result<(), RunStoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn append_degradation<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 RunId,
entry: DegradationEntry,
) -> Pin<Box<dyn Future<Output = Result<(), RunStoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn update_status<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 RunId,
status: RunStatus,
) -> Pin<Box<dyn Future<Output = Result<(), RunStoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn try_transition<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 RunId,
from: RunStatus,
to: RunStatus,
) -> Pin<Box<dyn Future<Output = Result<bool, RunStoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn set_result<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 RunId,
result_ref: Value,
) -> Pin<Box<dyn Future<Output = Result<(), RunStoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn set_input_json<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 RunId,
input_json: String,
) -> Pin<Box<dyn Future<Output = Result<(), RunStoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn list_running<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<RunRecord>, RunStoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Persistence interface for Run records — one kick of a Task, in the
issue #13 ID hierarchy.
Required Methods§
Sourcefn create<'life0, 'async_trait>(
&'life0 self,
record: RunRecord,
) -> Pin<Box<dyn Future<Output = Result<(), RunStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn create<'life0, 'async_trait>(
&'life0 self,
record: RunRecord,
) -> Pin<Box<dyn Future<Output = Result<(), RunStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Create a new Run row. Returns Duplicate if record.id is already
stored.
Sourcefn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 RunId,
) -> Pin<Box<dyn Future<Output = Result<RunRecord, RunStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 RunId,
) -> Pin<Box<dyn Future<Output = Result<RunRecord, RunStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetch a Run by id.
Sourcefn list_by_task<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 TaskId,
) -> Pin<Box<dyn Future<Output = Result<Vec<RunRecord>, RunStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_by_task<'life0, 'life1, 'async_trait>(
&'life0 self,
task_id: &'life1 TaskId,
) -> Pin<Box<dyn Future<Output = Result<Vec<RunRecord>, RunStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List every Run kicked from task_id, ascending by created_at
(oldest kick first).
Sourcefn append_step_entry<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 RunId,
entry: StepEntry,
) -> Pin<Box<dyn Future<Output = Result<(), RunStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn append_step_entry<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 RunId,
entry: StepEntry,
) -> Pin<Box<dyn Future<Output = Result<(), RunStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Append one step-trace entry to a Run’s step_entries, bumping
updated_at to now.
Sourcefn append_degradation<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 RunId,
entry: DegradationEntry,
) -> Pin<Box<dyn Future<Output = Result<(), RunStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn append_degradation<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 RunId,
entry: DegradationEntry,
) -> Pin<Box<dyn Future<Output = Result<(), RunStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Append one worker-reported degradation to a Run’s degradations
(GH #32), bumping updated_at to now. Independent of
Self::append_step_entry — degradations never flow through step
OUTPUT/fold.
Sourcefn update_status<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 RunId,
status: RunStatus,
) -> Pin<Box<dyn Future<Output = Result<(), RunStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_status<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 RunId,
status: RunStatus,
) -> Pin<Box<dyn Future<Output = Result<(), RunStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Update a Run’s status, bumping updated_at to now.
Sourcefn try_transition<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 RunId,
from: RunStatus,
to: RunStatus,
) -> Pin<Box<dyn Future<Output = Result<bool, RunStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn try_transition<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 RunId,
from: RunStatus,
to: RunStatus,
) -> Pin<Box<dyn Future<Output = Result<bool, RunStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Atomically transition a Run’s status from from to to, bumping
updated_at to now — the compare-and-set primitive the resume path
(POST /v1/runs/:id/resume) uses to guard against a double resume
racing the same Interrupted Run into Running twice.
Returns Ok(true) when a row with this id AND current status
from was found and flipped to to; Ok(false) when the row’s
current status was not from (a concurrent transition already won,
or the Run is absent). Never a hard error for the status-mismatch /
absent case — the boolean is the caller’s race signal.
Sourcefn set_result<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 RunId,
result_ref: Value,
) -> Pin<Box<dyn Future<Output = Result<(), RunStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn set_result<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 RunId,
result_ref: Value,
) -> Pin<Box<dyn Future<Output = Result<(), RunStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Set a Run’s terminal result_ref, bumping updated_at to now.
Sourcefn set_input_json<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 RunId,
input_json: String,
) -> Pin<Box<dyn Future<Output = Result<(), RunStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn set_input_json<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 RunId,
input_json: String,
) -> Pin<Box<dyn Future<Output = Result<(), RunStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Replace the opaque launch snapshot after pre-dispatch binding has
enriched it (for example with immutable bound_agents).
Sourcefn list_running<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<RunRecord>, RunStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_running<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<RunRecord>, RunStoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List every Run currently Running (issue #35 ST2 boot sweep +
ST4 occupancy check reuse this). No ordering guarantee.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".