| | | 1 | | namespace AsiBackbone.Core.Emissions; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Provider-neutral no-op governance emitter for tests, samples, local validation, and outbox proof-of-composition flow |
| | | 5 | | /// </summary> |
| | | 6 | | /// <remarks> |
| | | 7 | | /// This emitter does not send data to an external provider. It acknowledges the envelope as delivered so hosts can vali |
| | | 8 | | /// </remarks> |
| | | 9 | | public sealed class NoOpGovernanceEmitter : IAsiBackboneGovernanceEmitter |
| | | 10 | | { |
| | | 11 | | /// <summary> |
| | | 12 | | /// Gets the provider name used by the no-op emitter. |
| | | 13 | | /// </summary> |
| | | 14 | | public const string ProviderName = "noop"; |
| | | 15 | | |
| | 1 | 16 | | private static readonly IReadOnlyDictionary<string, string> DeliveredMetadata = new Dictionary<string, string>(Strin |
| | 1 | 17 | | { |
| | 1 | 18 | | ["emitter.kind"] = "noop", |
| | 1 | 19 | | ["emitter.purpose"] = "outbox-drain-validation" |
| | 1 | 20 | | }; |
| | | 21 | | |
| | | 22 | | /// <summary> |
| | | 23 | | /// Gets a reusable no-op governance emitter instance. |
| | | 24 | | /// </summary> |
| | 3 | 25 | | public static NoOpGovernanceEmitter Instance { get; } = new(); |
| | | 26 | | |
| | | 27 | | /// <inheritdoc /> |
| | | 28 | | public ValueTask<GovernanceEmissionResult> EmitAsync( |
| | | 29 | | GovernanceEmissionEnvelope envelope, |
| | | 30 | | CancellationToken cancellationToken = default) |
| | | 31 | | { |
| | 2 | 32 | | ArgumentNullException.ThrowIfNull(envelope); |
| | 2 | 33 | | cancellationToken.ThrowIfCancellationRequested(); |
| | | 34 | | |
| | 2 | 35 | | var result = GovernanceEmissionResult.Delivered( |
| | 2 | 36 | | ProviderName, |
| | 2 | 37 | | providerRecordId: envelope.EnvelopeId, |
| | 2 | 38 | | DeliveredMetadata); |
| | | 39 | | |
| | 2 | 40 | | return ValueTask.FromResult(result); |
| | | 41 | | } |
| | | 42 | | } |