pub struct TaskManager { /* private fields */ }Implementations§
Source§impl TaskManager
impl TaskManager
pub fn new(backend: Arc<dyn ExternalBackend>) -> Self
Sourcepub fn with_store(
backend: Arc<dyn ExternalBackend>,
store: Arc<TaskStore>,
repo: String,
) -> Self
pub fn with_store( backend: Arc<dyn ExternalBackend>, store: Arc<TaskStore>, repo: String, ) -> Self
Create a TaskManager with the unified store for dual-write support.
Sourcepub fn with_events(
backend: Arc<dyn ExternalBackend>,
store: Arc<TaskStore>,
repo: String,
event_tx: Sender<TaskEvent>,
) -> Self
pub fn with_events( backend: Arc<dyn ExternalBackend>, store: Arc<TaskStore>, repo: String, event_tx: Sender<TaskEvent>, ) -> Self
Create a TaskManager with event bus support.
pub async fn create_task(&self, req: CreateTaskRequest) -> Result<Task>
pub async fn get_task(&self, id: i64) -> Result<Task>
Sourcepub async fn list_tasks(&self, filter: TaskFilter) -> Result<Vec<Task>>
pub async fn list_tasks(&self, filter: TaskFilter) -> Result<Vec<Task>>
List tasks by status, source, or both. Returns both internal (store) and external (GitHub) tasks.
Sourcepub async fn list_all_external_tasks(&self) -> Result<Vec<ExternalTask>>
pub async fn list_all_external_tasks(&self) -> Result<Vec<ExternalTask>>
Get all external tasks across all statuses (for status summary). Reads from the store when available, falling back to the backend.
Sourcepub async fn list_external_by_status(
&self,
status: Status,
) -> Result<Vec<ExternalTask>>
pub async fn list_external_by_status( &self, status: Status, ) -> Result<Vec<ExternalTask>>
Get external tasks by status (for engine use). Store-first: reads from the store when available, falls back to backend if the store has no tasks (e.g. before first sync).
Sourcepub async fn list_all_by_status(
&self,
status: Status,
) -> Result<Vec<ExternalTask>>
pub async fn list_all_by_status( &self, status: Status, ) -> Result<Vec<ExternalTask>>
Get all tasks (external + internal) by status. Store-first for external tasks: reads from the store when available, falls back to backend if the store has no tasks. Always includes internal tasks from the store when available.
Sourcepub async fn list_routable(&self) -> Result<Vec<ExternalTask>>
pub async fn list_routable(&self) -> Result<Vec<ExternalTask>>
Get open tasks that are routable (status = new). Store-first: reads all New tasks (external + internal) from the store, falling back to the backend for external tasks before first sync.
Sourcepub async fn update_task_status(
&self,
id: &ExternalId,
status: Status,
) -> Result<()>
pub async fn update_task_status( &self, id: &ExternalId, status: Status, ) -> Result<()>
Update the status of an internal or external task by its string ID.
For "internal:{n}" IDs, updates the store. For all others, calls the backend.
Store is always updated when available.
pub async fn update_task_status_and_result( &self, id: &ExternalId, status: Status, updates: &[(&str, Value)], ) -> Result<()>
Sourcepub async fn update_task_status_if(
&self,
id: &ExternalId,
status: Status,
expected_status: Status,
) -> Result<bool>
pub async fn update_task_status_if( &self, id: &ExternalId, status: Status, expected_status: Status, ) -> Result<bool>
Update the status of a task only if it is currently in expected_status.
Returns Ok(true) if the update was applied, Ok(false) if the task had
already transitioned to a different status (TOCTOU-safe — no-op on race).
Sourcepub async fn update_task_status_with_duration(
&self,
id: &ExternalId,
status: Status,
duration_seconds: Option<f64>,
) -> Result<()>
pub async fn update_task_status_with_duration( &self, id: &ExternalId, status: Status, duration_seconds: Option<f64>, ) -> Result<()>
Update the status of a task and include elapsed duration in the event.
Use this at task completion points (success or failure) so the notify subscriber can include accurate timing in channel messages instead of 0.0.
Sourcepub async fn mark_task_done_by_store_id(
&self,
store_id: i64,
repo: &str,
ext_id: &ExternalId,
) -> Result<()>
pub async fn mark_task_done_by_store_id( &self, store_id: i64, repo: &str, ext_id: &ExternalId, ) -> Result<()>
Mark an already-resolved task Done directly by its numeric store id and owning
repo, bypassing the repo-scoped resolve_task_id lookup that self.repo would
otherwise apply. For callers that already hold the correct store row from a
cross-repo query — e.g. the global CI-failure unblock sweep — and would otherwise
fail to resolve a task belonging to a different repo than this TaskManager.
Sourcepub async fn update_task_status_by_store_id(
&self,
store_id: i64,
repo: &str,
ext_id: &ExternalId,
status: Status,
) -> Result<()>
pub async fn update_task_status_by_store_id( &self, store_id: i64, repo: &str, ext_id: &ExternalId, status: Status, ) -> Result<()>
Update a task’s status directly by its already-resolved numeric store id and
owning repo, bypassing the repo-scoped resolve_task_id lookup that self.repo
would otherwise apply. For callers that already hold the correct store row from a
cross-repo query — e.g. a global sweep over tasks from inactive/removed repos —
and would otherwise fail to resolve a task belonging to a different repo than this
TaskManager. Does not mirror to the backend (GitHub), since the caller’s backend
instance may not correspond to the task’s owning repo.
Sourcepub async fn update_task_status_and_result_by_store_id(
&self,
store_id: i64,
repo: &str,
ext_id: &ExternalId,
status: Status,
updates: &[(&str, Value)],
) -> Result<()>
pub async fn update_task_status_and_result_by_store_id( &self, store_id: i64, repo: &str, ext_id: &ExternalId, status: Status, updates: &[(&str, Value)], ) -> Result<()>
Like Self::update_task_status_by_store_id but also sets additional result
fields atomically with the status transition (e.g. block_reason, last_error).
Sourcepub async fn list_internal_by_status(
&self,
status: TaskStatus,
) -> Result<Vec<ExternalTask>>
pub async fn list_internal_by_status( &self, status: TaskStatus, ) -> Result<Vec<ExternalTask>>
List internal tasks by status from the store. Returns store::Task items converted to ExternalTask for backward compatibility.
Sourcepub async fn list_all_internal(&self) -> Result<Vec<Task>>
pub async fn list_all_internal(&self) -> Result<Vec<Task>>
List all internal tasks from the store.
pub async fn publish_task( &self, id: i64, labels: &[String], ) -> Result<ExternalId>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for TaskManager
impl !UnwindSafe for TaskManager
impl Freeze for TaskManager
impl Send for TaskManager
impl Sync for TaskManager
impl Unpin for TaskManager
impl UnsafeUnpin for TaskManager
Blanket Implementations§
Source§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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more