Пример #1
0
        private async Task RequestVote(IPeer peer, BlockingCollection <RequestVoteResponse> requestVoteResponses)
        {
            var requestVoteResponse = peer.Request(new RequestVote(CurrentState.CurrentTerm, CurrentState.Id, _log.LastLogIndex, _log.LastLogTerm));

            requestVoteResponses.Add(requestVoteResponse);
        }
Пример #2
0
 private Task <HeartBeatResponse> HeartBeatRequest(IPeer peer, HeartBeat heartBeat)
 {
     _logger.LogInformation($"leader节点向{peer.Id}发送心跳信息,${heartBeat.Term}");
     return(peer.Request(heartBeat));
 }