feat(routes): add pool accounting per account and S2 compression codec (D2+D3)

D2: Add FNV-1a-based ComputeRoutePoolIdx to RouteManager matching Go's
route.go:533-545, with PoolIndex on RouteConnection and account-aware
ForwardRoutedMessageAsync that routes to the correct pool connection.

D3: Replace DeflateStream with IronSnappy in RouteCompressionCodec, add
RouteCompressionLevel enum, NegotiateCompression, and IsCompressed
detection. 17 new tests (6 pool + 11 compression), all passing.
This commit is contained in:
Joseph Doherty
2026-02-24 15:11:20 -05:00
parent 21d10582b3
commit 386cc201de
6 changed files with 479 additions and 19 deletions

View File

@@ -15,6 +15,13 @@ public sealed class RouteConnection(Socket socket) : IAsyncDisposable
public string? RemoteServerId { get; private set; }
public string RemoteEndpoint => _socket.RemoteEndPoint?.ToString() ?? Guid.NewGuid().ToString("N");
/// <summary>
/// The pool index assigned to this route connection. Used for account-based
/// routing to deterministically select which pool connection handles traffic
/// for a given account. See <see cref="RouteManager.ComputeRoutePoolIdx"/>.
/// </summary>
public int PoolIndex { get; set; }
public Func<RemoteSubscription, Task>? RemoteSubscriptionReceived { get; set; }
public Func<RouteMessage, Task>? RoutedMessageReceived { get; set; }