feat: add stream replica groups and leader stepdown

This commit is contained in:
Joseph Doherty
2026-02-23 06:17:30 -05:00
parent 23216d0a48
commit c87661800d
4 changed files with 158 additions and 0 deletions

View File

@@ -9,6 +9,7 @@ public sealed class RaftNode
public string Id { get; }
public int Term => TermState.CurrentTerm;
public bool IsLeader => Role == RaftRole.Leader;
public RaftRole Role { get; private set; } = RaftRole.Follower;
public RaftTermState TermState { get; } = new();
public long AppliedIndex { get; set; }
@@ -99,6 +100,8 @@ public sealed class RaftNode
public void RequestStepDown()
{
Role = RaftRole.Follower;
_votesReceived = 0;
TermState.VotedFor = null;
}
private void TryBecomeLeader(int clusterSize)