dotnet-cqrs/Svrnty.CQRS.Events.Abstractions/Storage/IRetentionPolicy.cs

37 lines
1.1 KiB
C#

using System;
using Svrnty.CQRS.Events.Abstractions.Storage;
namespace Svrnty.CQRS.Events.Abstractions.Storage;
/// <summary>
/// Defines retention policy for an event stream.
/// Controls how long events are kept before automatic cleanup.
/// </summary>
public interface IRetentionPolicy
{
/// <summary>
/// Stream name this policy applies to.
/// Use "*" for default policy that applies to all streams without specific policies.
/// </summary>
string StreamName { get; }
/// <summary>
/// Maximum age for events. Events older than this will be deleted.
/// Null means no time-based retention.
/// </summary>
TimeSpan? MaxAge { get; }
/// <summary>
/// Maximum number of events to retain per stream.
/// Only the most recent N events are kept, older events are deleted.
/// Null means no size-based retention.
/// </summary>
long? MaxEventCount { get; }
/// <summary>
/// Whether this retention policy is currently enabled.
/// Disabled policies are not enforced during cleanup.
/// </summary>
bool Enabled { get; }
}