NullRetentionStore
AgentPrism.Core.dllThe no-op default data-plane implementation. It is registered with in-memory stores and always returns “nothing matched”.
public sealed class NullRetentionStore : IRetentionStoreInheritance
Section titled “Inheritance”Implements
Section titled “Implements”Inherited Members
Section titled “Inherited Members”object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Section titled “Remarks”Retention counts and deletes rows in a persistent SQL provider. In-memory stores
are already lost when the process ends, so a real retention implementation comes
only with UsePostgreSql, UseSqlServer, or UseSqlite.
Without this class, RetentionExecutor would throw when IRetentionStore
is unregistered. It instead silently uses the “nothing to delete” behavior.
Constructors
Section titled “Constructors”NullRetentionStore()
Section titled “ NullRetentionStore()”public NullRetentionStore()Methods
Section titled “Methods”CountOlderThanAsync(string, string?, DateTimeOffset, CancellationToken)
Section titled “ CountOlderThanAsync(string, string?, DateTimeOffset, CancellationToken)”Returns the number of rows in the target currently older than the cutoff date.
public ValueTask<long> CountOlderThanAsync(string target, string? tenantId, DateTimeOffset cutoff, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”target string
The target name.
tenantId string?
Only this tenant’s rows; if null, runs installation-wide
(the '*' policy).
cutoff DateTimeOffset
The cutoff date (UTC). Rows older than this match.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”The number of matching rows.
DeleteBatchAsync(string, string?, DateTimeOffset, int, CancellationToken)
Section titled “ DeleteBatchAsync(string, string?, DateTimeOffset, int, CancellationToken)”Deletes a batch of rows older than the cutoff date. This is not a
single bulk DELETE; it runs batch by batch, depending on the provider.
public ValueTask<int> DeleteBatchAsync(string target, string? tenantId, DateTimeOffset cutoff, int batchSize, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”target string
The target name.
tenantId string?
Only this tenant’s rows; if null, runs installation-wide
(the '*' policy).
cutoff DateTimeOffset
The cutoff date (UTC).
batchSize int
The maximum number of rows to delete.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”The number of rows deleted. Zero means no matching rows remain.
FindRowLimitCutoffAsync(string, string?, long, CancellationToken)
Section titled “ FindRowLimitCutoffAsync(string, string?, long, CancellationToken)”Counting from newest, returns the ordering column’s value at row
maxRows
as the cutoff date.
public ValueTask<DateTimeOffset?> FindRowLimitCutoffAsync(string target, string? tenantId, long maxRows, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”target string
The target name.
tenantId string?
Only this tenant’s rows; if null, runs installation-wide (the
'*' policy).
maxRows long
The maximum number of rows to keep (at least 1).
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”The cutoff date; null if the target holds FEWER than
maxRows
rows (the volume limit is not exceeded).
Remarks
Section titled “Remarks”The returned value can be passed directly into this interface’s other three
methods (the @cutoff parameter): volume-based trimming uses the SAME
batch mechanism as age-based deletion.
ReadForArchiveAsync(string, string?, DateTimeOffset, int, CancellationToken)
Section titled “ ReadForArchiveAsync(string, string?, DateTimeOffset, int, CancellationToken)”Reads a batch of rows older than the cutoff date (does not delete).
public ValueTask<IReadOnlyList<ArchiveRow>> ReadForArchiveAsync(string target, string? tenantId, DateTimeOffset cutoff, int batchSize, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”target string
The target name.
tenantId string?
Only this tenant’s rows; if null, runs installation-wide
(the '*' policy).
cutoff DateTimeOffset
The cutoff date (UTC).
batchSize int
The maximum number of rows to read.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”ValueTask<IReadOnlyList<ArchiveRow>>
The rows read; an empty list once no matching rows remain.