Skip to main content

StateStore

Trait StateStore 

Source
pub trait StateStore {
    type Error: Error + Send + Sync + 'static;

    // Required methods
    fn load(
        &self,
        job_id: &str,
    ) -> impl Future<Output = Result<Option<JobState>, Self::Error>> + Send;
    fn save(
        &self,
        state: &JobState,
    ) -> impl Future<Output = Result<(), Self::Error>> + Send;

    // Provided methods
    fn delete(
        &self,
        _job_id: &str,
    ) -> impl Future<Output = Result<(), Self::Error>> + Send { ... }
    fn drain_events(
        &self,
    ) -> impl Future<Output = Result<Vec<StoreEvent>, Self::Error>> + Send { ... }
    fn classify_error(_error: &Self::Error) -> StoreErrorKind
       where Self: Sized { ... }
}

Required Associated Types§

Source

type Error: Error + Send + Sync + 'static

Required Methods§

Source

fn load( &self, job_id: &str, ) -> impl Future<Output = Result<Option<JobState>, Self::Error>> + Send

Source

fn save( &self, state: &JobState, ) -> impl Future<Output = Result<(), Self::Error>> + Send

Provided Methods§

Source

fn delete( &self, _job_id: &str, ) -> impl Future<Output = Result<(), Self::Error>> + Send

Source

fn drain_events( &self, ) -> impl Future<Output = Result<Vec<StoreEvent>, Self::Error>> + Send

Source

fn classify_error(_error: &Self::Error) -> StoreErrorKind
where Self: Sized,

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.

Implementations on Foreign Types§

Source§

impl<T> StateStore for Arc<T>
where T: StateStore + Send + Sync,

Source§

type Error = <T as StateStore>::Error

Source§

async fn load(&self, job_id: &str) -> Result<Option<JobState>, Self::Error>

Source§

async fn save(&self, state: &JobState) -> Result<(), Self::Error>

Source§

async fn delete(&self, job_id: &str) -> Result<(), Self::Error>

Source§

async fn drain_events(&self) -> Result<Vec<StoreEvent>, Self::Error>

Source§

fn classify_error(error: &Self::Error) -> StoreErrorKind
where Self: Sized,

Implementors§