Skip to content

RetentionPolicy

Namespace AgentPrism · Assembly AgentPrism.Abstractions.dll

An age- and volume-based retention rule for a target.

public sealed record RetentionPolicy : IEquatable<RetentionPolicy>

objectRetentionPolicy

IEquatable<RetentionPolicy>

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

If no record exists, nothing is deleted for the target (see AgentPrismRetentionOptions’ configuration-based defaults — they take effect only when the database has no record).

public RetentionPolicy()

Whether to archive with IArchiveSink before deleting. If no sink is registered, no row is deleted even if this field is true.

public bool Archive { get; init; }

bool

The creation time (UTC).

public required DateTimeOffset CreatedAt { get; init; }

DateTimeOffset

Whether the policy is enabled.

public bool Enabled { get; init; }

bool

The policy identifier.

public required Guid Id { get; init; }

Guid

Rows older than this age are candidates for deletion. If null, age-based deletion does not apply (only MaxRows, if set, applies).

public int? MaxAgeDays { get; init; }

int?

The maximum number of rows to keep in the target table. The oldest rows over the limit are deleted. If null, volume-based deletion does not apply (only MaxAgeDays, if set, applies).

public long? MaxRows { get; init; }

long?

The target table name. See RetentionTargets.

public required string Target { get; init; }

string

The tenant identifier. "*" means the default for all tenants.

public required string TenantId { get; init; }

string

The last-updated time (UTC).

public required DateTimeOffset UpdatedAt { get; init; }

DateTimeOffset

public override bool Equals(object? obj)

obj object?

bool

public bool Equals(RetentionPolicy? other)

other RetentionPolicy?

bool

public override int GetHashCode()

int

public override string ToString()

string

operator ==(RetentionPolicy?, RetentionPolicy?)

Section titled “ operator ==(RetentionPolicy?, RetentionPolicy?)”
public static bool operator ==(RetentionPolicy? left, RetentionPolicy? right)

left RetentionPolicy?

right RetentionPolicy?

bool

operator !=(RetentionPolicy?, RetentionPolicy?)

Section titled “ operator !=(RetentionPolicy?, RetentionPolicy?)”
public static bool operator !=(RetentionPolicy? left, RetentionPolicy? right)

left RetentionPolicy?

right RetentionPolicy?

bool