Skip to main content

CoordinatedStateStore

Trait CoordinatedStateStore 

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

    // Required methods
    fn load_or_initialize(
        &self,
        job_id: &str,
        initial_state: JobState,
    ) -> impl Future<Output = Result<CoordinatedRuntimeState, Self::Error>> + Send;
    fn save_state(
        &self,
        job_id: &str,
        revision: u64,
        state: &JobState,
    ) -> impl Future<Output = Result<bool, Self::Error>> + Send;
    fn reclaim_inflight(
        &self,
        job_id: &str,
        resource_id: &str,
        lease_config: CoordinatedLeaseConfig,
    ) -> impl Future<Output = Result<Option<CoordinatedClaim>, Self::Error>> + Send;
    fn claim_trigger(
        &self,
        job_id: &str,
        resource_id: &str,
        revision: u64,
        trigger: CoordinatedPendingTrigger,
        next_state: &JobState,
        lease_config: CoordinatedLeaseConfig,
    ) -> impl Future<Output = Result<Option<CoordinatedClaim>, Self::Error>> + Send;
    fn renew(
        &self,
        lease: &ExecutionLease,
        lease_config: CoordinatedLeaseConfig,
    ) -> impl Future<Output = Result<ExecutionGuardRenewal, Self::Error>> + Send;
    fn complete(
        &self,
        job_id: &str,
        revision: u64,
        lease: &ExecutionLease,
        state: &JobState,
    ) -> impl Future<Output = Result<bool, Self::Error>> + Send;
    fn delete(
        &self,
        job_id: &str,
    ) -> impl Future<Output = Result<(), Self::Error>> + Send;

    // Provided methods
    fn classify_store_error(_error: &Self::Error) -> StoreErrorKind
       where Self: Sized { ... }
    fn classify_guard_error(_error: &Self::Error) -> ExecutionGuardErrorKind
       where Self: Sized { ... }
}

Required Associated Types§

Source

type Error: Error + Send + Sync + 'static

Required Methods§

Source

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

Source

fn save_state( &self, job_id: &str, revision: u64, state: &JobState, ) -> impl Future<Output = Result<bool, Self::Error>> + Send

Source

fn reclaim_inflight( &self, job_id: &str, resource_id: &str, lease_config: CoordinatedLeaseConfig, ) -> impl Future<Output = Result<Option<CoordinatedClaim>, Self::Error>> + Send

Source

fn claim_trigger( &self, job_id: &str, resource_id: &str, revision: u64, trigger: CoordinatedPendingTrigger, next_state: &JobState, lease_config: CoordinatedLeaseConfig, ) -> impl Future<Output = Result<Option<CoordinatedClaim>, Self::Error>> + Send

Source

fn renew( &self, lease: &ExecutionLease, lease_config: CoordinatedLeaseConfig, ) -> impl Future<Output = Result<ExecutionGuardRenewal, Self::Error>> + Send

Source

fn complete( &self, job_id: &str, revision: u64, lease: &ExecutionLease, state: &JobState, ) -> impl Future<Output = Result<bool, Self::Error>> + Send

Source

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

Provided Methods§

Source

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

Source

fn classify_guard_error(_error: &Self::Error) -> ExecutionGuardErrorKind
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> CoordinatedStateStore for Arc<T>

Source§

type Error = <T as CoordinatedStateStore>::Error

Source§

async fn load_or_initialize( &self, job_id: &str, initial_state: JobState, ) -> Result<CoordinatedRuntimeState, Self::Error>

Source§

async fn save_state( &self, job_id: &str, revision: u64, state: &JobState, ) -> Result<bool, Self::Error>

Source§

async fn reclaim_inflight( &self, job_id: &str, resource_id: &str, lease_config: CoordinatedLeaseConfig, ) -> Result<Option<CoordinatedClaim>, Self::Error>

Source§

async fn claim_trigger( &self, job_id: &str, resource_id: &str, revision: u64, trigger: CoordinatedPendingTrigger, next_state: &JobState, lease_config: CoordinatedLeaseConfig, ) -> Result<Option<CoordinatedClaim>, Self::Error>

Source§

async fn renew( &self, lease: &ExecutionLease, lease_config: CoordinatedLeaseConfig, ) -> Result<ExecutionGuardRenewal, Self::Error>

Source§

async fn complete( &self, job_id: &str, revision: u64, lease: &ExecutionLease, state: &JobState, ) -> Result<bool, Self::Error>

Source§

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

Source§

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

Source§

fn classify_guard_error(error: &Self::Error) -> ExecutionGuardErrorKind
where Self: Sized,

Implementors§