feat: port sessions 12 & 13 — Events/Monitoring/MsgTrace + Config Reload

Session 12 (218 features, IDs 854-950, 2166-2251, 2405-2439):
- EventTypes: system subjects, event message types, InternalState, ConnectEventMsg,
  DisconnectEventMsg, AccountNumConns, ServerIdentity, DataStats
- MonitorTypes: Connz, ConnInfo, ConnzOptions, ConnState, ProxyInfo, TlsPeerCert
- MonitorSortOptions: SortOpt, ConnInfos, all 13 sort comparers
- MsgTraceTypes: IMsgTrace, MsgTraceBase + 6 concrete types, custom JSON converter

Session 13 (89 features, IDs 2800-2888):
- ReloadOptions: IReloadOption interface, NoopReloadOption base, 50 option classes
  covering logging, TLS, auth, cluster, JetStream, MQTT, OCSP, misc
This commit is contained in:
Joseph Doherty
2026-02-26 15:46:14 -05:00
parent 12a14ec476
commit ce45dff994
11 changed files with 2971 additions and 47 deletions

View File

@@ -19,38 +19,6 @@ using ZB.MOM.NatsNet.Server.Internal.DataStructures;
namespace ZB.MOM.NatsNet.Server;
// ============================================================================
// AccountNumConns — remote server connection/leafnode count message
// Mirrors Go `AccountNumConns` struct used in updateRemoteServer.
// ============================================================================
/// <summary>
/// Carries the number of client connections and leaf nodes that a remote server
/// has for a given account, along with the remote server's identity.
/// Mirrors Go <c>AccountNumConns</c> in server/accounts.go.
/// </summary>
internal sealed class AccountNumConns
{
/// <summary>Remote server identity. Mirrors Go <c>Server ServerInfo</c>.</summary>
public ServerIdentity Server { get; set; } = new();
/// <summary>Number of client connections on the remote server. Mirrors Go <c>Conns int</c>.</summary>
public int Conns { get; set; }
/// <summary>Number of leaf nodes on the remote server. Mirrors Go <c>LeafNodes int</c>.</summary>
public int LeafNodes { get; set; }
}
/// <summary>
/// Minimal remote server identity stub used by <see cref="AccountNumConns"/>.
/// Full implementation lives with the server cluster sessions.
/// </summary>
internal sealed class ServerIdentity
{
/// <summary>Unique server ID. Mirrors Go <c>ID string</c>.</summary>
public string ID { get; set; } = string.Empty;
}
// ============================================================================
// Account — full implementation
// Mirrors Go `Account` struct in server/accounts.go lines 52-119.
@@ -666,8 +634,8 @@ public sealed class Account : INatsAccount
{
_strack ??= new Dictionary<string, SConns>();
_strack.TryGetValue(m.Server.ID, out var prev);
_strack[m.Server.ID] = new SConns
_strack.TryGetValue(m.Server.Id, out var prev);
_strack[m.Server.Id] = new SConns
{
Conns = m.Conns,
Leafs = m.LeafNodes,