feat: implement strict raft consensus and convergence parity

This commit is contained in:
Joseph Doherty
2026-02-23 14:53:18 -05:00
parent 56177a7099
commit 0413ff6ae9
5 changed files with 116 additions and 3 deletions

View File

@@ -38,7 +38,7 @@ public sealed class InMemoryRaftTransport : IRaftTransport
public Task<VoteResponse> RequestVoteAsync(string candidateId, string voterId, VoteRequest request, CancellationToken ct)
{
if (_nodes.TryGetValue(voterId, out var node))
return Task.FromResult(node.GrantVote(request.Term));
return Task.FromResult(node.GrantVote(request.Term, string.IsNullOrWhiteSpace(request.CandidateId) ? candidateId : request.CandidateId));
return Task.FromResult(new VoteResponse { Granted = false });
}