public override async Task <ChangeReply> ChangeMasterNotification(ChangeNotificationRequest request, ServerCallContext context) { WaitUnfreeze(); await _gigaStorage.ChangeMasterNotificationAsync(request.ServerId, request.NewServerId, request.PartitionId); return(await Task.FromResult(new ChangeReply { // Empty message as ack })); }
// Notifies server_id that down_server_id is down and that the new master of the partions of down_server_id is new_server public void ChangeMasterNotificationRequest(string server, string down_server, string new_server, string partition) { Console.WriteLine("Notifying server: " + server + " about down server " + down_server + " with new " + new_server + " for partition " + partition); ChangeNotificationRequest changeNotificationRequest = new ChangeNotificationRequest { ServerId = down_server, NewServerId = new_server, PartitionId = partition }; string s = server; new Thread(() => ThreadNotification(s, changeNotificationRequest)).Start(); }
public override Task <ChangeNotificationResponse> Notify(ChangeNotificationRequest request, ServerCallContext context) { _logger.LogInformation(request.Value); _timestamps.Add(request.Value); _hub.Clients.All.SendAsync("onChanged", new Notification { Body = request.Value }); _logger.LogInformation($"Pushed onChanged ({request.Value}) via SignalR"); return(Task.FromResult(new ChangeNotificationResponse())); }
public void ThreadNotification(string server, ChangeNotificationRequest request) { try { _clients[server].ChangeMasterNotificationAsync(request); } catch { // If fails then the server is down DeadServerReport(ServerId); } }