private async Task SendLeaderIsResigningAsync(Guid leaderId, IPEndPoint leaderInternalHttp, DateTime deadline)
 {
     var request = new LeaderIsResigningRequest {
         LeaderId           = Uuid.FromGuid(leaderId).ToDto(),
         LeaderInternalHttp = new EndPoint(leaderInternalHttp.Address.ToString(), (uint)leaderInternalHttp.Port),
     };
     await _electionsClient.LeaderIsResigningAsync(request, deadline : deadline.ToUniversalTime());
 }
 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());
 }
示例#3
0
 public override Task <Empty> LeaderIsResigning(LeaderIsResigningRequest request, ServerCallContext context)
 {
     _bus.Publish(new ElectionMessage.LeaderIsResigning(
                      Uuid.FromDto(request.LeaderId).ToGuid(),
                      new IPEndPoint(IPAddress.Parse(request.LeaderInternalHttp.Address),
                                     (int)request.LeaderInternalHttp.Port)));
     return(EmptyResult);
 }
        public override async Task <Empty> LeaderIsResigning(LeaderIsResigningRequest request, ServerCallContext context)
        {
            var user = context.GetHttpContext().User;

            if (!await _authorizationProvider.CheckAccessAsync(user, MasterIsResigningOperation, context.CancellationToken).ConfigureAwait(false))
            {
                throw AccessDenied();
            }
            _bus.Publish(new ElectionMessage.LeaderIsResigning(
                             Uuid.FromDto(request.LeaderId).ToGuid(),
                             new IPEndPoint(IPAddress.Parse(request.LeaderInternalHttp.Address),
                                            (int)request.LeaderInternalHttp.Port)));
            return(EmptyResult);
        }