Skip to content

[Architecture] Project split: separate transport (EntglDb.Network) from sync algorithm (EntglDb.Sync) #17

@mrdevrobot

Description

@mrdevrobot

Goal

Split EntglDb.Network into two separate projects:

  • EntglDb.Network: pure transport layer (TCP, UDP, framing, crypto, discovery, leadership, telemetry)
  • EntglDb.Sync (new): synchronization algorithm (oplog, vector clocks, snapshots, anti-entropy orchestrator)

Depends on: #16 (handler registry must be implemented first)

Motivation

EntglDb.Network currently mixes two very different responsibilities. The transport layer has direct knowledge of IOplogStore, IDocumentStore, ISnapshotService — concepts it should not know about. After the split, any service (not just database sync) can register itself on the network without depending on sync-specific code.

Target structure

EntglDb.Network (transport only)

  • Protocol/: ProtocolHandler, framing, compression, encryption
  • Security/: IAuthenticator, SecureHandshakeService, JWT, OAuth2, CryptoHelper
  • Leadership/: BullyLeaderElectionService
  • Telemetry/: NetworkTelemetryService, MetricType
  • TcpSyncServer — dispatch via IMessageHandler registry (no dependency on Core)
  • TcpPeerClient — generic client, no sync-specific methods
  • UdpDiscoveryService, CompositeDiscoveryService

Dependencies: NO dependency on EntglDb.Core

EntglDb.Sync (new project)

  • SyncOrchestrator, ISyncOrchestrator
  • EntglDbNode, EntglDbNodeService, IEntglDbNode
  • Handlers/: GetClockHandler, GetVectorClockHandler, PullChangesHandler, PushChangesHandler, GetChainRangeHandler, GetSnapshotHandler
  • SyncPeerClient (wraps TcpPeerClient with sync-specific methods)
  • sync.proto
  • SyncExtensions for DI registration

Dependencies: EntglDb.Network + EntglDb.Core

Post-split dependency graph

EntglDb.Sync --> EntglDb.Network (uses IMessageHandler, TcpPeerClient) --> EntglDb.Core (uses IOplogStore, IDocumentStore, ISnapshotService) EntglDb.Network --> runtime + Protobuf only (ZERO dependency on Core)

Files to move: Network -> Sync

Acceptance criteria

  • dotnet build EntglDb.Net.sln — 0 errors
  • All tests pass unchanged
  • EntglDb.Network.csproj does not reference EntglDb.Core
  • Smoke test with 2 nodes: sync works correctly

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions