Trait RpcContext

Source
pub trait RpcContext {
    const LQ_SUPPORT: bool = false;

    // Required methods
    fn kvs(&self) -> &Datastore;
    fn lock(&self) -> Arc<Semaphore>;
    fn session(&self) -> Arc<Session>;
    fn set_session(&self, session: Arc<Session>);
    fn version_data(&self) -> Data;

    // Provided methods
    fn handle_live(&self, _lqid: &Uuid) -> impl Future<Output = ()> + Send { ... }
    fn handle_kill(&self, _lqid: &Uuid) -> impl Future<Output = ()> + Send { ... }
    fn cleanup_lqs(&self) -> impl Future<Output = ()> + Send { ... }
    async fn execute(
        &self,
        version: Option<u8>,
        method: Method,
        params: Array,
    ) -> Result<Data, RpcError>
       where Self: RpcProtocolV1 + RpcProtocolV2 { ... }
}

Provided Associated Constants§

Source

const LQ_SUPPORT: bool = false

Live queries are disabled by default

Required Methods§

Source

fn kvs(&self) -> &Datastore

The datastore for this RPC interface

Source

fn lock(&self) -> Arc<Semaphore>

Retrieves the modification lock for this RPC context

Source

fn session(&self) -> Arc<Session>

The current session for this RPC context

Source

fn set_session(&self, session: Arc<Session>)

Mutable access to the current session for this RPC context

Source

fn version_data(&self) -> Data

The version information for this RPC context

Provided Methods§

Source

fn handle_live(&self, _lqid: &Uuid) -> impl Future<Output = ()> + Send

Handles the execution of a LIVE statement

Source

fn handle_kill(&self, _lqid: &Uuid) -> impl Future<Output = ()> + Send

Handles the execution of a KILL statement

Source

fn cleanup_lqs(&self) -> impl Future<Output = ()> + Send

Handles the cleanup of live queries

Source

async fn execute( &self, version: Option<u8>, method: Method, params: Array, ) -> Result<Data, RpcError>

Executes a method on this RPC implementation

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§