mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-20 03:22:18 +00:00
feat(kms): add operation timeout and typed retry policy engine (#5472)
This commit is contained in:
@@ -90,6 +90,14 @@ pub enum KmsError {
|
||||
/// Encryption context mismatch
|
||||
#[error("Encryption context mismatch: {message}")]
|
||||
ContextMismatch { message: String },
|
||||
|
||||
/// Backend operation exceeded its per-attempt timeout or total deadline
|
||||
#[error("Operation timed out: {message}")]
|
||||
OperationTimedOut { message: String },
|
||||
|
||||
/// Backend operation aborted by cancellation or shutdown
|
||||
#[error("Operation cancelled: {message}")]
|
||||
OperationCancelled { message: String },
|
||||
}
|
||||
|
||||
impl KmsError {
|
||||
@@ -187,6 +195,16 @@ impl KmsError {
|
||||
pub fn context_mismatch<S: Into<String>>(message: S) -> Self {
|
||||
Self::ContextMismatch { message: message.into() }
|
||||
}
|
||||
|
||||
/// Create an operation timed out error
|
||||
pub fn operation_timed_out<S: Into<String>>(message: S) -> Self {
|
||||
Self::OperationTimedOut { message: message.into() }
|
||||
}
|
||||
|
||||
/// Create an operation cancelled error
|
||||
pub fn operation_cancelled<S: Into<String>>(message: S) -> Self {
|
||||
Self::OperationCancelled { message: message.into() }
|
||||
}
|
||||
}
|
||||
|
||||
/// Convert from standard library errors
|
||||
|
||||
Reference in New Issue
Block a user