pub trait TaskRepository {
Show 38 methods
// Required methods
fn resolve_task_id(&self, task_id_or_prefix: &str) -> Result<String>;
fn load_task_summary(&self, task_id: &str) -> Result<TaskSummary>;
fn load_task_detail_rows(&self, task_id: &str) -> Result<TaskDetailRows>;
fn load_task_item_counts(&self, task_id: &str) -> Result<(i64, i64, i64)>;
fn list_task_ids_ordered_by_created_desc(&self) -> Result<Vec<String>>;
fn find_latest_resumable_task_id(
&self,
include_pending: bool,
) -> Result<Option<String>>;
fn load_task_runtime_row(&self, task_id: &str) -> Result<TaskRuntimeRow>;
fn first_task_item_id(&self, task_id: &str) -> Result<Option<String>>;
fn count_unresolved_items(&self, task_id: &str) -> Result<i64>;
fn list_task_items_for_cycle(
&self,
task_id: &str,
) -> Result<Vec<TaskItemRow>>;
fn load_task_status(&self, task_id: &str) -> Result<Option<String>>;
fn set_task_status(
&self,
task_id: &str,
status: &str,
set_completed: bool,
) -> Result<()>;
fn prepare_task_for_start_batch(&self, task_id: &str) -> Result<()>;
fn update_task_cycle_state(
&self,
task_id: &str,
current_cycle: u32,
init_done: bool,
) -> Result<()>;
fn mark_task_item_running(&self, task_item_id: &str) -> Result<()>;
fn set_task_item_terminal_status(
&self,
task_item_id: &str,
status: &str,
) -> Result<()>;
fn update_task_item_status(
&self,
task_item_id: &str,
status: &str,
) -> Result<()>;
fn update_task_item_pipeline_vars(
&self,
task_item_id: &str,
pipeline_vars_json: &str,
) -> Result<()>;
fn load_task_name(&self, task_id: &str) -> Result<Option<String>>;
fn list_task_log_runs(
&self,
task_id: &str,
limit: usize,
) -> Result<Vec<TaskLogRunRow>>;
fn insert_task_graph_run(&self, run: &NewTaskGraphRun) -> Result<()>;
fn update_task_graph_run_status(
&self,
graph_run_id: &str,
status: &str,
) -> Result<()>;
fn insert_task_graph_snapshot(
&self,
snapshot: &NewTaskGraphSnapshot,
) -> Result<()>;
fn load_task_graph_debug_bundles(
&self,
task_id: &str,
) -> Result<Vec<TaskGraphDebugBundle>>;
fn delete_task_and_collect_log_paths(
&self,
task_id: &str,
) -> Result<Vec<String>>;
fn insert_command_run(&self, run: &NewCommandRun) -> Result<()>;
fn insert_event(&self, event: &DbEventRecord) -> Result<()>;
fn update_command_run(&self, run: &NewCommandRun) -> Result<()>;
fn update_command_run_with_events(
&self,
run: &NewCommandRun,
events: &[DbEventRecord],
) -> Result<()>;
fn persist_phase_result_with_events(
&self,
run: &NewCommandRun,
events: &[DbEventRecord],
) -> Result<()>;
fn update_command_run_pid(&self, run_id: &str, pid: i64) -> Result<()>;
fn find_active_child_pids(&self, task_id: &str) -> Result<Vec<i64>>;
fn find_inflight_command_runs_for_task(
&self,
task_id: &str,
) -> Result<Vec<InflightRunRecord>>;
fn find_completed_runs_for_pending_items(
&self,
task_id: &str,
) -> Result<Vec<CompletedRunRecord>>;
fn count_stale_pending_items(&self, task_id: &str) -> Result<i64>;
fn count_recent_heartbeats_for_items(
&self,
task_id: &str,
item_ids: &[String],
cutoff_ts: &str,
) -> Result<i64>;
fn update_task_pipeline_vars(
&self,
task_id: &str,
pipeline_vars_json: &str,
) -> Result<()>;
fn update_task_item_tickets(
&self,
task_item_id: &str,
ticket_files_json: &str,
ticket_content_json: &str,
) -> Result<()>;
}Expand description
Synchronous repository interface for task, run, and event persistence.
Required Methods§
Sourcefn resolve_task_id(&self, task_id_or_prefix: &str) -> Result<String>
fn resolve_task_id(&self, task_id_or_prefix: &str) -> Result<String>
Resolves a full task identifier from an exact ID or prefix.
Sourcefn load_task_summary(&self, task_id: &str) -> Result<TaskSummary>
fn load_task_summary(&self, task_id: &str) -> Result<TaskSummary>
Loads the summary row for a task.
Sourcefn load_task_detail_rows(&self, task_id: &str) -> Result<TaskDetailRows>
fn load_task_detail_rows(&self, task_id: &str) -> Result<TaskDetailRows>
Loads the full detail row bundle for a task.
Sourcefn load_task_item_counts(&self, task_id: &str) -> Result<(i64, i64, i64)>
fn load_task_item_counts(&self, task_id: &str) -> Result<(i64, i64, i64)>
Loads (total, resolved, unresolved) item counts for a task.
Sourcefn list_task_ids_ordered_by_created_desc(&self) -> Result<Vec<String>>
fn list_task_ids_ordered_by_created_desc(&self) -> Result<Vec<String>>
Lists task identifiers ordered from newest to oldest.
Sourcefn find_latest_resumable_task_id(
&self,
include_pending: bool,
) -> Result<Option<String>>
fn find_latest_resumable_task_id( &self, include_pending: bool, ) -> Result<Option<String>>
Returns the latest resumable task, optionally including pending tasks.
Sourcefn load_task_runtime_row(&self, task_id: &str) -> Result<TaskRuntimeRow>
fn load_task_runtime_row(&self, task_id: &str) -> Result<TaskRuntimeRow>
Loads execution state needed to resume a task.
Sourcefn first_task_item_id(&self, task_id: &str) -> Result<Option<String>>
fn first_task_item_id(&self, task_id: &str) -> Result<Option<String>>
Returns the first task-item identifier for a task, if any.
Sourcefn count_unresolved_items(&self, task_id: &str) -> Result<i64>
fn count_unresolved_items(&self, task_id: &str) -> Result<i64>
Counts unresolved items for the task.
Sourcefn list_task_items_for_cycle(&self, task_id: &str) -> Result<Vec<TaskItemRow>>
fn list_task_items_for_cycle(&self, task_id: &str) -> Result<Vec<TaskItemRow>>
Lists task items participating in the current cycle.
Sourcefn load_task_status(&self, task_id: &str) -> Result<Option<String>>
fn load_task_status(&self, task_id: &str) -> Result<Option<String>>
Loads the current task status string.
Sourcefn set_task_status(
&self,
task_id: &str,
status: &str,
set_completed: bool,
) -> Result<()>
fn set_task_status( &self, task_id: &str, status: &str, set_completed: bool, ) -> Result<()>
Updates the task status and optionally stamps completion metadata.
Sourcefn prepare_task_for_start_batch(&self, task_id: &str) -> Result<()>
fn prepare_task_for_start_batch(&self, task_id: &str) -> Result<()>
Prepares a task for a fresh start by resetting batch-execution state.
Sourcefn update_task_cycle_state(
&self,
task_id: &str,
current_cycle: u32,
init_done: bool,
) -> Result<()>
fn update_task_cycle_state( &self, task_id: &str, current_cycle: u32, init_done: bool, ) -> Result<()>
Persists cycle counters and init_once completion state for a task.
Sourcefn mark_task_item_running(&self, task_item_id: &str) -> Result<()>
fn mark_task_item_running(&self, task_item_id: &str) -> Result<()>
Marks a task item as currently running.
Sourcefn set_task_item_terminal_status(
&self,
task_item_id: &str,
status: &str,
) -> Result<()>
fn set_task_item_terminal_status( &self, task_item_id: &str, status: &str, ) -> Result<()>
Sets a terminal status for a task item.
Sourcefn update_task_item_status(
&self,
task_item_id: &str,
status: &str,
) -> Result<()>
fn update_task_item_status( &self, task_item_id: &str, status: &str, ) -> Result<()>
Updates a task item to an arbitrary status value.
Sourcefn update_task_item_pipeline_vars(
&self,
task_item_id: &str,
pipeline_vars_json: &str,
) -> Result<()>
fn update_task_item_pipeline_vars( &self, task_item_id: &str, pipeline_vars_json: &str, ) -> Result<()>
Persists accumulated pipeline variables back to the task item’s dynamic_vars column.
Sourcefn load_task_name(&self, task_id: &str) -> Result<Option<String>>
fn load_task_name(&self, task_id: &str) -> Result<Option<String>>
Loads the human-readable name of a task.
Sourcefn list_task_log_runs(
&self,
task_id: &str,
limit: usize,
) -> Result<Vec<TaskLogRunRow>>
fn list_task_log_runs( &self, task_id: &str, limit: usize, ) -> Result<Vec<TaskLogRunRow>>
Lists recent command runs for log streaming or inspection.
Sourcefn insert_task_graph_run(&self, run: &NewTaskGraphRun) -> Result<()>
fn insert_task_graph_run(&self, run: &NewTaskGraphRun) -> Result<()>
Inserts a new task-graph planning run record.
Sourcefn update_task_graph_run_status(
&self,
graph_run_id: &str,
status: &str,
) -> Result<()>
fn update_task_graph_run_status( &self, graph_run_id: &str, status: &str, ) -> Result<()>
Updates the status of an existing task-graph run.
Sourcefn insert_task_graph_snapshot(
&self,
snapshot: &NewTaskGraphSnapshot,
) -> Result<()>
fn insert_task_graph_snapshot( &self, snapshot: &NewTaskGraphSnapshot, ) -> Result<()>
Persists one task-graph snapshot.
Sourcefn load_task_graph_debug_bundles(
&self,
task_id: &str,
) -> Result<Vec<TaskGraphDebugBundle>>
fn load_task_graph_debug_bundles( &self, task_id: &str, ) -> Result<Vec<TaskGraphDebugBundle>>
Loads debug bundles for graph-planning diagnostics.
Sourcefn delete_task_and_collect_log_paths(
&self,
task_id: &str,
) -> Result<Vec<String>>
fn delete_task_and_collect_log_paths( &self, task_id: &str, ) -> Result<Vec<String>>
Deletes a task and returns log paths that should be cleaned up afterward.
Sourcefn insert_command_run(&self, run: &NewCommandRun) -> Result<()>
fn insert_command_run(&self, run: &NewCommandRun) -> Result<()>
Inserts a command-run record.
Sourcefn insert_event(&self, event: &DbEventRecord) -> Result<()>
fn insert_event(&self, event: &DbEventRecord) -> Result<()>
Inserts an event record.
Sourcefn update_command_run(&self, run: &NewCommandRun) -> Result<()>
fn update_command_run(&self, run: &NewCommandRun) -> Result<()>
Updates an existing command-run record.
Sourcefn update_command_run_with_events(
&self,
run: &NewCommandRun,
events: &[DbEventRecord],
) -> Result<()>
fn update_command_run_with_events( &self, run: &NewCommandRun, events: &[DbEventRecord], ) -> Result<()>
Updates a command run and appends events in a single repository call.
Sourcefn persist_phase_result_with_events(
&self,
run: &NewCommandRun,
events: &[DbEventRecord],
) -> Result<()>
fn persist_phase_result_with_events( &self, run: &NewCommandRun, events: &[DbEventRecord], ) -> Result<()>
Persists a completed phase result together with its emitted events.
Sourcefn update_command_run_pid(&self, run_id: &str, pid: i64) -> Result<()>
fn update_command_run_pid(&self, run_id: &str, pid: i64) -> Result<()>
Updates the operating-system PID associated with a running command.
Sourcefn find_active_child_pids(&self, task_id: &str) -> Result<Vec<i64>>
fn find_active_child_pids(&self, task_id: &str) -> Result<Vec<i64>>
Returns active child PIDs for a task.
Sourcefn find_inflight_command_runs_for_task(
&self,
task_id: &str,
) -> Result<Vec<InflightRunRecord>>
fn find_inflight_command_runs_for_task( &self, task_id: &str, ) -> Result<Vec<InflightRunRecord>>
Returns in-flight command runs for a task (FR-038).
Sourcefn find_completed_runs_for_pending_items(
&self,
task_id: &str,
) -> Result<Vec<CompletedRunRecord>>
fn find_completed_runs_for_pending_items( &self, task_id: &str, ) -> Result<Vec<CompletedRunRecord>>
Returns completed runs whose parent items are still pending (FR-038).
Sourcefn count_stale_pending_items(&self, task_id: &str) -> Result<i64>
fn count_stale_pending_items(&self, task_id: &str) -> Result<i64>
Counts stale pending items (FR-038).
Sourcefn count_recent_heartbeats_for_items(
&self,
task_id: &str,
item_ids: &[String],
cutoff_ts: &str,
) -> Result<i64>
fn count_recent_heartbeats_for_items( &self, task_id: &str, item_ids: &[String], cutoff_ts: &str, ) -> Result<i64>
Counts recent heartbeat events for specified item IDs since cutoff (FR-052).