pub struct ResultMetadata {
pub tags: Vec<String>,
pub custom_fields: HashMap<String, Value>,
pub created_at: DateTime<Utc>,
pub expires_at: Option<DateTime<Utc>>,
pub compressed: bool,
pub compression_algorithm: Option<String>,
pub chunked: bool,
pub total_chunks: Option<usize>,
pub original_size: Option<usize>,
pub compressed_size: Option<usize>,
}Expand description
Result metadata for storing additional information with task results
Fields§
Custom tags for categorization
custom_fields: HashMap<String, Value>Custom key-value fields
created_at: DateTime<Utc>Result creation timestamp
expires_at: Option<DateTime<Utc>>Result expiration timestamp (TTL)
compressed: boolWhether the result is compressed
compression_algorithm: Option<String>Compression algorithm used (if compressed)
chunked: boolWhether the result is chunked
total_chunks: Option<usize>Total number of chunks (if chunked)
original_size: Option<usize>Original size in bytes (before compression/chunking)
compressed_size: Option<usize>Compressed size in bytes
Implementations§
Source§impl ResultMetadata
impl ResultMetadata
Add multiple tags
Sourcepub fn with_field(self, key: impl Into<String>, value: Value) -> Self
pub fn with_field(self, key: impl Into<String>, value: Value) -> Self
Add a custom field
Sourcepub fn with_ttl(self, ttl: Duration) -> Self
pub fn with_ttl(self, ttl: Duration) -> Self
§Panics
Panics if the TTL duration cannot be converted to a chrono duration. Set TTL (time to live)
Sourcepub fn with_expires_at(self, expires_at: DateTime<Utc>) -> Self
pub fn with_expires_at(self, expires_at: DateTime<Utc>) -> Self
Set expiration timestamp
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Check if the result has expired
Sourcepub fn time_until_expiration(&self) -> Option<Duration>
pub fn time_until_expiration(&self) -> Option<Duration>
Get time until expiration
Sourcepub fn with_compression(
self,
algorithm: impl Into<String>,
original_size: usize,
compressed_size: usize,
) -> Self
pub fn with_compression( self, algorithm: impl Into<String>, original_size: usize, compressed_size: usize, ) -> Self
Mark as compressed
Sourcepub fn with_chunking(self, total_chunks: usize) -> Self
pub fn with_chunking(self, total_chunks: usize) -> Self
Mark as chunked
Sourcepub fn compression_ratio(&self) -> Option<f64>
pub fn compression_ratio(&self) -> Option<f64>
Get compression ratio
Trait Implementations§
Source§impl Clone for ResultMetadata
impl Clone for ResultMetadata
Source§fn clone(&self) -> ResultMetadata
fn clone(&self) -> ResultMetadata
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ResultMetadata
impl Debug for ResultMetadata
Source§impl Default for ResultMetadata
impl Default for ResultMetadata
Source§impl<'de> Deserialize<'de> for ResultMetadata
impl<'de> Deserialize<'de> for ResultMetadata
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 ResultMetadata
impl RefUnwindSafe for ResultMetadata
impl Send for ResultMetadata
impl Sync for ResultMetadata
impl Unpin for ResultMetadata
impl UnwindSafe for ResultMetadata
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