Skip to content

NullRetentionStore

Namespace AgentPrism · Assembly AgentPrism.Core.dll

The no-op default data-plane implementation. It is registered with in-memory stores and always returns “nothing matched”.

public sealed class NullRetentionStore : IRetentionStore

objectNullRetentionStore

IRetentionStore

object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

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.

public NullRetentionStore()

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)

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.

ValueTask<long>

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)

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.

ValueTask<int>

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)

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.

ValueTask<DateTimeOffset?>

The cutoff date; null if the target holds FEWER than maxRows rows (the volume limit is not exceeded).

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)

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.

ValueTask<IReadOnlyList<ArchiveRow>>

The rows read; an empty list once no matching rows remain.