pub struct AsyncSqliteTaskRepository { /* private fields */ }Expand description
Async wrapper around SqliteTaskRepository built on AsyncDatabase.
Implementations§
Source§impl AsyncSqliteTaskRepository
impl AsyncSqliteTaskRepository
Sourcepub fn new(async_db: Arc<AsyncDatabase>) -> Self
pub fn new(async_db: Arc<AsyncDatabase>) -> Self
Creates a new async repository wrapper.
Sourcepub async fn resolve_task_id(&self, prefix: &str) -> Result<String>
pub async fn resolve_task_id(&self, prefix: &str) -> Result<String>
Resolves a full task identifier from an ID prefix.
Sourcepub async fn load_task_summary(&self, task_id: &str) -> Result<TaskSummary>
pub async fn load_task_summary(&self, task_id: &str) -> Result<TaskSummary>
Loads a summary row for a task.
Sourcepub async fn load_task_detail_rows(
&self,
task_id: &str,
) -> Result<TaskDetailRows>
pub async fn load_task_detail_rows( &self, task_id: &str, ) -> Result<TaskDetailRows>
Loads the full detail bundle for a task.
Sourcepub async fn load_task_item_counts(
&self,
task_id: &str,
) -> Result<(i64, i64, i64)>
pub async fn load_task_item_counts( &self, task_id: &str, ) -> Result<(i64, i64, i64)>
Loads (total, resolved, unresolved) item counts for a task.
Sourcepub async fn list_task_ids_ordered_by_created_desc(&self) -> Result<Vec<String>>
pub async fn list_task_ids_ordered_by_created_desc(&self) -> Result<Vec<String>>
Lists task identifiers ordered by creation time descending.
Sourcepub async fn find_latest_resumable_task_id(
&self,
include_pending: bool,
) -> Result<Option<String>>
pub async fn find_latest_resumable_task_id( &self, include_pending: bool, ) -> Result<Option<String>>
Returns the latest resumable task, optionally including pending tasks.
Sourcepub async fn load_task_runtime_row(
&self,
task_id: &str,
) -> Result<TaskRuntimeRow>
pub async fn load_task_runtime_row( &self, task_id: &str, ) -> Result<TaskRuntimeRow>
Loads execution state required to resume a task.
Sourcepub async fn first_task_item_id(&self, task_id: &str) -> Result<Option<String>>
pub async fn first_task_item_id(&self, task_id: &str) -> Result<Option<String>>
Returns the first task-item identifier for a task, if present.
Sourcepub async fn count_unresolved_items(&self, task_id: &str) -> Result<i64>
pub async fn count_unresolved_items(&self, task_id: &str) -> Result<i64>
Counts unresolved task items.
Sourcepub async fn list_task_items_for_cycle(
&self,
task_id: &str,
) -> Result<Vec<TaskItemRow>>
pub async fn list_task_items_for_cycle( &self, task_id: &str, ) -> Result<Vec<TaskItemRow>>
Lists task items participating in the current cycle.
Sourcepub async fn load_task_status(&self, task_id: &str) -> Result<Option<String>>
pub async fn load_task_status(&self, task_id: &str) -> Result<Option<String>>
Loads the current task status string.
Sourcepub async fn load_task_name(&self, task_id: &str) -> Result<Option<String>>
pub async fn load_task_name(&self, task_id: &str) -> Result<Option<String>>
Loads the human-readable task name.
Sourcepub async fn list_task_log_runs(
&self,
task_id: &str,
limit: usize,
) -> Result<Vec<TaskLogRunRow>>
pub async fn list_task_log_runs( &self, task_id: &str, limit: usize, ) -> Result<Vec<TaskLogRunRow>>
Lists recent command runs used for log inspection.
Sourcepub async fn load_task_graph_debug_bundles(
&self,
task_id: &str,
) -> Result<Vec<TaskGraphDebugBundle>>
pub async fn load_task_graph_debug_bundles( &self, task_id: &str, ) -> Result<Vec<TaskGraphDebugBundle>>
Loads graph-planning debug bundles for a task.
Sourcepub async fn set_task_status(
&self,
task_id: &str,
status: &str,
set_completed: bool,
) -> Result<()>
pub async fn set_task_status( &self, task_id: &str, status: &str, set_completed: bool, ) -> Result<()>
Updates a task status and optionally marks completion.
Sourcepub async fn reset_unresolved_items(&self, task_id: &str) -> Result<()>
pub async fn reset_unresolved_items(&self, task_id: &str) -> Result<()>
Resets unresolved items back to pending without changing the task status. Called before enqueuing a task so the worker can re-process them.
Sourcepub async fn prepare_task_for_start_batch(&self, task_id: &str) -> Result<()>
pub async fn prepare_task_for_start_batch(&self, task_id: &str) -> Result<()>
Resets a task into a fresh batch-start state.
Sourcepub async fn update_task_cycle_state(
&self,
task_id: &str,
current_cycle: u32,
init_done: bool,
) -> Result<()>
pub async fn update_task_cycle_state( &self, task_id: &str, current_cycle: u32, init_done: bool, ) -> Result<()>
Persists cycle counters and init_once state.
Sourcepub async fn mark_task_item_running(&self, task_item_id: &str) -> Result<()>
pub async fn mark_task_item_running(&self, task_item_id: &str) -> Result<()>
Marks a task item as running.
Sourcepub async fn set_task_item_terminal_status(
&self,
task_item_id: &str,
status: &str,
) -> Result<()>
pub async fn set_task_item_terminal_status( &self, task_item_id: &str, status: &str, ) -> Result<()>
Sets a terminal status for a task item.
Sourcepub async fn update_task_item_status(
&self,
task_item_id: &str,
status: &str,
) -> Result<()>
pub async fn update_task_item_status( &self, task_item_id: &str, status: &str, ) -> Result<()>
Updates a task item to an arbitrary status.
Sourcepub async fn update_task_item_pipeline_vars(
&self,
task_item_id: &str,
pipeline_vars_json: &str,
) -> Result<()>
pub async 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.
Sourcepub async fn delete_task_and_collect_log_paths(
&self,
task_id: &str,
) -> Result<Vec<String>>
pub async fn delete_task_and_collect_log_paths( &self, task_id: &str, ) -> Result<Vec<String>>
Deletes a task and returns log paths that should be removed.
Sourcepub async fn insert_command_run(&self, run: NewCommandRun) -> Result<()>
pub async fn insert_command_run(&self, run: NewCommandRun) -> Result<()>
Inserts a command-run record.
Sourcepub async fn insert_event(&self, event: DbEventRecord) -> Result<()>
pub async fn insert_event(&self, event: DbEventRecord) -> Result<()>
Inserts an event record.
Sourcepub async fn update_command_run(&self, run: NewCommandRun) -> Result<()>
pub async fn update_command_run(&self, run: NewCommandRun) -> Result<()>
Updates an existing command-run record.
Sourcepub async fn update_command_run_with_events(
&self,
run: NewCommandRun,
events: Vec<DbEventRecord>,
) -> Result<()>
pub async fn update_command_run_with_events( &self, run: NewCommandRun, events: Vec<DbEventRecord>, ) -> Result<()>
Updates a command run and appends emitted events.
Sourcepub async fn persist_phase_result_with_events(
&self,
run: NewCommandRun,
events: Vec<DbEventRecord>,
) -> Result<()>
pub async fn persist_phase_result_with_events( &self, run: NewCommandRun, events: Vec<DbEventRecord>, ) -> Result<()>
Persists a completed phase result together with emitted events.
Sourcepub async fn update_command_run_pid(&self, run_id: &str, pid: i64) -> Result<()>
pub async fn update_command_run_pid(&self, run_id: &str, pid: i64) -> Result<()>
Updates the PID associated with a running command.
Sourcepub async fn find_active_child_pids(&self, task_id: &str) -> Result<Vec<i64>>
pub async fn find_active_child_pids(&self, task_id: &str) -> Result<Vec<i64>>
Returns active child PIDs for a task.
Sourcepub async fn find_inflight_command_runs_for_task(
&self,
task_id: &str,
) -> Result<Vec<InflightRunRecord>>
pub async fn find_inflight_command_runs_for_task( &self, task_id: &str, ) -> Result<Vec<InflightRunRecord>>
Returns in-flight command runs for a task (FR-038).
Sourcepub async fn find_completed_runs_for_pending_items(
&self,
task_id: &str,
) -> Result<Vec<CompletedRunRecord>>
pub async 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).
Sourcepub async fn count_stale_pending_items(&self, task_id: &str) -> Result<i64>
pub async fn count_stale_pending_items(&self, task_id: &str) -> Result<i64>
Counts stale pending items (FR-038).
Sourcepub async fn count_recent_heartbeats_for_items(
&self,
task_id: &str,
item_ids: &[String],
cutoff_ts: &str,
) -> Result<i64>
pub async fn count_recent_heartbeats_for_items( &self, task_id: &str, item_ids: &[String], cutoff_ts: &str, ) -> Result<i64>
FR-052: Counts recent heartbeat events for specified item IDs since cutoff.
Sourcepub async fn update_task_pipeline_vars(
&self,
task_id: &str,
pipeline_vars_json: &str,
) -> Result<()>
pub async fn update_task_pipeline_vars( &self, task_id: &str, pipeline_vars_json: &str, ) -> Result<()>
Persists the serialized pipeline-variable map for a task.
Sourcepub async fn update_task_item_tickets(
&self,
task_item_id: &str,
ticket_files_json: &str,
ticket_content_json: &str,
) -> Result<()>
pub async fn update_task_item_tickets( &self, task_item_id: &str, ticket_files_json: &str, ticket_content_json: &str, ) -> Result<()>
Persists active ticket paths and preview content for a task item.
Sourcepub async fn insert_task_graph_run(&self, run: NewTaskGraphRun) -> Result<()>
pub async fn insert_task_graph_run(&self, run: NewTaskGraphRun) -> Result<()>
Inserts a task-graph planning run.
Sourcepub async fn update_task_graph_run_status(
&self,
graph_run_id: &str,
status: &str,
) -> Result<()>
pub async fn update_task_graph_run_status( &self, graph_run_id: &str, status: &str, ) -> Result<()>
Updates the status of a task-graph planning run.
Sourcepub async fn pause_all_running_tasks_and_items(&self) -> Result<usize>
pub async fn pause_all_running_tasks_and_items(&self) -> Result<usize>
Blanket-pause all running tasks and reset their items to pending. Used during daemon shutdown before exec() to prevent orphaned state.
Sourcepub async fn pause_restart_pending_tasks_and_items(&self) -> Result<usize>
pub async fn pause_restart_pending_tasks_and_items(&self) -> Result<usize>
Pauses only tasks in restart_pending status and resets their running items.
Sourcepub async fn recover_orphaned_running_items(
&self,
) -> Result<Vec<(String, Vec<String>)>>
pub async fn recover_orphaned_running_items( &self, ) -> Result<Vec<(String, Vec<String>)>>
Recovers all orphaned running items across all tasks.
Sourcepub async fn recover_orphaned_running_items_for_task(
&self,
task_id: &str,
) -> Result<Vec<String>>
pub async fn recover_orphaned_running_items_for_task( &self, task_id: &str, ) -> Result<Vec<String>>
Recovers orphaned running items for a single task.
Sourcepub async fn recover_stalled_running_items(
&self,
stall_threshold_secs: u64,
exclude_task_ids: HashSet<String>,
) -> Result<Vec<(String, Vec<String>)>>
pub async fn recover_stalled_running_items( &self, stall_threshold_secs: u64, exclude_task_ids: HashSet<String>, ) -> Result<Vec<(String, Vec<String>)>>
Recovers stalled running items older than the given threshold.
Tasks in exclude_task_ids are skipped (they have active workers).
Sourcepub async fn insert_task_graph_snapshot(
&self,
snapshot: NewTaskGraphSnapshot,
) -> Result<()>
pub async fn insert_task_graph_snapshot( &self, snapshot: NewTaskGraphSnapshot, ) -> Result<()>
Persists one task-graph snapshot payload.
Auto Trait Implementations§
impl Freeze for AsyncSqliteTaskRepository
impl RefUnwindSafe for AsyncSqliteTaskRepository
impl Send for AsyncSqliteTaskRepository
impl Sync for AsyncSqliteTaskRepository
impl Unpin for AsyncSqliteTaskRepository
impl UnsafeUnpin for AsyncSqliteTaskRepository
impl UnwindSafe for AsyncSqliteTaskRepository
Blanket Implementations§
Source§impl<T> AnyExt for T
impl<T> AnyExt for T
Source§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind referenceSource§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable referenceSource§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointerSource§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointerSource§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request