Skip to main content

Engine

Trait Engine 

Source
pub trait Engine: Send + Sync {
    // Required method
    fn send_message_cbor<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        method: &'life1 str,
        params: CborValue,
    ) -> Pin<Box<dyn Future<Output = Result<CborValue>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn send_message<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        method: &'life1 str,
        params: Value,
    ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn register_live<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        _query_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<UnboundedReceiver<Notification>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn unregister_live<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        _query_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

Wire abstraction for SurrealDB RPC. The CBOR method is the real wire path; the JSON method is a default convenience that transcodes through it.

Required Methods§

Source

fn send_message_cbor<'life0, 'life1, 'async_trait>( &'life0 mut self, method: &'life1 str, params: CborValue, ) -> Pin<Box<dyn Future<Output = Result<CborValue>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Provided Methods§

Source

fn send_message<'life0, 'life1, 'async_trait>( &'life0 mut self, method: &'life1 str, params: Value, ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn register_live<'life0, 'life1, 'async_trait>( &'life0 mut self, _query_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<UnboundedReceiver<Notification>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Register interest in a live query’s notifications.

The caller has already issued the live RPC and holds the returned query id; this hands back the receiving end of a channel the engine’s read loop pushes matching Notifications onto. Only transport engines that can receive server-pushed frames (the WebSocket engine) implement this — the default refuses, so request/response-only engines (mocks, HTTP) surface an honest error.

Source

fn unregister_live<'life0, 'life1, 'async_trait>( &'life0 mut self, _query_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Drop local delivery for a live-query id. Does not send KILL — that is a separate RPC. Default is a no-op.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§