Skip to main content

StateStore

Trait StateStore 

Source
pub trait StateStore {
    type Scope;

    // Required methods
    fn get<'a>(
        &'a self,
        scope: &'a Self::Scope,
        key: &'a str,
    ) -> CapabilityFuture<'a, Result<Option<StateEntry>, CapabilityError>>;
    fn compare_exchange<'a>(
        &'a self,
        scope: &'a Self::Scope,
        key: &'a str,
        expected: Option<Version>,
        replacement: Option<StateWrite>,
    ) -> CapabilityFuture<'a, Result<CasResult, CapabilityError>>;
    fn limits(&self) -> CapabilityLimits;
}
Expand description

An atomically scoped state store.

Required Associated Types§

Required Methods§

Source

fn get<'a>( &'a self, scope: &'a Self::Scope, key: &'a str, ) -> CapabilityFuture<'a, Result<Option<StateEntry>, CapabilityError>>

Expired entries are treated as absent, consistently for reads and CAS.

Source

fn compare_exchange<'a>( &'a self, scope: &'a Self::Scope, key: &'a str, expected: Option<Version>, replacement: Option<StateWrite>, ) -> CapabilityFuture<'a, Result<CasResult, CapabilityError>>

expected = None means absent. The operation is atomic within scope; a conflict never returns the current entry. Hosts generate versions and never reuse them across delete/recreate cycles.

Source

fn limits(&self) -> CapabilityLimits

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§