pub enum DeletionPolicy {
Delete,
Retain,
Orphan,
}Expand description
Lifecycle of the underlying kopia snapshot when its Backup CR is deleted.
Shared by BackupConfig.spec.defaultDeletionPolicy and Backup.spec.deletionPolicy.
ADR-0003 §4.5 / ADR-0001 §4.5.
The reconciler distinguishes the three cases with an exhaustive match — Rust
enforces that any new variant added later must be handled in every match site,
preventing the class of bug where a new policy slips into production without a
corresponding reconcile branch.
use kopiur_api::common::DeletionPolicy;
// Produced backups default to deleting the snapshot with the CR.
assert_eq!(DeletionPolicy::default(), DeletionPolicy::Delete);
// Variants serialize to their bare PascalCase names (plain string enum).
assert_eq!(serde_json::to_value(DeletionPolicy::Retain).unwrap(), "Retain");
assert_eq!(serde_json::to_value(DeletionPolicy::Orphan).unwrap(), "Orphan");Variants§
Delete
Default for origin: scheduled/manual. Finalizer runs
kopia snapshot delete <id> then removes the finalizer.
Retain
Default for origin: discovered. CR is removed; snapshot stays.
Forced via webhook for discovered backups; cannot be overridden.
Orphan
CR is removed without contacting the repository at all (escape hatch
for “the bucket is gone, just let me delete the CR”). Status records
orphaned: true for the snapshot ID before removal.
Trait Implementations§
Source§impl Clone for DeletionPolicy
impl Clone for DeletionPolicy
Source§fn clone(&self) -> DeletionPolicy
fn clone(&self) -> DeletionPolicy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DeletionPolicy
impl Debug for DeletionPolicy
Source§impl Default for DeletionPolicy
impl Default for DeletionPolicy
Source§fn default() -> DeletionPolicy
fn default() -> DeletionPolicy
Source§impl<'de> Deserialize<'de> for DeletionPolicy
impl<'de> Deserialize<'de> for DeletionPolicy
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for DeletionPolicy
impl JsonSchema for DeletionPolicy
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for DeletionPolicy
impl PartialEq for DeletionPolicy
Source§impl Serialize for DeletionPolicy
impl Serialize for DeletionPolicy
impl Copy for DeletionPolicy
impl Eq for DeletionPolicy
impl StructuralPartialEq for DeletionPolicy
Auto Trait Implementations§
impl Freeze for DeletionPolicy
impl RefUnwindSafe for DeletionPolicy
impl Send for DeletionPolicy
impl Sync for DeletionPolicy
impl Unpin for DeletionPolicy
impl UnsafeUnpin for DeletionPolicy
impl UnwindSafe for DeletionPolicy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more