pub trait PoisonStore: Send + Sync {
// Required methods
fn try_put_poison<'life0, 'async_trait>(
&'life0 self,
key: String,
token: String,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn delete_poison<'life0, 'async_trait>(
&'life0 self,
key: String,
token: String,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_poison<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}
Expand description
Poison store.
This trait is used to manage the state of operations on resources, particularly when an operation encounters an unrecoverable error, potentially leading to metadata inconsistency. In such cases, manual intervention is required to resolve the issue before any further operations can be performed on the resource.
§Behavior:
- Insertion: When an operation begins on a resource, a “poison” key is inserted into the state store to indicate the operation is in progress.
- Deletion: If the operation completes successfully or other cases can ensure the resource is in a consistent state, the poison key is removed from the state store, indicating the resource is in a consistent state.
- Failure Handling:
- If the operation fails or other cases may lead to metadata inconsistency, the poison key remains in the state store.
- The presence of this key indicates that the resource has encountered an unrecoverable error and the metadata may be inconsistent.
- New operations on the same resource are rejected until the resource is manually recovered and the poison key is removed.
Required Methods§
Sourcefn try_put_poison<'life0, 'async_trait>(
&'life0 self,
key: String,
token: String,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn try_put_poison<'life0, 'async_trait>(
&'life0 self,
key: String,
token: String,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Try to put the poison key.
If the poison key already exists with a different value, the operation will fail.
Sourcefn delete_poison<'life0, 'async_trait>(
&'life0 self,
key: String,
token: String,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete_poison<'life0, 'async_trait>(
&'life0 self,
key: String,
token: String,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Delete the poison key.
If the poison key exists with a different value, the operation will fail.
Sourcefn get_poison<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_poison<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get the poison key.
If the poison key does not exist, the operation will return None
.