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>
impl<R: DeserializeOwned> InvocationHandle<R>
Sourcepub fn new(
invocation_id: InvocationId,
orchestrator: Arc<dyn Orchestrator>,
state_backend: Arc<dyn StateBackend>,
) -> Self
pub fn new( invocation_id: InvocationId, orchestrator: Arc<dyn Orchestrator>, state_backend: Arc<dyn StateBackend>, ) -> Self
Create a new handle from raw parts.
Sourcepub fn invocation_id(&self) -> &InvocationId
pub fn invocation_id(&self) -> &InvocationId
Get the invocation’s unique identifier.
Sourcepub async fn status(&self) -> RustvelloResult<InvocationStatus>
pub async fn status(&self) -> RustvelloResult<InvocationStatus>
Get the current status of this invocation.
Sourcepub async fn is_done(&self) -> RustvelloResult<bool>
pub async fn is_done(&self) -> RustvelloResult<bool>
Check if the invocation has finished (success or failure).
Sourcepub async fn result(&self) -> RustvelloResult<R>
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.
Sourcepub async fn wait(&self, poll_interval: Duration) -> RustvelloResult<R>
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.
Sourcepub async fn wait_timeout(
&self,
timeout: Duration,
poll_interval: Duration,
) -> RustvelloResult<R>
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.
Sourcepub fn into_untyped(self) -> InvocationHandle<String>
pub fn into_untyped(self) -> InvocationHandle<String>
Erase the result type, returning a handle that yields raw JSON strings.