pub struct ObjectLockManager { /* private fields */ }Expand description
Top-level manager. Owns per-(bucket, key) lock state and per-bucket
default configuration. All read / write operations go through RwLock
for thread safety; clones are cheap (Arc<ObjectLockManager> is the
expected handle shape).
Implementations§
Source§impl ObjectLockManager
impl ObjectLockManager
Sourcepub fn set(&self, bucket: &str, key: &str, state: ObjectLockState)
pub fn set(&self, bucket: &str, key: &str, state: ObjectLockState)
Replace (or create) the lock state for (bucket, key). service.rs’s
put_object_retention handler calls this directly after validating
the immutability rules (Compliance is one-way; once set, mode cannot
be downgraded and retain-until cannot be shortened — the caller
validates, this method just persists).
Sourcepub fn get(&self, bucket: &str, key: &str) -> Option<ObjectLockState>
pub fn get(&self, bucket: &str, key: &str) -> Option<ObjectLockState>
Return a clone of the current state for (bucket, key), if any.
Sourcepub fn set_legal_hold(&self, bucket: &str, key: &str, on: bool)
pub fn set_legal_hold(&self, bucket: &str, key: &str, on: bool)
Toggle the legal-hold flag on (bucket, key). Creates a default-empty
state if no entry exists yet (legal hold is allowed even without
retention).
Sourcepub fn set_bucket_default(&self, bucket: &str, default: BucketObjectLockDefault)
pub fn set_bucket_default(&self, bucket: &str, default: BucketObjectLockDefault)
Install (or replace) the bucket-default retention config. New PUTs to
this bucket without explicit retention pick this up via
Self::apply_default_on_put.
Sourcepub fn bucket_default(&self, bucket: &str) -> Option<BucketObjectLockDefault>
pub fn bucket_default(&self, bucket: &str) -> Option<BucketObjectLockDefault>
Look up the bucket-default retention config, if any.
Sourcepub fn apply_default_on_put(&self, bucket: &str, key: &str, now: DateTime<Utc>)
pub fn apply_default_on_put(&self, bucket: &str, key: &str, now: DateTime<Utc>)
On PUT: when the bucket has a default config and no per-object state
already exists for this key, materialise a fresh state with
retain_until = now + retention_days. Existing state (e.g. an
earlier explicit put_object_retention) is left unchanged so we
don’t accidentally re-arm a cleared retention on overwrite.
Sourcepub fn clear(&self, bucket: &str, key: &str)
pub fn clear(&self, bucket: &str, key: &str)
Drop any lock state attached to (bucket, key). Called by
service.rs after a successful (= permitted) physical delete so the
freed key can be re-armed by a future PUT under the bucket default.
Trait Implementations§
Source§impl Debug for ObjectLockManager
impl Debug for ObjectLockManager
Source§impl Default for ObjectLockManager
impl Default for ObjectLockManager
Source§fn default() -> ObjectLockManager
fn default() -> ObjectLockManager
Auto Trait Implementations§
impl !Freeze for ObjectLockManager
impl RefUnwindSafe for ObjectLockManager
impl Send for ObjectLockManager
impl Sync for ObjectLockManager
impl Unpin for ObjectLockManager
impl UnsafeUnpin for ObjectLockManager
impl UnwindSafe for ObjectLockManager
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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