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) -> Result<Docket, DocketError>
pub fn new(settings: DocketSettings) -> Result<Docket, DocketError>
Creates a new Docket with the given settings.
Sourcepub fn submit(
&self,
task_type: impl Into<String>,
params: Value,
) -> Result<TaskId, DocketError>
pub fn submit( &self, task_type: impl Into<String>, params: Value, ) -> Result<TaskId, DocketError>
Submits a task to the queue.
Sourcepub fn submit_with_options(
&self,
task_type: impl Into<String>,
params: Value,
options: SubmitOptions,
) -> Result<TaskId, DocketError>
pub fn submit_with_options( &self, task_type: impl Into<String>, params: Value, options: SubmitOptions, ) -> Result<TaskId, DocketError>
Submits a task with custom options.
Sourcepub fn get_task(
&self,
task_id: &TaskId,
) -> Result<Option<DocketTask>, DocketError>
pub fn get_task( &self, task_id: &TaskId, ) -> Result<Option<DocketTask>, DocketError>
Gets a task by ID.
Sourcepub fn list_tasks(
&self,
status: Option<TaskStatus>,
limit: usize,
) -> Result<Vec<DocketTask>, DocketError>
pub fn list_tasks( &self, status: Option<TaskStatus>, limit: usize, ) -> Result<Vec<DocketTask>, DocketError>
Lists tasks with optional status filter.
Sourcepub fn cancel(
&self,
task_id: &TaskId,
reason: Option<&str>,
) -> Result<(), DocketError>
pub fn cancel( &self, task_id: &TaskId, reason: Option<&str>, ) -> Result<(), DocketError>
Cancels a task.
Sourcepub fn stats(&self) -> Result<QueueStats, DocketError>
pub fn stats(&self) -> Result<QueueStats, DocketError>
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 !UnwindSafe for Docket
impl Send for Docket
impl Sync for Docket
impl Unpin for Docket
impl UnsafeUnpin 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).
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