using ZB.MOM.WW.Audit; namespace ZB.MOM.WW.MxGateway.Server.Security.Audit; /// /// Durable sink the audit pipeline persists canonical s through. /// It exists so the write path () and the batching drain /// () depend on the storage contract rather than on the /// concrete . /// public interface IAuditEventSink { /// /// Bootstraps the backing storage. Called once at startup so no write path pays a schema /// round-trip; implementations must be idempotent and safe to call concurrently. /// /// Token to observe for cancellation. /// A task that represents the asynchronous operation. Task EnsureInitializedAsync(CancellationToken cancellationToken); /// Persists a single canonical audit event. /// The canonical event to persist. /// Token to observe for cancellation. /// A task that represents the asynchronous operation. Task InsertAsync(AuditEvent auditEvent, CancellationToken cancellationToken); /// Persists a batch of canonical audit events as one unit of work. /// The canonical events to persist. /// Token to observe for cancellation. /// A task that represents the asynchronous operation. Task InsertBatchAsync(IReadOnlyList auditEvents, CancellationToken cancellationToken); /// Deletes every audit row that occurred strictly before . /// The retention cutoff; rows older than this are removed. /// Token to observe for cancellation. /// The number of rows deleted. Task DeleteOlderThanAsync(DateTimeOffset cutoffUtc, CancellationToken cancellationToken); }