pub enum BlobRetention {
Governance(RetentionWindow),
Compliance(RetentionWindow),
Disabled(bool),
}Expand description
Object-lock blob retention (kopia repository set-parameters --retention-mode/--retention-period).
Externally tagged, so exactly one variant exists by construction. That is load-bearing rather than stylistic: kopia rejects a mode without a period and a period without a mode (“both retention mode and period must be provided when setting blob retention properties”), and pairing the period with the mode in the type makes that error unrepresentable instead of merely validated.
Requires a backend that supports object lock — S3, Azure, or GCS — and a bucket with
object lock enabled at creation time (it cannot be turned on afterwards). kopia’s flags do
not create it. On an unsupported backend set-parameters hard-fails with
blob-retention: unsupported put-blob option, so admission rejects those backends.
§What this does and does not protect
The lock is applied when a blob is written. Kopiur does not enable kopia’s
maintenance set --extend-object-locks, so locks on blobs that are still needed are never
extended: a blob written today under period: 720h becomes deletable again in 30 days.
Treat it as a rolling floor, not cumulative immutability, and size the period to exceed
your longest recovery window. Blobs written before retention was enabled — including the
repository format blob — are never retroactively locked.
use kopiur_api::repository::{BlobRetention, RetentionWindow};
// Externally tagged: the wire form is `{ "governance": { "period": "720h" } }`.
let r: BlobRetention = serde_json::from_value(serde_json::json!({
"governance": { "period": "720h" }
}))
.unwrap();
assert_eq!(r, BlobRetention::Governance(RetentionWindow { period: "720h".into() }));
assert_eq!(r.kind_str(), "Governance");
// Disabling carries no period — kopia ignores it, and the type says so.
let off: BlobRetention = serde_json::from_value(serde_json::json!({ "disabled": true }))
.unwrap();
assert_eq!(off.kind_str(), "Disabled");Variants§
Governance(RetentionWindow)
GOVERNANCE — locked against ordinary deletes, but a sufficiently privileged
identity can still shorten or remove the lock. The safe default for most clusters.
Compliance(RetentionWindow)
COMPLIANCE — nobody can shorten or remove the lock before it expires, including
the account root. An oversized period is an unfixable storage-cost commitment; there
is no recovery path short of deleting the bucket after expiry.
Disabled(bool)
Actively disable retention (--retention-mode=none). Must be true.
A bool rather than a unit variant because an externally-tagged unit variant
serializes as the bare string "Disabled", mixing string and object forms in one
oneOf and breaking the structural schema. Same shape, and same reason, as
crate::cluster_repository::AllowedNamespaces::All.
This is distinct from omitting blobRetention entirely: absent means “leave the
repository alone”, so deleting the block from a manifest can never silently strip
ransomware protection someone configured deliberately.
Implementations§
Source§impl BlobRetention
impl BlobRetention
Trait Implementations§
Source§impl Clone for BlobRetention
impl Clone for BlobRetention
Source§fn clone(&self) -> BlobRetention
fn clone(&self) -> BlobRetention
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 BlobRetention
impl Debug for BlobRetention
Source§impl<'de> Deserialize<'de> for BlobRetention
impl<'de> Deserialize<'de> for BlobRetention
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>,
impl Eq for BlobRetention
Source§impl JsonSchema for BlobRetention
impl JsonSchema for BlobRetention
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 BlobRetention
impl PartialEq for BlobRetention
Source§fn eq(&self, other: &BlobRetention) -> bool
fn eq(&self, other: &BlobRetention) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for BlobRetention
impl Serialize for BlobRetention
impl StructuralPartialEq for BlobRetention
Auto Trait Implementations§
impl Freeze for BlobRetention
impl RefUnwindSafe for BlobRetention
impl Send for BlobRetention
impl Sync for BlobRetention
impl Unpin for BlobRetention
impl UnsafeUnpin for BlobRetention
impl UnwindSafe for BlobRetention
Blanket Implementations§
§impl<T> AnyExt for T
impl<T> AnyExt for T
§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind reference§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable reference§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointer§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointer§fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
T behind Box pointer§fn downcast_move<T>(this: Self) -> Option<T>
fn downcast_move<T>(this: Self) -> Option<T>
Self to T,
useful only in generic context as a workaround for specializationSource§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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§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