pub struct TaskMeta {Show 16 fields
pub task_id: Uuid,
pub task_name: String,
pub result: TaskResult,
pub created_at: DateTime<Utc>,
pub started_at: Option<DateTime<Utc>>,
pub completed_at: Option<DateTime<Utc>>,
pub worker: Option<String>,
pub progress: Option<ProgressInfo>,
pub version: u32,
pub tags: Vec<String>,
pub metadata: HashMap<String, Value>,
pub worker_hostname: Option<String>,
pub runtime_ms: Option<u64>,
pub memory_bytes: Option<u64>,
pub retries: Option<u32>,
pub queue: Option<String>,
}Expand description
Task metadata stored in result backend
Fields§
§task_id: UuidTask ID
task_name: StringTask name
result: TaskResultTask status/result
created_at: DateTime<Utc>Timestamp when task was created
started_at: Option<DateTime<Utc>>Timestamp when task was started
completed_at: Option<DateTime<Utc>>Timestamp when task completed
worker: Option<String>Worker that executed the task
progress: Option<ProgressInfo>Task progress (for long-running tasks)
version: u32Version number for result versioning
Tags for categorizing and filtering tasks
metadata: HashMap<String, Value>Custom metadata for flexible key-value storage
worker_hostname: Option<String>Worker hostname that executed the task
runtime_ms: Option<u64>Task runtime in milliseconds
memory_bytes: Option<u64>Peak memory usage in bytes during execution
retries: Option<u32>Number of retries before completion
queue: Option<String>Queue the task was consumed from
Implementations§
Source§impl TaskMeta
impl TaskMeta
pub fn new(task_id: Uuid, task_name: String) -> TaskMeta
Sourcepub fn has_started(&self) -> bool
pub fn has_started(&self) -> bool
Check if the task has started
Sourcepub fn has_completed(&self) -> bool
pub fn has_completed(&self) -> bool
Check if the task has completed
Sourcepub fn has_progress(&self) -> bool
pub fn has_progress(&self) -> bool
Check if the task has progress information
Sourcepub fn execution_time(&self) -> Option<TimeDelta>
pub fn execution_time(&self) -> Option<TimeDelta>
Get the execution time (time since start)
Sourcepub fn is_terminal(&self) -> bool
pub fn is_terminal(&self) -> bool
Check if the task is in a terminal state
Sourcepub fn remove_tag(&mut self, tag: &str)
pub fn remove_tag(&mut self, tag: &str)
Remove a tag from this task
Sourcepub fn has_any_tag(&self, tags: &[String]) -> bool
pub fn has_any_tag(&self, tags: &[String]) -> bool
Check if this task has any of the specified tags
Check if this task has all of the specified tags
Sourcepub fn set_metadata(&mut self, key: impl Into<String>, value: Value)
pub fn set_metadata(&mut self, key: impl Into<String>, value: Value)
Set a custom metadata field
Sourcepub fn get_metadata(&self, key: &str) -> Option<&Value>
pub fn get_metadata(&self, key: &str) -> Option<&Value>
Get a custom metadata field
Sourcepub fn remove_metadata(&mut self, key: &str) -> Option<Value>
pub fn remove_metadata(&mut self, key: &str) -> Option<Value>
Remove a custom metadata field
Sourcepub fn has_metadata(&self, key: &str) -> bool
pub fn has_metadata(&self, key: &str) -> bool
Check if a custom metadata field exists
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TaskMeta
impl<'de> Deserialize<'de> for TaskMeta
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<TaskMeta, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<TaskMeta, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for TaskMeta
impl Serialize for TaskMeta
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for TaskMeta
impl RefUnwindSafe for TaskMeta
impl Send for TaskMeta
impl Sync for TaskMeta
impl Unpin for TaskMeta
impl UnsafeUnpin for TaskMeta
impl UnwindSafe for TaskMeta
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
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> 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>
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>
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