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
impl RemoteCap
Sourcepub fn with_default_lease(self, lease: Duration) -> Self
pub fn with_default_lease(self, lease: Duration) -> Self
Sets the default lease duration for remote tasks.
Sourcepub fn with_remote_budget(self, budget: Budget) -> Self
pub fn with_remote_budget(self, budget: Budget) -> Self
Sets a budget ceiling for remote tasks.
Sourcepub fn with_local_node(self, node: NodeId) -> Self
pub fn with_local_node(self, node: NodeId) -> Self
Sets the local node identity used as protocol origin.
Sourcepub fn with_runtime(self, runtime: Arc<dyn RemoteRuntime>) -> Self
pub fn with_runtime(self, runtime: Arc<dyn RemoteRuntime>) -> Self
Attaches a remote runtime (transport).
Sourcepub fn default_lease(&self) -> Duration
pub fn default_lease(&self) -> Duration
Returns the default lease duration.
Sourcepub fn remote_budget(&self) -> Option<&Budget>
pub fn remote_budget(&self) -> Option<&Budget>
Returns the remote budget ceiling, if configured.
Sourcepub fn local_node(&self) -> &NodeId
pub fn local_node(&self) -> &NodeId
Returns the local node identity used for protocol origin metadata.
Sourcepub fn runtime(&self) -> Option<&Arc<dyn RemoteRuntime>>
pub fn runtime(&self) -> Option<&Arc<dyn RemoteRuntime>>
Returns the attached remote runtime, if any.