pub struct Task {
pub id: TaskId,
pub name: String,
pub payload: Bytes,
pub priority: TaskPriority,
pub timeout: Duration,
pub max_retries: u32,
pub retry_count: u32,
pub dependencies: Vec<TaskId>,
pub metadata: TaskMetadata,
pub status: TaskStatus,
pub result: Option<TaskResult>,
}Expand description
A task to be executed in the cluster
Fields§
§id: TaskIdUnique task identifier
name: StringTask name/label
payload: BytesTask payload (serialized input)
priority: TaskPriorityTask priority
timeout: DurationMaximum execution time
max_retries: u32Maximum retry attempts
retry_count: u32Current retry attempt
dependencies: Vec<TaskId>Task dependencies (must complete before this task runs)
metadata: TaskMetadataTask metadata
status: TaskStatusTask status
result: Option<TaskResult>Task result (if completed)
Implementations§
Source§impl Task
impl Task
Sourcepub fn new(name: impl Into<String>, payload: Bytes) -> Self
pub fn new(name: impl Into<String>, payload: Bytes) -> Self
Create a new task with the given name and payload
Sourcepub fn with_priority(self, priority: TaskPriority) -> Self
pub fn with_priority(self, priority: TaskPriority) -> Self
Set task priority
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Set task timeout
Sourcepub fn with_max_retries(self, max_retries: u32) -> Self
pub fn with_max_retries(self, max_retries: u32) -> Self
Set maximum retries
Sourcepub fn with_dependency(self, task_id: TaskId) -> Self
pub fn with_dependency(self, task_id: TaskId) -> Self
Add a dependency
Sourcepub fn increment_retry(&mut self)
pub fn increment_retry(&mut self)
Increment retry count
Sourcepub fn transition_to(&mut self, new_status: TaskStatus) -> PolarisResult<()>
pub fn transition_to(&mut self, new_status: TaskStatus) -> PolarisResult<()>
Transition to a new status
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 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