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§
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) -> StoreErrorKindwhere
Self: Sized,
fn classify_guard_error(_error: &Self::Error) -> ExecutionGuardErrorKindwhere
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.