| | | 1 | | using AsiBackbone.Core.Audit; |
| | | 2 | | using AsiBackbone.Core.Outbox; |
| | | 3 | | using AsiBackbone.DependencyInjection; |
| | | 4 | | using AsiBackbone.Storage.InMemory.Audit; |
| | | 5 | | using AsiBackbone.Storage.InMemory.Outbox; |
| | | 6 | | using Microsoft.Extensions.DependencyInjection; |
| | | 7 | | |
| | | 8 | | namespace AsiBackbone.Storage.InMemory; |
| | | 9 | | |
| | | 10 | | /// <summary> |
| | | 11 | | /// Provides explicit builder facade extension methods for non-durable in-memory storage. |
| | | 12 | | /// </summary> |
| | | 13 | | public static class InMemoryStorageBuilderExtensions |
| | | 14 | | { |
| | | 15 | | /// <summary> |
| | | 16 | | /// Adds the non-durable in-memory audit sink through the AsiBackbone builder facade. |
| | | 17 | | /// </summary> |
| | | 18 | | public static IAsiBackboneBuilder UseInMemoryAuditLedger(this IAsiBackboneBuilder builder) |
| | | 19 | | { |
| | 0 | 20 | | ArgumentNullException.ThrowIfNull(builder); |
| | | 21 | | |
| | 0 | 22 | | _ = builder.Services.AddSingleton<InMemoryAuditLedger>(); |
| | 0 | 23 | | _ = builder.Services.AddSingleton<IAsiBackboneAuditSink>(serviceProvider => |
| | 0 | 24 | | serviceProvider.GetRequiredService<InMemoryAuditLedger>()); |
| | | 25 | | |
| | 0 | 26 | | return builder; |
| | | 27 | | } |
| | | 28 | | |
| | | 29 | | /// <summary> |
| | | 30 | | /// Adds the non-durable in-memory audit residue lifecycle store through the AsiBackbone builder facade. |
| | | 31 | | /// </summary> |
| | | 32 | | public static IAsiBackboneBuilder UseInMemoryAuditLifecycle(this IAsiBackboneBuilder builder) |
| | | 33 | | { |
| | 0 | 34 | | ArgumentNullException.ThrowIfNull(builder); |
| | | 35 | | |
| | 0 | 36 | | _ = builder.Services.AddSingleton<IAsiBackboneAuditResidueLifecycleStore, InMemoryAuditResidueLifecycleStore>(); |
| | 0 | 37 | | return builder; |
| | | 38 | | } |
| | | 39 | | |
| | | 40 | | /// <summary> |
| | | 41 | | /// Adds the non-durable in-memory governance outbox store through the AsiBackbone builder facade. |
| | | 42 | | /// </summary> |
| | | 43 | | public static IAsiBackboneBuilder UseInMemoryGovernanceOutbox(this IAsiBackboneBuilder builder) |
| | | 44 | | { |
| | 0 | 45 | | ArgumentNullException.ThrowIfNull(builder); |
| | | 46 | | |
| | 0 | 47 | | _ = builder.Services.AddSingleton<IAsiBackboneGovernanceOutboxStore, InMemoryGovernanceOutboxStore>(); |
| | 0 | 48 | | return builder; |
| | | 49 | | } |
| | | 50 | | } |