Skip to content

Commit 34822c6

Browse files
Copilotmrdevrobot
andauthored
[Architecture] Split EntglDb.Network into transport layer (EntglDb.Network) and sync algorithm (EntglDb.Sync) (#20)
* Initial plan * Split EntglDb.Network: create EntglDb.Sync, move sync algorithm out of transport layer Co-authored-by: mrdevrobot <12503462+mrdevrobot@users.noreply.github.com> * Remove unused useHostedService parameter from AddEntglDbNetwork Co-authored-by: mrdevrobot <12503462+mrdevrobot@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mrdevrobot <12503462+mrdevrobot@users.noreply.github.com>
1 parent 9c039ff commit 34822c6

48 files changed

Lines changed: 229 additions & 108 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

EntglDb.Net.sln

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EntglDb.Core", "src\EntglDb
2525
EndProject
2626
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EntglDb.Network", "src\EntglDb.Network\EntglDb.Network.csproj", "{D937D898-898C-C265-F457-B2E2D520AB1C}"
2727
EndProject
28+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EntglDb.Sync", "src\EntglDb.Sync\EntglDb.Sync.csproj", "{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}"
29+
EndProject
2830
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EntglDb.Persistence", "src\EntglDb.Persistence\EntglDb.Persistence.csproj", "{5979B9EF-FACE-4BD0-BFA3-B1BB5D7103C5}"
2931
EndProject
3032
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EntglDb.Persistence.BLite", "src\EntglDb.Persistence.BLite\EntglDb.Persistence.BLite.csproj", "{112520EF-9DF0-FA05-B020-814D6DF4C973}"
@@ -148,6 +150,18 @@ Global
148150
{D937D898-898C-C265-F457-B2E2D520AB1C}.Release|x64.Build.0 = Release|Any CPU
149151
{D937D898-898C-C265-F457-B2E2D520AB1C}.Release|x86.ActiveCfg = Release|Any CPU
150152
{D937D898-898C-C265-F457-B2E2D520AB1C}.Release|x86.Build.0 = Release|Any CPU
153+
{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
154+
{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}.Debug|Any CPU.Build.0 = Debug|Any CPU
155+
{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}.Debug|x64.ActiveCfg = Debug|Any CPU
156+
{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}.Debug|x64.Build.0 = Debug|Any CPU
157+
{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}.Debug|x86.ActiveCfg = Debug|Any CPU
158+
{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}.Debug|x86.Build.0 = Debug|Any CPU
159+
{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}.Release|Any CPU.ActiveCfg = Release|Any CPU
160+
{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}.Release|Any CPU.Build.0 = Release|Any CPU
161+
{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}.Release|x64.ActiveCfg = Release|Any CPU
162+
{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}.Release|x64.Build.0 = Release|Any CPU
163+
{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}.Release|x86.ActiveCfg = Release|Any CPU
164+
{A1B2C3D4-E5F6-7890-ABCD-EF1234567890}.Release|x86.Build.0 = Release|Any CPU
151165
{5979B9EF-FACE-4BD0-BFA3-B1BB5D7103C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
152166
{5979B9EF-FACE-4BD0-BFA3-B1BB5D7103C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
153167
{5979B9EF-FACE-4BD0-BFA3-B1BB5D7103C5}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -257,6 +271,7 @@ Global
257271
{B8A0DA5C-7FC2-E1F2-AE0F-91964FF3A05D} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
258272
{FCC15AE2-0010-DCCB-F853-7BE8D5533C52} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
259273
{D937D898-898C-C265-F457-B2E2D520AB1C} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
274+
{A1B2C3D4-E5F6-7890-ABCD-EF1234567890} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
260275
{5979B9EF-FACE-4BD0-BFA3-B1BB5D7103C5} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
261276
{112520EF-9DF0-FA05-B020-814D6DF4C973} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}
262277
{2E86B090-9D4C-7626-72E2-876F173A764D} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B}

samples/EntglDb.Demo.Game.MonoGame/Program.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using EntglDb.Demo.Game.MonoGame;
55
using EntglDb.Network;
66
using EntglDb.Persistence.BLite;
7+
using EntglDb.Sync;
78
using Microsoft.Extensions.DependencyInjection;
89
using Microsoft.Extensions.Hosting;
910
using Microsoft.Extensions.Logging;
@@ -39,7 +40,8 @@
3940
// Register EntglDb with BLite
4041
builder.Services.AddEntglDbCore()
4142
.AddEntglDbBLite<GameDbContext, GameDocumentStore>(sp => new GameDbContext(databasePath), databasePath + ".meta")
42-
.AddEntglDbNetwork<StaticPeerNodeConfigurationProvider>();
43+
.AddEntglDbNetwork<StaticPeerNodeConfigurationProvider>()
44+
.AddEntglDbSync();
4345

4446
// Build DI container
4547
var host = builder.Build();

samples/EntglDb.Demo.Game/EntglDb.Demo.Game.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99

1010
<ItemGroup>
1111
<ProjectReference Include="..\..\src\EntglDb.Core\EntglDb.Core.csproj" />
12-
<ProjectReference Include="..\..\src\EntglDb.Network\EntglDb.Network.csproj" />
12+
<ProjectReference Include="..\..\src\EntglDb.Network\EntglDb.Network.csproj" />
13+
<ProjectReference Include="..\..\src\EntglDb.Sync\EntglDb.Sync.csproj" />
1314
<ProjectReference Include="..\..\src\EntglDb.Persistence.BLite\EntglDb.Persistence.BLite.csproj" />
1415
</ItemGroup>
1516

samples/EntglDb.Demo.Game/Program.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using EntglDb.Demo.Game;
44
using EntglDb.Network;
55
using EntglDb.Persistence.BLite;
6+
using EntglDb.Sync;
67
using Microsoft.Extensions.Configuration;
78
using Microsoft.Extensions.DependencyInjection;
89
using Microsoft.Extensions.Hosting;
@@ -45,7 +46,8 @@
4546
// Register EntglDb with BLite
4647
builder.Services.AddEntglDbCore()
4748
.AddEntglDbBLite<GameDbContext, GameDocumentStore>(sp => new GameDbContext(databasePath), databasePath + ".meta")
48-
.AddEntglDbNetwork<StaticPeerNodeConfigurationProvider>();
49+
.AddEntglDbNetwork<StaticPeerNodeConfigurationProvider>()
50+
.AddEntglDbSync();
4951

5052
// Game service
5153
builder.Services.AddHostedService<GameService>();

samples/EntglDb.Sample.AspNetCore/EntglDb.Sample.AspNetCore.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313

1414
<ItemGroup>
1515
<ProjectReference Include="..\..\src\EntglDb.Core\EntglDb.Core.csproj" />
16-
<ProjectReference Include="..\..\src\EntglDb.Network\EntglDb.Network.csproj" />
16+
<ProjectReference Include="..\..\src\EntglDb.Network\EntglDb.Network.csproj" />
17+
<ProjectReference Include="..\..\src\EntglDb.Sync\EntglDb.Sync.csproj" />
1718
<ProjectReference Include="..\..\src\EntglDb.Persistence.BLite\EntglDb.Persistence.BLite.csproj" />
1819
<ProjectReference Include="..\EntglDb.Sample.Shared\EntglDb.Sample.Shared.csproj" />
1920
</ItemGroup>

samples/EntglDb.Sample.AspNetCore/Program.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using EntglDb.Network;
44
using EntglDb.Persistence.BLite;
55
using EntglDb.Sample.Shared;
6+
using EntglDb.Sync;
67
using Microsoft.AspNetCore.Mvc;
78
using Microsoft.OpenApi;
89

@@ -36,7 +37,8 @@
3637

3738
builder.Services.AddEntglDbCore()
3839
.AddEntglDbBLite<SampleDbContext, SampleDocumentStore>(sp => new SampleDbContext(databasePath), databasePath + ".meta")
39-
.AddEntglDbNetwork<AspNetPeerNodeConfigurationProvider>(useHostedService: true);
40+
.AddEntglDbNetwork<AspNetPeerNodeConfigurationProvider>() // transport only
41+
.AddEntglDbSync(useHostedService: true); // sync handlers + node orchestrator
4042

4143
var app = builder.Build();
4244

samples/EntglDb.Sample.Console/EntglDb.Sample.Console.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<PackageReference Include="Lifter.Core" Version="1.1.0" />
55
<ProjectReference Include="..\..\src\EntglDb.Core\EntglDb.Core.csproj" />
66
<ProjectReference Include="..\..\src\EntglDb.Network\EntglDb.Network.csproj" />
7+
<ProjectReference Include="..\..\src\EntglDb.Sync\EntglDb.Sync.csproj" />
78
</ItemGroup>
89

910
<ItemGroup>

samples/EntglDb.Sample.Console/Program.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
using EntglDb.Sample.Shared;
1414
using Microsoft.Extensions.Hosting;
1515
using EntglDb.Core.Network;
16+
using EntglDb.Sync;
1617

1718
namespace EntglDb.Sample.Console;
1819

@@ -65,7 +66,8 @@ static async Task Main(string[] args)
6566
// Register EntglDb Services using Fluent Extensions with BLite, SampleDbContext, and SampleDocumentStore
6667
builder.Services.AddEntglDbCore()
6768
.AddEntglDbBLite<SampleDbContext, SampleDocumentStore>(sp => new SampleDbContext(databasePath), databasePath + ".meta")
68-
.AddEntglDbNetwork<StaticPeerNodeConfigurationProvider>(); // useHostedService = true by default
69+
.AddEntglDbNetwork<StaticPeerNodeConfigurationProvider>() // transport only
70+
.AddEntglDbSync(); // sync handlers + node orchestrator
6971

7072
builder.Services.AddHostedService<ConsoleInteractiveService>(); // Runs the Input Loop
7173

samples/EntglDb.Test.Avalonia/App.axaml.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using EntglDb.Network.Security;
88
using EntglDb.Persistence.BLite;
99
using EntglDb.Sample.Shared;
10+
using EntglDb.Sync;
1011
using Lifter.Avalonia;
1112
using Microsoft.Extensions.Configuration;
1213
using Microsoft.Extensions.DependencyInjection;
@@ -59,6 +60,7 @@ protected override void ConfigureServices(
5960
// Register EntglDb Services using Fluent Extensions
6061
services.AddEntglDbCore()
6162
.AddEntglDbBLite<SampleDbContext, SampleDocumentStore>(sp => new SampleDbContext(databasePath), databasePath + ".meta")
62-
.AddEntglDbNetwork<StaticPeerNodeConfigurationProvider>();
63+
.AddEntglDbNetwork<StaticPeerNodeConfigurationProvider>()
64+
.AddEntglDbSync();
6365
}
6466
}

samples/EntglDb.Test.Avalonia/EntglDb.Test.Avalonia.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010

1111
<ItemGroup>
1212
<ProjectReference Include="..\..\src\EntglDb.Core\EntglDb.Core.csproj" />
13-
<ProjectReference Include="..\..\src\EntglDb.Network\EntglDb.Network.csproj" />
13+
<ProjectReference Include="..\..\src\EntglDb.Network\EntglDb.Network.csproj" />
14+
<ProjectReference Include="..\..\src\EntglDb.Sync\EntglDb.Sync.csproj" />
1415
<ProjectReference Include="..\..\src\EntglDb.Persistence.BLite\EntglDb.Persistence.BLite.csproj" />
1516
<ProjectReference Include="..\EntglDb.Sample.Shared\EntglDb.Sample.Shared.csproj" />
1617
</ItemGroup>

0 commit comments

Comments
 (0)