Skip to main content

TaskMeta

Struct TaskMeta 

Source
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: Uuid

Task ID

§task_name: String

Task name

§result: TaskResult

Task 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: u32

Version number for result versioning

§tags: Vec<String>

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

Source

pub fn new(task_id: Uuid, task_name: String) -> TaskMeta

Source

pub fn has_started(&self) -> bool

Check if the task has started

Source

pub fn has_completed(&self) -> bool

Check if the task has completed

Source

pub fn has_progress(&self) -> bool

Check if the task has progress information

Source

pub fn duration(&self) -> Option<TimeDelta>

Get the task duration if completed

Source

pub fn age(&self) -> TimeDelta

Get the task age (time since creation)

Source

pub fn execution_time(&self) -> Option<TimeDelta>

Get the execution time (time since start)

Source

pub fn is_terminal(&self) -> bool

Check if the task is in a terminal state

Source

pub fn is_active(&self) -> bool

Check if the task is in an active state

Source

pub fn add_tag(&mut self, tag: impl Into<String>)

Add a tag to this task

Source

pub fn remove_tag(&mut self, tag: &str)

Remove a tag from this task

Source

pub fn has_tag(&self, tag: &str) -> bool

Check if this task has a specific tag

Source

pub fn has_any_tag(&self, tags: &[String]) -> bool

Check if this task has any of the specified tags

Source

pub fn has_all_tags(&self, tags: &[String]) -> bool

Check if this task has all of the specified tags

Source

pub fn set_metadata(&mut self, key: impl Into<String>, value: Value)

Set a custom metadata field

Source

pub fn get_metadata(&self, key: &str) -> Option<&Value>

Get a custom metadata field

Source

pub fn remove_metadata(&mut self, key: &str) -> Option<Value>

Remove a custom metadata field

Source

pub fn has_metadata(&self, key: &str) -> bool

Check if a custom metadata field exists

Trait Implementations§

Source§

impl Clone for TaskMeta

Source§

fn clone(&self) -> TaskMeta

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TaskMeta

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for TaskMeta

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<TaskMeta, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for TaskMeta

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Serialize for TaskMeta

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,