コード例 #1
0
 public override Task <Empty> ViewChangeProof(ViewChangeProofRequest request, ServerCallContext context)
 {
     _bus.Publish(new ElectionMessage.ViewChangeProof(
                      Uuid.FromDto(request.ServerId).ToGuid(),
                      new IPEndPoint(IPAddress.Parse(request.ServerInternalHttp.Address), (int)request.ServerInternalHttp.Port),
                      request.InstalledView));
     return(EmptyResult);
 }
コード例 #2
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());
 }
コード例 #3
0
 private async Task SendViewChangeProofAsync(Guid serverId, IPEndPoint serverInternalHttp, int installedView,
                                             DateTime deadline)
 {
     var request = new ViewChangeProofRequest {
         ServerId           = Uuid.FromGuid(serverId).ToDto(),
         ServerInternalHttp = new EndPoint(serverInternalHttp.Address.ToString(), (uint)serverInternalHttp.Port),
         InstalledView      = installedView
     };
     await _electionsClient.ViewChangeProofAsync(request, deadline : deadline.ToUniversalTime());
 }
コード例 #4
0
        public override async Task <Empty> ViewChangeProof(ViewChangeProofRequest request, ServerCallContext context)
        {
            var user = context.GetHttpContext().User;

            if (!await _authorizationProvider.CheckAccessAsync(user, ViewChangeProofOperation, context.CancellationToken).ConfigureAwait(false))
            {
                throw AccessDenied();
            }
            _bus.Publish(new ElectionMessage.ViewChangeProof(
                             Uuid.FromDto(request.ServerId).ToGuid(),
                             new IPEndPoint(IPAddress.Parse(request.ServerInternalHttp.Address), (int)request.ServerInternalHttp.Port),
                             request.InstalledView));
            return(EmptyResult);
        }