#[non_exhaustive]pub enum Invocation<R: DeserializeOwned> {
Sync(SyncInvocation<R>),
Distributed(InvocationHandle<R>),
}Expand description
Unified invocation type — same API for sync and distributed execution.
Created by app.call(). The caller doesn’t need to know whether the task
was executed synchronously or routed through the broker.
Matches pynenc’s pattern where Task._call() returns either a
ConcurrentInvocation or DistributedInvocation through a common
BaseInvocation interface.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Sync(SyncInvocation<R>)
Sync execution (dev mode). Result is already computed.
Distributed(InvocationHandle<R>)
Distributed execution. Result available after runner processes it.
Implementations§
Source§impl<R: DeserializeOwned> Invocation<R>
impl<R: DeserializeOwned> Invocation<R>
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.
For sync invocations, returns immediately. For distributed invocations, may fail if not yet complete.
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.
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 with a timeout.
Sourcepub fn is_distributed(&self) -> bool
pub fn is_distributed(&self) -> bool
Returns true if this is a distributed invocation.