pub struct IdempotentResult {
pub idem_key: IdempotencyKey,
pub intent_id: String,
pub result: IdempotentExecutionResult,
pub stored_at: DateTime<Utc>,
pub expires_at: DateTime<Utc>,
pub access_count: u32,
}Expand description
Result stored with idempotency key to prevent duplicate execution
Fields§
§idem_key: IdempotencyKeyThe idempotency key this result is associated with
intent_id: StringIntent ID that was executed
result: IdempotentExecutionResultExecution result (success/failure)
stored_at: DateTime<Utc>When this result was first stored
expires_at: DateTime<Utc>When this result expires (for cleanup)
access_count: u32Number of times this key was accessed
Implementations§
Source§impl IdempotentResult
impl IdempotentResult
Sourcepub fn success(
idem_key: IdempotencyKey,
intent_id: String,
output: Value,
ttl_hours: u32,
) -> Self
pub fn success( idem_key: IdempotencyKey, intent_id: String, output: Value, ttl_hours: u32, ) -> Self
Create a new successful result
Sourcepub fn error(
idem_key: IdempotencyKey,
intent_id: String,
error_code: String,
error_message: String,
ttl_hours: u32,
) -> Self
pub fn error( idem_key: IdempotencyKey, intent_id: String, error_code: String, error_message: String, ttl_hours: u32, ) -> Self
Create a new error result
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Check if this result has expired
Sourcepub fn increment_access(&mut self)
pub fn increment_access(&mut self)
Increment access count
Trait Implementations§
Source§impl Clone for IdempotentResult
impl Clone for IdempotentResult
Source§fn clone(&self) -> IdempotentResult
fn clone(&self) -> IdempotentResult
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 IdempotentResult
impl Debug for IdempotentResult
Source§impl<'de> Deserialize<'de> for IdempotentResult
impl<'de> Deserialize<'de> for IdempotentResult
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 IdempotentResult
impl RefUnwindSafe for IdempotentResult
impl Send for IdempotentResult
impl Sync for IdempotentResult
impl Unpin for IdempotentResult
impl UnsafeUnpin for IdempotentResult
impl UnwindSafe for IdempotentResult
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