Skip to content

IRetentionPolicyStore

Namespace AgentPrism · Assembly AgentPrism.Abstractions.dll

The control-plane store for retention policies and run history.

public interface IRetentionPolicyStore

The data plane (actual delete/count/archive-read) goes through IRetentionStore. This split matches the IJobStore/IJobScheduleStore split in the job queue: the control plane is always registered (in-memory or SQL), while the data plane is meaningful only when a SQL provider is enabled.

AppendRunProgressAsync(Guid, long, long, CancellationToken)

Section titled “ AppendRunProgressAsync(Guid, long, long, CancellationToken)”

Increments an in-progress run’s counters. Called after each batch.

ValueTask AppendRunProgressAsync(Guid runId, long deletedDelta, long archivedDelta, CancellationToken cancellationToken = default)

runId Guid

The run identifier.

deletedDelta long

The number of rows deleted in this batch.

archivedDelta long

The number of rows archived in this batch.

cancellationToken CancellationToken

The cancellation token.

ValueTask

The completion task.

CompleteRunAsync(Guid, DateTimeOffset, string?, CancellationToken)

Section titled “ CompleteRunAsync(Guid, DateTimeOffset, string?, CancellationToken)”

Finalizes a run.

ValueTask CompleteRunAsync(Guid runId, DateTimeOffset completedAt, string? errorMessage, CancellationToken cancellationToken = default)

runId Guid

The run identifier.

completedAt DateTimeOffset

The completion time (UTC).

errorMessage string?

The error message; null if successful.

cancellationToken CancellationToken

The cancellation token.

ValueTask

The completion task.

CreateRunAsync(RetentionRun, CancellationToken)

Section titled “ CreateRunAsync(RetentionRun, CancellationToken)”

Opens a new cleanup run.

ValueTask<RetentionRun> CreateRunAsync(RetentionRun run, CancellationToken cancellationToken = default)

run RetentionRun

The starting record. RetentionRun.CompletedAt is ignored.

cancellationToken CancellationToken

The cancellation token.

ValueTask<RetentionRun>

The created record.

DeletePolicyAsync(string, string, CancellationToken)

Section titled “ DeletePolicyAsync(string, string, CancellationToken)”

Deletes a policy.

ValueTask<bool> DeletePolicyAsync(string tenantId, string target, CancellationToken cancellationToken = default)

tenantId string

The tenant identifier.

target string

The target name.

cancellationToken CancellationToken

The cancellation token.

ValueTask<bool>

true if the delete happened.

GetPolicyAsync(string, string, CancellationToken)

Section titled “ GetPolicyAsync(string, string, CancellationToken)”

Looks up a single target’s policy within the tenant, falling back to the "*" tenant-wide policy.

ValueTask<RetentionPolicy?> GetPolicyAsync(string tenantId, string target, CancellationToken cancellationToken = default)

tenantId string

The tenant identifier.

target string

The target name.

cancellationToken CancellationToken

The cancellation token.

ValueTask<RetentionPolicy?>

The policy; null if none exists at either level.

ListPoliciesAsync(string, CancellationToken)

Section titled “ ListPoliciesAsync(string, CancellationToken)”

Lists all of a tenant’s policies (and the "*" tenant-wide ones).

ValueTask<IReadOnlyList<RetentionPolicy>> ListPoliciesAsync(string tenantId, CancellationToken cancellationToken = default)

tenantId string

The tenant identifier.

cancellationToken CancellationToken

The cancellation token.

ValueTask<IReadOnlyList<RetentionPolicy>>

The policies.

ListRunsAsync(string, string?, int, int, CancellationToken)

Section titled “ ListRunsAsync(string, string?, int, int, CancellationToken)”

Lists a tenant’s run history. The newest record is returned first.

ValueTask<IReadOnlyList<RetentionRun>> ListRunsAsync(string tenantId, string? target, int skip, int take, CancellationToken cancellationToken = default)

tenantId string

The tenant identifier.

target string?

Fetches only this target’s runs; all if null.

skip int

The number of records to skip.

take int

The maximum number of records to fetch.

cancellationToken CancellationToken

The cancellation token.

ValueTask<IReadOnlyList<RetentionRun>>

The records.

SavePolicyAsync(RetentionPolicy, CancellationToken)

Section titled “ SavePolicyAsync(RetentionPolicy, CancellationToken)”

Creates or updates a policy.

ValueTask<RetentionPolicy> SavePolicyAsync(RetentionPolicy policy, CancellationToken cancellationToken = default)

policy RetentionPolicy

The policy.

cancellationToken CancellationToken

The cancellation token.

ValueTask<RetentionPolicy>

The saved policy.