pub struct Docket { /* private fields */ }Expand description
Docket distributed task queue.
The main entry point for submitting and managing distributed tasks.
Implementations§
Source§impl Docket
impl Docket
Sourcepub fn new(settings: DocketSettings) -> DocketResult<Self>
pub fn new(settings: DocketSettings) -> DocketResult<Self>
Creates a new Docket with the given settings.
Sourcepub fn submit(
&self,
task_type: impl Into<String>,
params: Value,
) -> DocketResult<TaskId>
pub fn submit( &self, task_type: impl Into<String>, params: Value, ) -> DocketResult<TaskId>
Submits a task to the queue.
Sourcepub fn submit_with_options(
&self,
task_type: impl Into<String>,
params: Value,
options: SubmitOptions,
) -> DocketResult<TaskId>
pub fn submit_with_options( &self, task_type: impl Into<String>, params: Value, options: SubmitOptions, ) -> DocketResult<TaskId>
Submits a task with custom options.
Sourcepub fn get_task(&self, task_id: &TaskId) -> DocketResult<Option<DocketTask>>
pub fn get_task(&self, task_id: &TaskId) -> DocketResult<Option<DocketTask>>
Gets a task by ID.
Sourcepub fn list_tasks(
&self,
status: Option<TaskStatus>,
limit: usize,
) -> DocketResult<Vec<DocketTask>>
pub fn list_tasks( &self, status: Option<TaskStatus>, limit: usize, ) -> DocketResult<Vec<DocketTask>>
Lists tasks with optional status filter.
Sourcepub fn cancel(&self, task_id: &TaskId, reason: Option<&str>) -> DocketResult<()>
pub fn cancel(&self, task_id: &TaskId, reason: Option<&str>) -> DocketResult<()>
Cancels a task.
Sourcepub fn stats(&self) -> DocketResult<QueueStats>
pub fn stats(&self) -> DocketResult<QueueStats>
Returns queue statistics.
Sourcepub fn worker(&self) -> WorkerBuilder
pub fn worker(&self) -> WorkerBuilder
Creates a worker builder.
Sourcepub fn settings(&self) -> &DocketSettings
pub fn settings(&self) -> &DocketSettings
Returns the settings.
Converts to a shared handle.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Docket
impl !RefUnwindSafe for Docket
impl Send for Docket
impl Sync for Docket
impl Unpin for Docket
impl !UnwindSafe for Docket
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: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).