pub struct TaskQueue { /* private fields */ }Expand description
Task queue backed by SQLite for persistence
Implementations§
Source§impl TaskQueue
impl TaskQueue
Sourcepub fn new(
sync_db: SyncDb,
profile_id: i32,
pipeline: Option<SyncPipeline>,
) -> Self
pub fn new( sync_db: SyncDb, profile_id: i32, pipeline: Option<SyncPipeline>, ) -> Self
Create a new task queue
Sourcepub fn pop_with_pipeline(
&self,
pipeline: Option<SyncPipeline>,
) -> Result<Option<SyncTask>>
pub fn pop_with_pipeline( &self, pipeline: Option<SyncPipeline>, ) -> Result<Option<SyncTask>>
Get the next pending task for a specific pipeline
Sourcepub fn pop_round_robin(&mut self) -> Result<Option<SyncTask>>
pub fn pop_round_robin(&mut self) -> Result<Option<SyncTask>>
Pop the next task using round-robin across primary task types
Sourcepub fn pop_round_robin_with_pipeline(
&mut self,
pipeline: Option<SyncPipeline>,
) -> Result<Option<SyncTask>>
pub fn pop_round_robin_with_pipeline( &mut self, pipeline: Option<SyncPipeline>, ) -> Result<Option<SyncTask>>
Pop the next task using round-robin across primary task types for a pipeline
Sourcepub fn mark_in_progress(&self, task_id: i64) -> Result<()>
pub fn mark_in_progress(&self, task_id: i64) -> Result<()>
Mark a task as in progress
Sourcepub fn mark_completed(&self, task_id: i64) -> Result<()>
pub fn mark_completed(&self, task_id: i64) -> Result<()>
Mark a task as completed
Sourcepub fn mark_failed(
&self,
task_id: i64,
error: &str,
retry_after: Duration,
) -> Result<()>
pub fn mark_failed( &self, task_id: i64, error: &str, retry_after: Duration, ) -> Result<()>
Mark a task as failed with retry
Sourcepub fn recover_in_progress(&self) -> Result<u32>
pub fn recover_in_progress(&self) -> Result<u32>
Recover tasks that were in progress (crashed)
Sourcepub fn pending_count(&self) -> Result<u32>
pub fn pending_count(&self) -> Result<u32>
Get count of pending tasks
Sourcepub fn pending_count_with_pipeline(
&self,
pipeline: Option<SyncPipeline>,
) -> Result<u32>
pub fn pending_count_with_pipeline( &self, pipeline: Option<SyncPipeline>, ) -> Result<u32>
Get count of pending tasks for a pipeline
Sourcepub fn set_profile_id(&mut self, profile_id: i32)
pub fn set_profile_id(&mut self, profile_id: i32)
Update the profile scope for queue operations
Sourcepub fn set_pipeline(&mut self, pipeline: Option<SyncPipeline>)
pub fn set_pipeline(&mut self, pipeline: Option<SyncPipeline>)
Update the pipeline scope for queue operations
Sourcepub fn count_by_type(&self) -> Result<(u32, u32, u32, u32)>
pub fn count_by_type(&self) -> Result<(u32, u32, u32, u32)>
Get task counts by type (activities, gpx, health, performance)
Sourcepub fn reset_failed(&self) -> Result<u32>
pub fn reset_failed(&self) -> Result<u32>
Reset all failed tasks to pending
Sourcepub fn clear_pending(&self) -> Result<u32>
pub fn clear_pending(&self) -> Result<u32>
Clear all pending and failed tasks
Auto Trait Implementations§
impl !Freeze for TaskQueue
impl !RefUnwindSafe for TaskQueue
impl Send for TaskQueue
impl !Sync for TaskQueue
impl Unpin for TaskQueue
impl UnsafeUnpin for TaskQueue
impl !UnwindSafe for TaskQueue
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