Skip to main content

InvocationHandle

Struct InvocationHandle 

Source
pub struct InvocationHandle<R: DeserializeOwned = String> { /* private fields */ }
Expand description

Handle to a submitted invocation with typed result access.

Mirrors pynenc’s BaseInvocation hierarchy. Provides:

  • Status checking (non-blocking)
  • Typed result retrieval (blocking or polling)
  • Access to the invocation identity

§Example

use rustvello_core::invocation::InvocationHandle;

// After submitting a task:
// let handle: InvocationHandle<i32> = app.submit(&my_task, params).await?;
// let status = handle.status().await?;
// let result: i32 = handle.result().await?;

Implementations§

Source§

impl<R: DeserializeOwned> InvocationHandle<R>

Source

pub fn new( invocation_id: InvocationId, orchestrator: Arc<dyn Orchestrator>, state_backend: Arc<dyn StateBackend>, ) -> Self

Create a new handle from raw parts.

Source

pub fn invocation_id(&self) -> &InvocationId

Get the invocation’s unique identifier.

Source

pub async fn status(&self) -> RustvelloResult<InvocationStatus>

Get the current status of this invocation.

Source

pub async fn is_done(&self) -> RustvelloResult<bool>

Check if the invocation has finished (success or failure).

Source

pub async fn result(&self) -> RustvelloResult<R>

Get the typed result of a completed invocation.

Returns an error if the invocation is not yet complete or failed.

Source

pub async fn wait(&self, poll_interval: Duration) -> RustvelloResult<R>

Wait for the invocation to complete, polling at the given interval.

Returns the typed result once the invocation reaches a terminal state.

Note: Uses a fixed poll interval with no backoff. For long-running tasks, prefer a longer interval (e.g., 500ms–2s) to reduce backend load.

Source

pub async fn wait_timeout( &self, timeout: Duration, poll_interval: Duration, ) -> RustvelloResult<R>

Wait for the invocation to complete with a timeout.

Returns Err(Timeout) if the invocation does not complete within the given duration.

Source

pub fn into_untyped(self) -> InvocationHandle<String>

Erase the result type, returning a handle that yields raw JSON strings.

Trait Implementations§

Source§

impl<R: DeserializeOwned> Debug for InvocationHandle<R>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<R> Freeze for InvocationHandle<R>

§

impl<R = String> !RefUnwindSafe for InvocationHandle<R>

§

impl<R> Send for InvocationHandle<R>
where R: Send,

§

impl<R> Sync for InvocationHandle<R>
where R: Sync,

§

impl<R> Unpin for InvocationHandle<R>
where R: Unpin,

§

impl<R> UnsafeUnpin for InvocationHandle<R>

§

impl<R = String> !UnwindSafe for InvocationHandle<R>

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> 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> Same for T

Source§

type Output = T

Should always be Self
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