pub struct RetentionService<R> { /* private fields */ }Expand description
The portable retention service.
Purge requires the operator-writer role and its narrowly granted deletes. The runtime role cannot purge, and the operator-reader role can plan but not apply. Those privileges are enforced by the durable adapter’s deployment configuration, not by this type.
Implementations§
Source§impl<R: JobRepository> RetentionService<R>
impl<R: JobRepository> RetentionService<R>
Sourcepub const fn new(repository: R, clock: Arc<dyn Clock>) -> Self
pub const fn new(repository: R, clock: Arc<dyn Clock>) -> Self
Binds one repository and one injected facade clock.
Sourcepub fn with_event_sink(self, sink: Arc<dyn TelemetryEventSink>) -> Self
pub fn with_event_sink(self, sink: Arc<dyn TelemetryEventSink>) -> Self
Attaches a non-authoritative, panic-isolated telemetry sink.
Sourcepub const fn repository(&self) -> &R
pub const fn repository(&self) -> &R
Borrows the underlying repository.
Sourcepub async fn hold(
&self,
job_instance_id: JobInstanceId,
) -> Result<Option<RetentionHold>, RetentionError>
pub async fn hold( &self, job_instance_id: JobInstanceId, ) -> Result<Option<RetentionHold>, RetentionError>
Reads the active hold of one logical instance.
§Errors
Returns RetentionError::Repository when the read fails.
Sourcepub async fn place_hold(
&self,
operation_id: OperationId,
actor: ActorRef,
reason: ReasonCode,
job_instance_id: JobInstanceId,
) -> Result<RetentionReport, RetentionError>
pub async fn place_hold( &self, operation_id: OperationId, actor: ActorRef, reason: ReasonCode, job_instance_id: JobInstanceId, ) -> Result<RetentionReport, RetentionError>
Places one audited hold on a logical instance.
§Errors
Returns RetentionError::OperationIdConflict for a reused identifier
and RetentionError::Repository for an infrastructure failure.
Sourcepub async fn release_hold(
&self,
operation_id: OperationId,
actor: ActorRef,
reason: ReasonCode,
job_instance_id: JobInstanceId,
) -> Result<RetentionReport, RetentionError>
pub async fn release_hold( &self, operation_id: OperationId, actor: ActorRef, reason: ReasonCode, job_instance_id: JobInstanceId, ) -> Result<RetentionReport, RetentionError>
Releases the hold on a logical instance.
§Errors
Returns RetentionError::OperationIdConflict for a reused identifier
and RetentionError::Repository for an infrastructure failure.
Sourcepub async fn plan_purge(
&self,
request: &PurgePlanRequest,
) -> Result<PurgePlan, RetentionError>
pub async fn plan_purge( &self, request: &PurgePlanRequest, ) -> Result<PurgePlan, RetentionError>
Produces one bounded, digest-guarded purge plan.
Planning is a read-only action of the AuthorizationClass::Read
class. It deletes nothing.
§Errors
Returns RetentionError::Repository when the survey fails.
Sourcepub async fn apply_purge(
&self,
operation_id: OperationId,
actor: ActorRef,
reason: ReasonCode,
plan: &PurgePlan,
) -> Result<RetentionReport, RetentionError>
pub async fn apply_purge( &self, operation_id: OperationId, actor: ActorRef, reason: ReasonCode, plan: &PurgePlan, ) -> Result<RetentionReport, RetentionError>
Applies one bounded purge batch under its plan digest.
Application re-validates eligibility and observed versions inside one
transaction. Any candidate that changed produces
RetentionError::RetentionPlanStale and deletes nothing.
§Errors
Returns RetentionError::RetentionPlanStale for a changed candidate,
RetentionError::OperationIdConflict for a reused identifier,
RetentionError::OperationOutcomeUnknown for an ambiguous commit, and
RetentionError::Repository for an infrastructure failure.
Trait Implementations§
Source§impl<R: Clone> Clone for RetentionService<R>
impl<R: Clone> Clone for RetentionService<R>
Source§fn clone(&self) -> RetentionService<R>
fn clone(&self) -> RetentionService<R>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<R> !RefUnwindSafe for RetentionService<R>
impl<R> !UnwindSafe for RetentionService<R>
impl<R> Freeze for RetentionService<R>where
R: Freeze,
impl<R> Send for RetentionService<R>where
R: Send,
impl<R> Sync for RetentionService<R>where
R: Sync,
impl<R> Unpin for RetentionService<R>where
R: Unpin,
impl<R> UnsafeUnpin for RetentionService<R>where
R: UnsafeUnpin,
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,
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