pub struct RemoteComputationRegistry { /* private fields */ }Expand description
Executable, schema-identified registry for remote named computations.
Registration couples every handler name to a declared input/output schema
pair, so the complete registry fingerprint used during peer negotiation
describes the code-selection surface that can actually run. The handler is
still responsible for enforcing those declared schemas when it decodes and
encodes its raw bytes; registration does not silently choose a codec.
Dispatch requires an immutable admitted session and supplies an explicit
Cx clone to the handler. The registry does not spawn tasks or provide
ambient authority.
Implementations§
Source§impl RemoteComputationRegistry
impl RemoteComputationRegistry
Sourcepub fn register<I, O, F, Fut>(
&mut self,
name: impl Into<String>,
handler: F,
) -> Result<(), ComputationSchemaRegistryError>where
I: HasSchema,
O: HasSchema,
F: Fn(Cx, RemoteComputationInvocation) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<RemoteOutcome, RemoteError>> + Send + 'static,
pub fn register<I, O, F, Fut>(
&mut self,
name: impl Into<String>,
handler: F,
) -> Result<(), ComputationSchemaRegistryError>where
I: HasSchema,
O: HasSchema,
F: Fn(Cx, RemoteComputationInvocation) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<RemoteOutcome, RemoteError>> + Send + 'static,
Registers a Cx-threaded asynchronous named computation.
I and O define the stable wire schemas advertised during peer
negotiation. The handler receives the raw admitted invocation so the
application remains explicit about its chosen serialization codec.
Sourcepub const fn schema_registry(&self) -> &ComputationSchemaRegistry
pub const fn schema_registry(&self) -> &ComputationSchemaRegistry
Schema registry that must be used to build the peer-admission policy.
Sourcepub async fn dispatch(
&self,
cx: &Cx,
session: &RemotePeerSession,
request: SpawnRequest,
) -> Result<RemoteOutcome, RemoteComputationDispatchError>
pub async fn dispatch( &self, cx: &Cx, session: &RemotePeerSession, request: SpawnRequest, ) -> Result<RemoteOutcome, RemoteComputationDispatchError>
Authorizes and executes one named-computation request.
No handler is invoked until the session capability accepts the name. The returned future is awaited inline and is never detached.
Trait Implementations§
Source§impl Clone for RemoteComputationRegistry
impl Clone for RemoteComputationRegistry
Source§fn clone(&self) -> RemoteComputationRegistry
fn clone(&self) -> RemoteComputationRegistry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more