Skip to main content

notfound_is_uninitialized

Function notfound_is_uninitialized 

Source
pub fn notfound_is_uninitialized(stderr: &str) -> bool
Expand description

Whether a KopiaErrorClass::NotFound connect failure is the backend reporting a genuinely uninitialized repository (kopia’s ErrRepositoryNotInitialized: “repository not initialized in the provided storage”) rather than a missing path / mount (“no such file or directory”, “does not exist”).

Both phrasings classify as KopiaErrorClass::NotFound (so first-bootstrap create still fires for either), but they mean very different things for an already-Ready repository under the health probe:

  • genuine “not initialized” ⇒ the backend answered and the kopia format blob is gone — a candidate vanished repository (RepositoryVanished).
  • a missing path / mount ⇒ the PVC isn’t bound or the export moved — a backend/mount fault (BackendReachable=False), NOT a wipe. Recreating here would be catastrophic, so the two must never be conflated.

Returns false for any non-NotFound stderr; callers gate on the class first.

use kopiur_kopia::notfound_is_uninitialized;
assert!(notfound_is_uninitialized("repository not initialized in the provided storage"));
assert!(!notfound_is_uninitialized("open /repo/kopia.repository: no such file or directory"));