public override async Task <ClusterInfo> Update(GossipRequest request, ServerCallContext context) { var clusterInfo = EventStore.Core.Cluster.ClusterInfo.FromGrpcClusterInfo(request.Info); var tcs = new TaskCompletionSource <ClusterInfo>(); _bus.Publish(new GossipMessage.GossipReceived(new CallbackEnvelope(msg => GossipResponse(msg, tcs)), clusterInfo, new IPEndPoint(IPAddress.Parse(request.Server.Address), (int)request.Server.Port))); return(await tcs.Task.ConfigureAwait(false)); }
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)); }
public override async Task <ClusterInfo> Update(GossipRequest request, ServerCallContext context) { var user = context.GetHttpContext().User; if (!await _authorizationProvider.CheckAccessAsync(user, UpdateOperation, context.CancellationToken).ConfigureAwait(false)) { throw AccessDenied(); } var clusterInfo = EventStore.Core.Cluster.ClusterInfo.FromGrpcClusterInfo(request.Info); var tcs = new TaskCompletionSource <ClusterInfo>(); _bus.Publish(new GossipMessage.GossipReceived(new CallbackEnvelope(msg => GossipResponse(msg, tcs)), clusterInfo, new DnsEndPoint(request.Server.Address, (int)request.Server.Port))); return(await tcs.Task.ConfigureAwait(false)); }