Skip to main content

Client

Trait Client 

Source
pub trait Client {
    // Required methods
    fn propose(
        &self,
        payload: Vec<u8>,
    ) -> impl Future<Output = Result<Vec<u8>, ClientError>> + Send;
    fn query(
        &self,
        payload: Vec<u8>,
    ) -> impl Future<Output = Result<Vec<u8>, ClientError>> + Send;
}
Expand description

A cluster client: submit an application-encoded write (propose) or linearizable read (query) and get the application-encoded response back.

The raw-bytes layer shared by the remote HTTP/3 client and any in-process adapter; TypedClient wraps it with a StateMachine’s command/query/response types.

Required Methods§

Source

fn propose( &self, payload: Vec<u8>, ) -> impl Future<Output = Result<Vec<u8>, ClientError>> + Send

Submit a write. payload is the application-encoded command; the returned bytes are the application-encoded response.

Source

fn query( &self, payload: Vec<u8>, ) -> impl Future<Output = Result<Vec<u8>, ClientError>> + Send

Submit a linearizable read (ReadIndex, read-consistency). payload is the application-encoded query; the returned bytes are the encoded response.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§