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:
@@ -112,6 +112,7 @@ public class ConsoleInteractiveService : BackgroundService
|
||||
System.Console.WriteLine("Commands:");
|
||||
System.Console.WriteLine(" [p]ut, [g]et, [d]elete, [f]ind, [l]ist peers, [q]uit");
|
||||
System.Console.WriteLine(" [n]ew (auto), [s]pam (5x), [c]ount, [t]odos");
|
||||
System.Console.WriteLine(" log [count], ts [count] (append telemetry load)");
|
||||
System.Console.WriteLine(" [h]ealth, cac[h]e");
|
||||
System.Console.WriteLine(" [r]esolver [lww|merge], [demo] conflict");
|
||||
}
|
||||
@@ -156,8 +157,12 @@ public class ConsoleInteractiveService : BackgroundService
|
||||
{
|
||||
int userCount = _db.Users.FindAll().Count();
|
||||
int todoCount = _db.TodoLists.FindAll().Count();
|
||||
int logCount = _db.Logs.FindAll().Count();
|
||||
int timeseriesCount = _db.Timeseries.FindAll().Count();
|
||||
System.Console.WriteLine($"Collection 'Users': {userCount} documents");
|
||||
System.Console.WriteLine($"Collection 'TodoLists': {todoCount} documents");
|
||||
System.Console.WriteLine($"Collection 'Logs': {logCount} documents");
|
||||
System.Console.WriteLine($"Collection 'Timeseries': {timeseriesCount} documents");
|
||||
}
|
||||
else if (input.StartsWith("p"))
|
||||
{
|
||||
@@ -212,6 +217,42 @@ public class ConsoleInteractiveService : BackgroundService
|
||||
var results = _db.Users.Find(u => u.Age > 28);
|
||||
foreach (var u in results) System.Console.WriteLine($"Found: {u.Name} ({u.Age})");
|
||||
}
|
||||
else if (input.StartsWith("log", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
int count = ParseCount(input, 100);
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
var entry = new TelemetryLogEntry
|
||||
{
|
||||
Id = Guid.NewGuid().ToString("N"),
|
||||
Level = i % 25 == 0 ? "Warning" : "Information",
|
||||
Message = $"sample-log-{DateTimeOffset.UtcNow:O}-{i}",
|
||||
CreatedUtc = DateTime.UtcNow
|
||||
};
|
||||
await _db.Logs.InsertAsync(entry);
|
||||
}
|
||||
|
||||
await _db.SaveChangesAsync();
|
||||
System.Console.WriteLine($"Appended {count} log entries.");
|
||||
}
|
||||
else if (input.StartsWith("ts", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
int count = ParseCount(input, 100);
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
var point = new TimeseriesPoint
|
||||
{
|
||||
Id = Guid.NewGuid().ToString("N"),
|
||||
Metric = i % 2 == 0 ? "cpu" : "latency",
|
||||
Value = Random.Shared.NextDouble() * 100,
|
||||
RecordedUtc = DateTime.UtcNow
|
||||
};
|
||||
await _db.Timeseries.InsertAsync(point);
|
||||
}
|
||||
|
||||
await _db.SaveChangesAsync();
|
||||
System.Console.WriteLine($"Appended {count} timeseries points.");
|
||||
}
|
||||
else if (input.StartsWith("h"))
|
||||
{
|
||||
var health = await _healthCheck.CheckAsync();
|
||||
@@ -283,6 +324,13 @@ public class ConsoleInteractiveService : BackgroundService
|
||||
}
|
||||
}
|
||||
|
||||
private static int ParseCount(string input, int fallback)
|
||||
{
|
||||
string[] parts = input.Split(' ', StringSplitOptions.RemoveEmptyEntries);
|
||||
if (parts.Length < 2) return fallback;
|
||||
return int.TryParse(parts[1], out int parsed) && parsed > 0 ? parsed : fallback;
|
||||
}
|
||||
|
||||
private async Task RunConflictDemo()
|
||||
{
|
||||
System.Console.WriteLine("\n=== Conflict Resolution Demo ===");
|
||||
@@ -355,4 +403,4 @@ public class ConsoleInteractiveService : BackgroundService
|
||||
|
||||
System.Console.WriteLine("\n✓ Demo complete. Run 'todos' to see all lists.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user