Implement in-process multi-dataset sync isolation across core, network, persistence, and tests
All checks were successful
NuGet Package Publish / nuget (push) Successful in 1m14s

This commit is contained in:
Joseph Doherty
2026-02-22 11:58:34 -05:00
parent c06b56172a
commit 8e97061ab8
60 changed files with 4519 additions and 559 deletions

View File

@@ -1,5 +1,6 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using ZB.MOM.WW.CBDDC.Core;
using ZB.MOM.WW.CBDDC.Core.Network;
using SurrealDb.Net;
using ZB.MOM.WW.CBDDC.Core.Storage;
@@ -46,6 +47,62 @@ public static class CBDDCSurrealEmbeddedExtensions
return services;
}
/// <summary>
/// Registers dataset synchronization options for a Surreal-backed dataset pipeline.
/// </summary>
/// <param name="services">The service collection.</param>
/// <param name="datasetId">The dataset identifier.</param>
/// <param name="configure">Optional per-dataset option overrides.</param>
/// <returns>The service collection for chaining.</returns>
public static IServiceCollection AddCBDDCSurrealEmbeddedDataset(
this IServiceCollection services,
string datasetId,
Action<DatasetSyncOptions>? configure = null)
{
if (services == null) throw new ArgumentNullException(nameof(services));
var options = new DatasetSyncOptions
{
DatasetId = DatasetId.Normalize(datasetId),
Enabled = true
};
configure?.Invoke(options);
options.DatasetId = DatasetId.Normalize(options.DatasetId);
services.AddSingleton(options);
return services;
}
/// <summary>
/// Registers dataset synchronization options for a Surreal-backed dataset pipeline.
/// </summary>
/// <param name="services">The service collection.</param>
/// <param name="configure">Configuration delegate for dataset options.</param>
/// <returns>The service collection for chaining.</returns>
public static IServiceCollection AddCBDDCSurrealEmbeddedDataset(
this IServiceCollection services,
Action<DatasetSyncOptions> configure)
{
if (configure == null) throw new ArgumentNullException(nameof(configure));
var options = new DatasetSyncOptions
{
DatasetId = DatasetId.Primary,
Enabled = true
};
configure(options);
return services.AddCBDDCSurrealEmbeddedDataset(options.DatasetId, configured =>
{
configured.Enabled = options.Enabled;
configured.SyncLoopDelay = options.SyncLoopDelay;
configured.MaxPeersPerCycle = options.MaxPeersPerCycle;
configured.MaxEntriesPerCycle = options.MaxEntriesPerCycle;
configured.MaintenanceIntervalOverride = options.MaintenanceIntervalOverride;
configured.InterestingCollections = options.InterestingCollections.ToList();
});
}
private static void RegisterCoreServices(
IServiceCollection services,
Func<IServiceProvider, CBDDCSurrealEmbeddedOptions> optionsFactory)