Skip to main content

ClientEventsProxy

Trait ClientEventsProxy 

Source
pub trait ClientEventsProxy {
    // Required methods
    fn recv(
        &mut self,
    ) -> BoxFuture<'_, Result<OpenRequest<'static>, ClientError>>;
    fn send(
        &mut self,
        id: ClientId,
        response: Result<HostResponse, ClientError>,
    ) -> BoxFuture<'_, Result<(), ClientError>>;

    // Provided method
    fn set_op_manager(&self, _op_manager: &dyn Any) { ... }
}

Required Methods§

Source

fn recv(&mut self) -> BoxFuture<'_, Result<OpenRequest<'static>, ClientError>>

§Cancellation Safety

This future must be safe to cancel.

Source

fn send( &mut self, id: ClientId, response: Result<HostResponse, ClientError>, ) -> BoxFuture<'_, Result<(), ClientError>>

Sends a response from the host to the client application.

Provided Methods§

Source

fn set_op_manager(&self, _op_manager: &dyn Any)

Wire this proxy’s HTTP layer to the live node, so HTTP-only operations that must reach the executor (the hosted-mode export endpoint, P3-live of #4381) can route through the node’s OpManager. Called ONCE at node startup from p2p_impl, where the live op_manager first meets the client proxies (before the combinator consumes them).

The argument is &dyn Any carrying an Arc<OpManager> rather than a concrete &Arc<OpManager> ON PURPOSE: ClientEventsProxy is a public trait but OpManager is pub(crate), so naming it in the signature would leak a more-private type. Implementors that care (HttpClientApi) downcast it; the default no-op ignores it, so external implementors (e.g. fdev’s StdInput) need not know about OpManager at all. Stored as a Weak by the recipient so it does not extend the node’s lifetime, making this per-node (no process-global singleton that concurrent in-process nodes would clobber).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<R> ClientEventsProxy for MemoryEventsGen<R>
where R: RandomEventGenerator + Send,

Source§

impl<R> ClientEventsProxy for NetworkEventGenerator<R>
where R: RandomEventGenerator + Send + Clone,