Skip to main content

DurableExecutionInvocationOutput

Struct DurableExecutionInvocationOutput 

Source
pub struct DurableExecutionInvocationOutput {
    pub status: InvocationStatus,
    pub result: Option<String>,
    pub error: Option<ErrorObject>,
}
Expand description

Output payload for a durable execution Lambda invocation.

This struct is serialized and returned from the Lambda function to indicate the execution status.

Fields§

§status: InvocationStatus

The status of the invocation

§result: Option<String>

The serialized result if the execution succeeded

§error: Option<ErrorObject>

Error details if the execution failed

Implementations§

Source§

impl DurableExecutionInvocationOutput

Source

pub const MAX_RESPONSE_SIZE: usize

Maximum response size in bytes (6MB Lambda limit)

Source

pub fn succeeded(result: Option<String>) -> Self

Creates a new output indicating successful completion.

Source

pub fn failed(error: ErrorObject) -> Self

Creates a new output indicating failure.

Source

pub fn pending() -> Self

Creates a new output indicating pending/suspended execution.

Source

pub fn is_succeeded(&self) -> bool

Returns true if the invocation succeeded.

Source

pub fn is_failed(&self) -> bool

Returns true if the invocation failed.

Source

pub fn is_pending(&self) -> bool

Returns true if the invocation is pending.

Source

pub fn from_result<T: Serialize>(result: &T) -> Self

Creates an output from a serializable result.

This method handles:

  • Serializing the result to JSON
  • Checking if the response exceeds the maximum size
  • Returning appropriate error if serialization fails
§Arguments
  • result - The result to serialize
§Returns

A DurableExecutionInvocationOutput with:

  • SUCCEEDED status if serialization succeeds and size is within limits
  • FAILED status if serialization fails or response is too large
Source

pub fn from_error(error: &DurableError) -> Self

Creates an output from a DurableError.

This method handles different error types:

  • Suspend errors return PENDING status
  • All other errors return FAILED status with error details
§Arguments
  • error - The error to convert
§Returns

A DurableExecutionInvocationOutput with appropriate status

Source

pub fn would_exceed_max_size<T: Serialize>(result: &T) -> bool

Checks if a result would exceed the maximum response size.

This is useful for determining if a result should be checkpointed before returning.

§Arguments
  • result - The result to check
§Returns

true if the serialized result would exceed the maximum size

Source

pub fn checkpointed_result(checkpoint_id: &str, original_size: usize) -> Self

Creates an output for a large result that has been checkpointed.

This method creates a SUCCEEDED output with a reference to the checkpointed result, rather than the result itself.

§Arguments
  • checkpoint_id - The operation ID where the result was checkpointed
  • original_size - The size of the original serialized result in bytes
§Returns

A DurableExecutionInvocationOutput with SUCCEEDED status and a reference to the checkpointed result.

Source

pub fn is_checkpointed_result(&self) -> bool

Checks if this output represents a checkpointed large result.

§Returns

true if this output contains a reference to a checkpointed result

Trait Implementations§

Source§

impl Clone for DurableExecutionInvocationOutput

Source§

fn clone(&self) -> DurableExecutionInvocationOutput

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 DurableExecutionInvocationOutput

Source§

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

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

impl From<Result<Option<String>, ErrorObject>> for DurableExecutionInvocationOutput

Source§

fn from(result: Result<Option<String>, ErrorObject>) -> Self

Converts to this type from the input type.
Source§

impl From<Result<String, ErrorObject>> for DurableExecutionInvocationOutput

Source§

fn from(result: Result<String, ErrorObject>) -> Self

Converts to this type from the input type.
Source§

impl Serialize for DurableExecutionInvocationOutput

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::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<B> IntoFunctionResponse<B, Body> for B
where B: Serialize,

Source§

fn into_response(self) -> FunctionResponse<B, Body>

Convert the type into a FunctionResponse.
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. 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, 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<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