コード例 #1
0
 private async Task SendLeaderIsResigningAsync(Guid leaderId, EndPoint leaderHttp, DateTime deadline)
 {
     var request = new LeaderIsResigningRequest {
         LeaderId   = Uuid.FromGuid(leaderId).ToDto(),
         LeaderHttp = new GossipEndPoint(leaderHttp.GetHost(), (uint)leaderHttp.GetPort()),
     };
     await _electionsClient.LeaderIsResigningAsync(request, deadline : deadline.ToUniversalTime());
 }
コード例 #2
0
 private async Task SendPrepareAsync(Guid serverId, EndPoint serverHttpEndPoint, int view, DateTime deadline)
 {
     var request = new PrepareRequest {
         ServerId   = Uuid.FromGuid(serverId).ToDto(),
         ServerHttp = new GossipEndPoint(serverHttpEndPoint.GetHost(), (uint)serverHttpEndPoint.GetPort()),
         View       = view
     };
     await _electionsClient.PrepareAsync(request, deadline : deadline.ToUniversalTime());
 }
コード例 #3
0
 private async Task SendViewChangeProofAsync(Guid serverId, EndPoint serverHttpEndPoint, int installedView,
                                             DateTime deadline)
 {
     var request = new ViewChangeProofRequest {
         ServerId      = Uuid.FromGuid(serverId).ToDto(),
         ServerHttp    = new GossipEndPoint(serverHttpEndPoint.GetHost(), (uint)serverHttpEndPoint.GetPort()),
         InstalledView = installedView
     };
     await _electionsClient.ViewChangeProofAsync(request, deadline : deadline.ToUniversalTime());
 }
コード例 #4
0
        private async Task <ClusterInfo> SendGossipAsync(ClusterInfo clusterInfo,
                                                         EndPoint server, DateTime deadline)
        {
            var request = new GossipRequest {
                Info   = ClusterInfo.ToGrpcClusterInfo(clusterInfo),
                Server = new GossipEndPoint(server.GetHost(), (uint)server.GetPort())
            };
            var clusterInfoDto = await _gossipClient.UpdateAsync(request, deadline : deadline.ToUniversalTime());

            return(ClusterInfo.FromGrpcClusterInfo(clusterInfoDto));
        }
コード例 #5
0
        private async Task SendAcceptAsync(Guid serverId, EndPoint serverHttpEndPoint, Guid leaderId,
                                           EndPoint leaderHttp, int view, DateTime deadline)
        {
            var request = new AcceptRequest {
                ServerId   = Uuid.FromGuid(serverId).ToDto(),
                ServerHttp = new GossipEndPoint(serverHttpEndPoint.GetHost(), (uint)serverHttpEndPoint.GetPort()),
                LeaderId   = Uuid.FromGuid(leaderId).ToDto(),
                LeaderHttp = new GossipEndPoint(leaderHttp.GetHost(), (uint)leaderHttp.GetPort()),
                View       = view
            };
            await _electionsClient.AcceptAsync(request);

            _electionsClient.Accept(request, deadline: deadline.ToUniversalTime());
        }
コード例 #6
0
 private async Task SendPrepareOkAsync(int view, Guid serverId, EndPoint serverHttpEndPoint, int epochNumber,
                                       long epochPosition, Guid epochId, long lastCommitPosition, long writerCheckpoint, long chaserCheckpoint,
                                       int nodePriority, DateTime deadline)
 {
     var request = new PrepareOkRequest {
         View               = view,
         ServerId           = Uuid.FromGuid(serverId).ToDto(),
         ServerHttp         = new GossipEndPoint(serverHttpEndPoint.GetHost(), (uint)serverHttpEndPoint.GetPort()),
         EpochNumber        = epochNumber,
         EpochPosition      = epochPosition,
         EpochId            = Uuid.FromGuid(epochId).ToDto(),
         LastCommitPosition = lastCommitPosition,
         WriterCheckpoint   = writerCheckpoint,
         ChaserCheckpoint   = chaserCheckpoint,
         NodePriority       = nodePriority
     };
     await _electionsClient.PrepareOkAsync(request, deadline : deadline.ToUniversalTime());
 }