35 lines
1.6 KiB
C#
35 lines
1.6 KiB
C#
using ScadaLink.Commons.Entities.Audit;
|
|
|
|
namespace ScadaLink.AuditLog.Site.Telemetry;
|
|
|
|
/// <summary>
|
|
/// Site-local audit-log queue surface consumed by <see cref="SiteAuditTelemetryActor"/>.
|
|
/// Extracted from <see cref="SqliteAuditWriter"/> so the telemetry actor can be
|
|
/// unit-tested against a stub without touching SQLite. <see cref="SqliteAuditWriter"/>
|
|
/// implements this interface; production wiring injects the same instance.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Only the two methods the drain loop needs are exposed — the hot-path
|
|
/// <c>WriteAsync</c> stays on <see cref="Commons.Interfaces.Services.IAuditWriter"/>
|
|
/// (script-thread surface), separated by concern from the
|
|
/// telemetry-actor surface so each side can be mocked independently.
|
|
/// </remarks>
|
|
public interface ISiteAuditQueue
|
|
{
|
|
/// <summary>
|
|
/// Returns up to <paramref name="limit"/> rows currently in
|
|
/// <see cref="ScadaLink.Commons.Types.Enums.AuditForwardState.Pending"/>,
|
|
/// oldest first. Idempotent — repeated calls before
|
|
/// <see cref="MarkForwardedAsync"/> will yield the same rows again.
|
|
/// </summary>
|
|
Task<IReadOnlyList<AuditEvent>> ReadPendingAsync(int limit, CancellationToken ct = default);
|
|
|
|
/// <summary>
|
|
/// Flips the supplied EventIds from
|
|
/// <see cref="ScadaLink.Commons.Types.Enums.AuditForwardState.Pending"/> to
|
|
/// <see cref="ScadaLink.Commons.Types.Enums.AuditForwardState.Forwarded"/>.
|
|
/// Non-existent or already-forwarded ids are silent no-ops.
|
|
/// </summary>
|
|
Task MarkForwardedAsync(IReadOnlyList<Guid> eventIds, CancellationToken ct = default);
|
|
}
|