Skip to main content

ClusterKv

Trait ClusterKv 

Source
pub trait ClusterKv:
    Send
    + Sync
    + 'static {
    // Required methods
    fn write<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
        value: String,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn read_from<'life0, 'life1, 'async_trait>(
        &'life0 self,
        who: NodeId,
        key: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn scan<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Vec<(NodeId, String)>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn write_checked<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
        value: String,
    ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn read_from_checked<'life0, 'life1, 'async_trait>(
        &'life0 self,
        who: NodeId,
        key: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<String>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn scan_checked<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<(NodeId, String)>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

Gossip-KV seam.

Required Methods§

Source

fn write<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, value: String, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Write value to this instance’s key slot (overwrites).

Source

fn read_from<'life0, 'life1, 'async_trait>( &'life0 self, who: NodeId, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Read key from who’s slot.

Source

fn scan<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Vec<(NodeId, String)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Every visible instance’s value for key.

Provided Methods§

Source

fn write_checked<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, value: String, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Write with transport failure reporting when the backend supports it.

Fast gossip implementations may use the default because their write API has no result. Durable control implementations override this so recovery never treats a dropped write as successful.

§Errors

Durable implementations return a transport or storage error when the value was not accepted by their authority.

Source

fn read_from_checked<'life0, 'life1, 'async_trait>( &'life0 self, who: NodeId, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<String>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Read with transport failure reporting when the backend supports it.

§Errors

Durable implementations return a transport or storage error. A genuinely absent key is Ok(None).

Source

fn scan_checked<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<(NodeId, String)>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Scan with transport failure reporting when the backend supports it.

§Errors

Durable implementations fail the whole scan when any visible participant cannot be read.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§