Skip to main content

RemoteCap

Struct RemoteCap 

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

Capability token authorizing remote task operations.

RemoteCap is the gate for all remote operations. A Cx without a RemoteCap cannot spawn remote tasks — the call fails at compile time (via the spawn_remote signature requiring &RemoteCap) or at runtime (via cx.remote() returning None).

§Capability Model

The capability is granted during Cx construction and flows through the capability context. This ensures:

  • Code that doesn’t need remote execution never has access to it
  • Remote authority can be tested by constructing Cx with/without the cap
  • Auditing which code paths can spawn remote work is straightforward

§Configuration

The cap holds optional configuration that governs remote execution policy:

  • Default lease duration for remote tasks
  • Budget constraints for remote operations
  • The transport runtime (if connected)

§Example

use asupersync::remote::RemoteCap;

let cap = RemoteCap::new();
assert_eq!(cap.default_lease().as_secs(), 30);

Implementations§

Source§

impl RemoteCap

Source

pub fn new() -> Self

Creates a new RemoteCap with default configuration.

Source

pub fn with_default_lease(self, lease: Duration) -> Self

Sets the default lease duration for remote tasks.

Source

pub fn with_remote_budget(self, budget: Budget) -> Self

Sets a budget ceiling for remote tasks.

Source

pub fn with_local_node(self, node: NodeId) -> Self

Sets the local node identity used as protocol origin.

Source

pub fn with_runtime(self, runtime: Arc<dyn RemoteRuntime>) -> Self

Attaches a remote runtime (transport).

Source

pub fn default_lease(&self) -> Duration

Returns the default lease duration.

Source

pub fn remote_budget(&self) -> Option<&Budget>

Returns the remote budget ceiling, if configured.

Source

pub fn local_node(&self) -> &NodeId

Returns the local node identity used for protocol origin metadata.

Source

pub fn runtime(&self) -> Option<&Arc<dyn RemoteRuntime>>

Returns the attached remote runtime, if any.

Trait Implementations§

Source§

impl Clone for RemoteCap

Source§

fn clone(&self) -> RemoteCap

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 RemoteCap

Source§

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

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

impl Default for RemoteCap

Source§

fn default() -> Self

Returns the “default value” for a type. 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: 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> 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> 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