Skip to main content

KopiaErrorClass

Enum KopiaErrorClass 

Source
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§

§

RepositoryUnavailable

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

Source

pub fn as_str(&self) -> &'static str

Stable string form for status fields / metrics labels.

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> KopiaErrorClass

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for KopiaErrorClass

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for KopiaErrorClass

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for KopiaErrorClass

Source§

fn eq(&self, other: &KopiaErrorClass) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for KopiaErrorClass

Source§

impl Eq for KopiaErrorClass

Source§

impl StructuralPartialEq for KopiaErrorClass

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more