Skip to main content

RemoteHandle

Struct RemoteHandle 

Source
pub struct RemoteHandle { /* private fields */ }
Expand description

Handle to a remote task, analogous to TaskHandle.

RemoteHandle is returned by spawn_remote and provides:

  • The remote task ID for identification and tracing
  • The target node and computation name for debugging
  • join() to await the remote result
  • abort(&Cx) to request cancellation of the remote task

§Region Ownership

The RemoteHandle is owned by the local region. When the region closes, all remote handles participate in quiescence: the region waits for remote tasks to complete (or escalates via cancellation/lease expiry).

§Current Contract

The handle is the local, region-owned proxy for the remote lifecycle defined in this module. Attached runtimes drive it via the explicit spawn/ack/cancel/result/lease protocol. When no runtime is attached, the handle resolves through the configured deterministic fallback instead of silently spawning detached work.

Implementations§

Source§

impl RemoteHandle

Source

pub fn remote_task_id(&self) -> RemoteTaskId

Returns the remote task ID.

Source

pub fn local_task_id(&self) -> Option<TaskId>

Returns the local proxy task ID, if one was assigned.

Source

pub fn node(&self) -> &NodeId

Returns the target node.

Source

pub fn computation(&self) -> &ComputationName

Returns the computation name.

Source

pub fn owner_region(&self) -> RegionId

Returns the owning region.

Source

pub fn lease(&self) -> Duration

Returns the lease duration.

Source

pub fn state(&self) -> RemoteTaskState

Returns the current observed state of the remote task.

Source

pub fn is_finished(&self) -> bool

Returns true if a terminal remote result has been buffered locally.

A merely closed result channel does not count as finished here. The sender may have disappeared before the remote lifecycle reached a terminal state, and callers still need close() / abort() to fence and drain the remote task in that case.

Source

pub async fn close(&mut self, cx: &Cx) -> Outcome<RemoteOutcome, RemoteError>

Requests cancellation and drains the remote lifecycle to a terminal state.

This is the explicit close operation for a remote handle: it forwards a best-effort cancellation request when a runtime is attached, then awaits the terminal remote result so origin-side runtime state can be cleared.

§Errors

Unlike join, once close() starts draining it ignores caller cancellation so runtime bookkeeping is always finalized before returning. If the terminal result was already consumed, it returns PolledAfterCompletion.

Source

pub async fn join(&mut self, cx: &Cx) -> Outcome<RemoteOutcome, RemoteError>

Waits for the remote task to complete and returns its result.

This method yields until the remote task completes (or fails/cancels), unless the caller context is cancelled first.

§Errors

Returns RemoteError if the remote task failed, was cancelled, the lease expired, or a terminal result was already consumed.

Source

pub fn try_join(&mut self) -> Result<Option<RemoteOutcome>, RemoteError>

Attempts to get the remote task’s result without waiting.

§Returns
  • Ok(Some(result)) if the remote task has completed
  • Ok(None) if the remote task is still running
  • Err(RemoteError) if the remote task failed
Source

pub fn abort(&self, cx: &Cx)

Requests cancellation of the remote task using the caller’s remote capability.

This is a request — the remote node may not stop immediately. The cancellation propagates via the remote protocol when the provided context carries an attached RemoteRuntime.

If the context does not have a remote capability, or if it is configured for deterministic Phase 0 fallback without an attached runtime, this is a no-op.

Trait Implementations§

Source§

impl Debug for RemoteHandle

Source§

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

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

impl Drop for RemoteHandle

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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: NoopSpan) -> Self

Instruments this future with a span (no-op when disabled).
Source§

fn in_current_span(self) -> Self

Instruments this future with the current span (no-op when disabled).
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V