Skip to main content

CapabilityEngine

Trait CapabilityEngine 

Source
pub trait CapabilityEngine: Send + Sync {
    // Required methods
    fn load(
        &self,
        req: ComponentLoadRequest,
    ) -> BoxFuture<'_, Result<ComponentLoadResponse, CapabilityError>>;
    fn invoke(
        &self,
        req: ComponentInvokeRequest,
    ) -> BoxFuture<'_, Result<ComponentInvokeResponse, CapabilityError>>;
}
Expand description

Loads a validated component and invokes its handler export.

Implementations own instantiation, isolation, and resource-limit enforcement — none of that is expressed in this trait, matching every other port in this crate (the contract is the behavior, not the mechanism). Callers must have already validated the same manifest/ bytes against ADR-001’s own two-gate contract first — load is not required to re-run the manifest-level grant check, only to fail if the bytes cannot actually be instantiated. Zero implementation here.

Required Methods§

Source

fn load( &self, req: ComponentLoadRequest, ) -> BoxFuture<'_, Result<ComponentLoadResponse, CapabilityError>>

Load a component artifact, returning a handle for subsequent CapabilityEngine::invoke calls.

§Errors

Returns CapabilityError if the bytes cannot be instantiated, or a declared-and-granted capability has no real dispatcher wired for it (CapabilityError::CapabilityUnavailable).

Source

fn invoke( &self, req: ComponentInvokeRequest, ) -> BoxFuture<'_, Result<ComponentInvokeResponse, CapabilityError>>

Invoke a previously loaded component’s handler export once.

§Errors

Returns CapabilityError if the component traps, exceeds a configured resource limit, or exceeds req.deadline.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§