pub struct TaskManager<'a> { /* private fields */ }Implementations§
Source§impl<'a> TaskManager<'a>
impl<'a> TaskManager<'a>
pub fn new(pool: &'a SqlitePool) -> Self
Sourcepub async fn add_task(
&self,
name: &str,
spec: Option<&str>,
parent_id: Option<i64>,
) -> Result<Task>
pub async fn add_task( &self, name: &str, spec: Option<&str>, parent_id: Option<i64>, ) -> Result<Task>
Add a new task
Sourcepub async fn get_task_with_events(&self, id: i64) -> Result<TaskWithEvents>
pub async fn get_task_with_events(&self, id: i64) -> Result<TaskWithEvents>
Get a task with events summary
Sourcepub async fn update_task(
&self,
id: i64,
name: Option<&str>,
spec: Option<&str>,
parent_id: Option<Option<i64>>,
status: Option<&str>,
complexity: Option<i32>,
priority: Option<i32>,
) -> Result<Task>
pub async fn update_task( &self, id: i64, name: Option<&str>, spec: Option<&str>, parent_id: Option<Option<i64>>, status: Option<&str>, complexity: Option<i32>, priority: Option<i32>, ) -> Result<Task>
Update a task
Sourcepub async fn delete_task(&self, id: i64) -> Result<()>
pub async fn delete_task(&self, id: i64) -> Result<()>
Delete a task
Sourcepub async fn find_tasks(
&self,
status: Option<&str>,
parent_id: Option<Option<i64>>,
) -> Result<Vec<Task>>
pub async fn find_tasks( &self, status: Option<&str>, parent_id: Option<Option<i64>>, ) -> Result<Vec<Task>>
Find tasks with optional filters
Sourcepub async fn start_task(
&self,
id: i64,
with_events: bool,
) -> Result<TaskWithEvents>
pub async fn start_task( &self, id: i64, with_events: bool, ) -> Result<TaskWithEvents>
Start a task (atomic: update status + set current)
Sourcepub async fn done_task(&self, id: i64) -> Result<Task>
pub async fn done_task(&self, id: i64) -> Result<Task>
Complete a task (atomic: check children + update status + clear current if needed)
Sourcepub async fn switch_to_task(&self, id: i64) -> Result<TaskWithEvents>
pub async fn switch_to_task(&self, id: i64) -> Result<TaskWithEvents>
Switch to a specific task (atomic: update status to doing + set as current) If the task is not in ‘doing’ status, it will be transitioned to ‘doing’
Sourcepub async fn spawn_subtask(
&self,
name: &str,
spec: Option<&str>,
) -> Result<Task>
pub async fn spawn_subtask( &self, name: &str, spec: Option<&str>, ) -> Result<Task>
Create a subtask under the current task and switch to it (atomic operation) Returns error if there is no current task
Sourcepub async fn pick_next_tasks(
&self,
max_count: usize,
capacity_limit: usize,
) -> Result<Vec<Task>>
pub async fn pick_next_tasks( &self, max_count: usize, capacity_limit: usize, ) -> Result<Vec<Task>>
Intelligently pick tasks from ‘todo’ and transition them to ‘doing’ Returns tasks that were successfully transitioned
§Arguments
max_count- Maximum number of tasks to pickcapacity_limit- Maximum total number of tasks allowed in ‘doing’ status
§Logic
- Check current ‘doing’ task count
- Calculate available capacity
- Select tasks from ‘todo’ (prioritized by: priority DESC, complexity ASC)
- Transition selected tasks to ‘doing’
Auto Trait Implementations§
impl<'a> Freeze for TaskManager<'a>
impl<'a> !RefUnwindSafe for TaskManager<'a>
impl<'a> Send for TaskManager<'a>
impl<'a> Sync for TaskManager<'a>
impl<'a> Unpin for TaskManager<'a>
impl<'a> !UnwindSafe for TaskManager<'a>
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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