pub enum KopiaErrorClass {
RepositoryUnavailable,
AuthFailure,
AccessDenied,
PermissionDenied,
NotFound,
Locked,
SourceError,
Unknown,
}Expand description
A best-effort classification of a kopia failure, derived by inspecting the
captured stderr. This is intentionally coarse — it exists to drive the
“should we retry?” decision in the mover, not to be exhaustive. Unknown
failures map to KopiaErrorClass::Unknown and are treated as
non-retryable by default.
Classification reads kopia’s stderr; the class then drives the retry hint and round-trips through its stable label:
use kopiur_kopia::KopiaErrorClass;
// A backend down / unreachable error is transient → worth a retry.
let class = KopiaErrorClass::classify("ERROR error connecting to repository: dial tcp");
assert_eq!(class, KopiaErrorClass::RepositoryUnavailable);
assert!(class.is_retryable());
// A wrong repository password is not retryable without a config change.
let auth = KopiaErrorClass::classify("invalid repository password");
assert_eq!(auth, KopiaErrorClass::AuthFailure);
assert!(!auth.is_retryable());
// The stable label round-trips through from_label/as_str.
assert_eq!(class.as_str(), "RepositoryUnavailable");
assert_eq!(KopiaErrorClass::from_label("RepositoryUnavailable"), class);
// An unrecognized label degrades to Unknown.
assert_eq!(KopiaErrorClass::from_label("bogus"), KopiaErrorClass::Unknown);Variants§
Repository could not be reached / opened (network, backend down, bad endpoint). Typically transient → retry.
AuthFailure
Authentication / password / credential failure (wrong repository password). Not retryable without a config change.
AccessDenied
The storage backend denied access to the bucket/container/object (e.g. S3/B2/GCS “Access Denied”, HTTP 403). The credentials usually authenticate fine but lack permission — or the bucket/path doesn’t exist and the backend masks that as access-denied (RustFS/S3 do this). Not retryable without a credentials/permission/bucket fix.
PermissionDenied
The repository path is not writable by this process — e.g. a filesystem repo whose PVC/NFS export is not writable by the operator’s UID (“permission denied” / EACCES when connecting or creating). Not retryable without fixing ownership/mode.
NotFound
The requested source path / snapshot / target was not found.
Locked
A repository lock is held by another writer. Often transient → retry.
SourceError
Source filesystem error during upload (I/O, prepare failure).
Unknown
Anything we could not classify.
Implementations§
Source§impl KopiaErrorClass
impl KopiaErrorClass
Sourcepub fn from_label(s: &str) -> KopiaErrorClass
pub fn from_label(s: &str) -> KopiaErrorClass
Inverse of as_str: reconstruct the class from its stable
label. Used when only the persisted string is available (the controller
reads result.failure.kopiaErrorClass from a bootstrap Job’s ConfigMap).
An unrecognized label maps to KopiaErrorClass::Unknown.
Sourcepub fn summary(&self) -> &'static str
pub fn summary(&self) -> &'static str
A stable, volatile-free one-line summary of what this class means and how to fix it, suitable for a status condition message.
Unlike KopiaError::to_string (which embeds the kopia stderr tail — and
thus a per-attempt-random temp filename like .shards.tmp.<hex>), this is
byte-identical across repeated failures of the same class. The controller
uses it for the persisted condition so that re-writing an unchanged Failed
status is a true no-op (no resourceVersion bump → no self-triggered
reconcile). The full, volatile detail still goes to the Warning Event.
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Whether re-running the same operation later might succeed without any configuration change. This is the operator’s default retry hint; the caller may override it with policy.
Sourcepub fn classify(stderr: &str) -> KopiaErrorClass
pub fn classify(stderr: &str) -> KopiaErrorClass
Best-effort classification from captured stderr text. Matches against substrings kopia is observed to emit (kopia 0.23). Order matters: more specific checks come first.
Trait Implementations§
Source§impl Clone for KopiaErrorClass
impl Clone for KopiaErrorClass
Source§fn clone(&self) -> KopiaErrorClass
fn clone(&self) -> KopiaErrorClass
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for KopiaErrorClass
impl Debug for KopiaErrorClass
Source§impl Display for KopiaErrorClass
impl Display for KopiaErrorClass
Source§impl PartialEq for KopiaErrorClass
impl PartialEq for KopiaErrorClass
Source§fn eq(&self, other: &KopiaErrorClass) -> bool
fn eq(&self, other: &KopiaErrorClass) -> bool
self and other values to be equal, and is used by ==.