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
All checks were successful
NuGet Package Publish / nuget (push) Successful in 1m14s
This commit is contained in:
@@ -11,6 +11,8 @@ public class SampleDbContext : IDisposable
|
||||
{
|
||||
private const string UsersTable = "sample_users";
|
||||
private const string TodoListsTable = "sample_todo_lists";
|
||||
private const string LogsTable = "sample_logs";
|
||||
private const string TimeseriesTable = "sample_timeseries";
|
||||
|
||||
private readonly bool _ownsClient;
|
||||
|
||||
@@ -28,6 +30,8 @@ public class SampleDbContext : IDisposable
|
||||
|
||||
Users = new SampleSurrealCollection<User>(UsersTable, u => u.Id, SurrealEmbeddedClient, SchemaInitializer);
|
||||
TodoLists = new SampleSurrealCollection<TodoList>(TodoListsTable, t => t.Id, SurrealEmbeddedClient, SchemaInitializer);
|
||||
Logs = new SampleSurrealCollection<TelemetryLogEntry>(LogsTable, e => e.Id, SurrealEmbeddedClient, SchemaInitializer);
|
||||
Timeseries = new SampleSurrealCollection<TimeseriesPoint>(TimeseriesTable, p => p.Id, SurrealEmbeddedClient, SchemaInitializer);
|
||||
OplogEntries = new SampleSurrealReadOnlyCollection<SampleOplogEntry>(
|
||||
CBDDCSurrealSchemaNames.OplogEntriesTable,
|
||||
SurrealEmbeddedClient,
|
||||
@@ -57,6 +61,8 @@ public class SampleDbContext : IDisposable
|
||||
|
||||
Users = new SampleSurrealCollection<User>(UsersTable, u => u.Id, SurrealEmbeddedClient, SchemaInitializer);
|
||||
TodoLists = new SampleSurrealCollection<TodoList>(TodoListsTable, t => t.Id, SurrealEmbeddedClient, SchemaInitializer);
|
||||
Logs = new SampleSurrealCollection<TelemetryLogEntry>(LogsTable, e => e.Id, SurrealEmbeddedClient, SchemaInitializer);
|
||||
Timeseries = new SampleSurrealCollection<TimeseriesPoint>(TimeseriesTable, p => p.Id, SurrealEmbeddedClient, SchemaInitializer);
|
||||
OplogEntries = new SampleSurrealReadOnlyCollection<SampleOplogEntry>(
|
||||
CBDDCSurrealSchemaNames.OplogEntriesTable,
|
||||
SurrealEmbeddedClient,
|
||||
@@ -88,6 +94,16 @@ public class SampleDbContext : IDisposable
|
||||
/// </summary>
|
||||
public SampleSurrealReadOnlyCollection<SampleOplogEntry> OplogEntries { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the append-only telemetry logs collection.
|
||||
/// </summary>
|
||||
public SampleSurrealCollection<TelemetryLogEntry> Logs { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the append-only timeseries collection.
|
||||
/// </summary>
|
||||
public SampleSurrealCollection<TimeseriesPoint> Timeseries { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Ensures schema changes are applied before persisting updates.
|
||||
/// </summary>
|
||||
@@ -102,6 +118,8 @@ public class SampleDbContext : IDisposable
|
||||
{
|
||||
Users.Dispose();
|
||||
TodoLists.Dispose();
|
||||
Logs.Dispose();
|
||||
Timeseries.Dispose();
|
||||
|
||||
if (_ownsClient) SurrealEmbeddedClient.Dispose();
|
||||
}
|
||||
@@ -126,6 +144,8 @@ public sealed class SampleSurrealSchemaInitializer : ICBDDCSurrealSchemaInitiali
|
||||
private const string SampleSchemaSql = """
|
||||
DEFINE TABLE OVERWRITE sample_users SCHEMALESS CHANGEFEED 7d;
|
||||
DEFINE TABLE OVERWRITE sample_todo_lists SCHEMALESS CHANGEFEED 7d;
|
||||
DEFINE TABLE OVERWRITE sample_logs SCHEMALESS CHANGEFEED 7d;
|
||||
DEFINE TABLE OVERWRITE sample_timeseries SCHEMALESS CHANGEFEED 7d;
|
||||
""";
|
||||
private readonly ICBDDCSurrealEmbeddedClient _client;
|
||||
private int _initialized;
|
||||
|
||||
Reference in New Issue
Block a user