pub struct Task {
pub id: TaskId,
pub partition_id: PartitionId,
pub operation: TaskOperation,
pub status: TaskStatus,
pub worker_id: Option<String>,
pub retry_count: u32,
pub max_retries: u32,
}Expand description
A task to be executed by a worker.
Fields§
§id: TaskIdUnique task identifier.
partition_id: PartitionIdPartition to process.
operation: TaskOperationOperation to perform.
status: TaskStatusCurrent status.
worker_id: Option<String>Worker ID assigned to this task (if any).
retry_count: u32Number of retry attempts.
max_retries: u32Maximum number of retries allowed.
Implementations§
Source§impl Task
impl Task
Sourcepub fn new(
id: TaskId,
partition_id: PartitionId,
operation: TaskOperation,
) -> Self
pub fn new( id: TaskId, partition_id: PartitionId, operation: TaskOperation, ) -> Self
Create a new task.
Sourcepub fn mark_running(&mut self, worker_id: String)
pub fn mark_running(&mut self, worker_id: String)
Mark the task as running on a specific worker.
Sourcepub fn mark_completed(&mut self)
pub fn mark_completed(&mut self)
Mark the task as completed.
Sourcepub fn mark_failed(&mut self)
pub fn mark_failed(&mut self)
Mark the task as failed and increment retry count.
Sourcepub fn mark_cancelled(&mut self)
pub fn mark_cancelled(&mut self)
Mark the task as cancelled.
Sourcepub fn reset_for_retry(&mut self)
pub fn reset_for_retry(&mut self)
Reset the task for retry.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Task
impl<'de> Deserialize<'de> for Task
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Task
impl RefUnwindSafe for Task
impl Send for Task
impl Sync for Task
impl Unpin for Task
impl UnsafeUnpin for Task
impl UnwindSafe for Task
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> 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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request