feat: add peer management with stream reassignment (Gap 2.4)
Add ProcessAddPeer/ProcessRemovePeer to JetStreamMetaGroup for peer-driven stream reassignment. Includes AddKnownPeer/RemoveKnownPeer tracked in a HashSet, RemovePeerFromStream, RemapStreamAssignment with replacement-peer selection from the known pool, and DesiredReplicas on RaftGroup for under-replication detection. Go ref: jetstream_cluster.go:2290-2439.
This commit is contained in:
@@ -14,6 +14,18 @@ public sealed class RaftGroup
|
||||
public string Cluster { get; set; } = string.Empty;
|
||||
public string Preferred { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Optional desired replica count for this group.
|
||||
/// When set, ProcessAddPeer uses this to detect under-replication.
|
||||
/// Go reference: jetstream_cluster.go:2284 sa.missingPeers() — len(Peers) < Config.Replicas.
|
||||
/// </summary>
|
||||
public int DesiredReplicas { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// True when <see cref="DesiredReplicas"/> has been explicitly set (non-zero).
|
||||
/// </summary>
|
||||
public bool HasDesiredReplicas => DesiredReplicas > 0;
|
||||
|
||||
public int QuorumSize => (Peers.Count / 2) + 1;
|
||||
public bool HasQuorum(int ackCount) => ackCount >= QuorumSize;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user