public override Task <Empty> ViewChange(ViewChangeRequest request, ServerCallContext context) { _bus.Publish(new ElectionMessage.ViewChange( Uuid.FromDto(request.ServerId).ToGuid(), new IPEndPoint(IPAddress.Parse(request.ServerInternalHttp.Address), (int)request.ServerInternalHttp.Port), request.AttemptedView)); return(EmptyResult); }
private async Task SendViewChangeAsync(Guid serverId, EndPoint serverHttpEndPoint, int attemptedView, DateTime deadline) { var request = new ViewChangeRequest { ServerId = Uuid.FromGuid(serverId).ToDto(), ServerHttp = new GossipEndPoint(serverHttpEndPoint.GetHost(), (uint)serverHttpEndPoint.GetPort()), AttemptedView = attemptedView }; await _electionsClient.ViewChangeAsync(request, deadline : deadline.ToUniversalTime()); }
private async Task SendViewChangeAsync(Guid serverId, IPEndPoint serverInternalHttp, int attemptedView, DateTime deadline) { var request = new ViewChangeRequest { ServerId = Uuid.FromGuid(serverId).ToDto(), ServerInternalHttp = new EndPoint(serverInternalHttp.Address.ToString(), (uint)serverInternalHttp.Port), AttemptedView = attemptedView }; await _electionsClient.ViewChangeAsync(request, deadline : deadline.ToUniversalTime()); }
public override async Task <Empty> ViewChange(ViewChangeRequest request, ServerCallContext context) { var user = context.GetHttpContext().User; if (!await _authorizationProvider.CheckAccessAsync(user, ViewChangeOperation, context.CancellationToken).ConfigureAwait(false)) { throw AccessDenied(); } _bus.Publish(new ElectionMessage.ViewChange( Uuid.FromDto(request.ServerId).ToGuid(), new IPEndPoint(IPAddress.Parse(request.ServerInternalHttp.Address), (int)request.ServerInternalHttp.Port), request.AttemptedView)); return(EmptyResult); }