25 lines
771 B
C#
25 lines
771 B
C#
using System.Text.Json;
|
|
|
|
namespace StellaOps.AuditPack.Services;
|
|
|
|
/// <summary>
|
|
/// Writes self-contained audit bundles for deterministic offline replay.
|
|
/// </summary>
|
|
public sealed partial class AuditBundleWriter : IAuditBundleWriter
|
|
{
|
|
private readonly TimeProvider _timeProvider;
|
|
private readonly IAuditPackIdGenerator _idGenerator;
|
|
|
|
private static readonly JsonSerializerOptions _jsonOptions = new()
|
|
{
|
|
WriteIndented = false,
|
|
PropertyNamingPolicy = JsonNamingPolicy.CamelCase
|
|
};
|
|
|
|
public AuditBundleWriter(TimeProvider? timeProvider = null, IAuditPackIdGenerator? idGenerator = null)
|
|
{
|
|
_timeProvider = timeProvider ?? TimeProvider.System;
|
|
_idGenerator = idGenerator ?? new GuidAuditPackIdGenerator();
|
|
}
|
|
}
|