Files
lmxopcua/src/Server/ZB.MOM.WW.OtOpcUa.Runtime/Historian/IHistorianRetention.cs
T

26 lines
1.2 KiB
C#

namespace ZB.MOM.WW.OtOpcUa.Runtime.Historian;
/// <summary>Rows removed from one historian table by a single purge pass.</summary>
/// <param name="Table">Unqualified table name (the <c>table</c> tag on the retention counter).</param>
/// <param name="Rows">Rows deleted.</param>
public sealed record RetentionPurgeResult(string Table, long Rows);
/// <summary>
/// Backend-side retention purge: deletes history older than the backend's configured retention window.
/// Created by <see cref="IHistorianBackendProvider.CreateRetention"/> and driven on a timer by
/// <see cref="HistorianRetentionService"/>, which owns scheduling and the Primary gate.
/// </summary>
public interface IHistorianRetention
{
/// <summary>How often <see cref="HistorianRetentionService"/> should run a pass.</summary>
TimeSpan Interval { get; }
/// <summary>
/// Runs one purge pass. Returns an empty list when the pass was skipped (another process holds the
/// purge lock). Implementations honour cancellation between batches.
/// </summary>
/// <param name="ct">Cancellation.</param>
/// <returns>Per-table deleted-row counts.</returns>
Task<IReadOnlyList<RetentionPurgeResult>> PurgeAsync(CancellationToken ct);
}