Skip to main content

StoreLifecycle

Trait StoreLifecycle 

Source
pub trait StoreLifecycle: Sync + Send {
    // Required methods
    fn load(&mut self) -> impl Future<Output = Result<bool, StoreError>> + Send;
    fn start(&mut self) -> impl Future<Output = Result<(), StoreError>> + Send;
    fn shutdown(
        &mut self,
    ) -> impl Future<Output = Result<(), StoreError>> + Send;
}
Expand description

Storage lifecycle capability.

Required Methods§

Source

fn load(&mut self) -> impl Future<Output = Result<bool, StoreError>> + Send

Loads existing state.

§Errors

Returns StoreError with crate::StoreOperation::Load when state cannot be loaded safely.

Source

fn start(&mut self) -> impl Future<Output = Result<(), StoreError>> + Send

Starts the store within its existing lifecycle owner.

§Errors

Returns StoreError with crate::StoreOperation::Start when startup cannot establish a usable store.

Source

fn shutdown(&mut self) -> impl Future<Output = Result<(), StoreError>> + Send

Stops the store and completes its owned shutdown sequence.

§Errors

Returns StoreError with crate::StoreOperation::Shutdown when final progress or shutdown fails.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§