public void UpdateServers(string serverId, string serverUrl) { ServerUrlMapping.AddServerToServerUrlMapping(serverId, serverUrl); if (pcsRole == "server") { server.UpdateServersContext(ServerUrlMapping.serverUrlMapping); } else if (pcsRole == "client") { client.UpdateServersContext(ServerUrlMapping.serverUrlMapping); } }
private void attachServer(string server_id) { if (debug_console) { Console.WriteLine("Attaching to server with id: " + server_id); } string url = ServerUrlMapping.GetServerUrl(server_id); if (debug_console) { Console.WriteLine("Server URL is: " + url); } channel = GrpcChannel.ForAddress(url); client = new DataStoreService.DataStoreServiceClient(channel); attached_server_id = server_id; }
private bool HandleCrashedServer(string crashed_server_id) { Console.WriteLine("--------------------"); Console.WriteLine(">>> CLIENT: Notify Crash... " + crashed_server_id); Console.WriteLine(">>> The server is not responding. It seems to have crashed. ServerID: " + crashed_server_id); Console.WriteLine("--------------------"); if (NotifyPartitionsAboutCrashedServerAndReattachNewMaster(crashed_server_id)) { PartitionMapping.RemoveCrashedServerFromAllPartitions(crashed_server_id); ServerUrlMapping.RemoveCrashedServer(crashed_server_id); Console.WriteLine("--------------------"); return(true); } return(false); }
private void updateConnectionToReplicas(string partition_id) { string[] replicas = PartitionMapping.GetPartitionReplicas(partition_id); foreach (string replica in replicas) { GrpcChannel channel; if (replica_channels.TryGetValue(replica, out channel)) { channel.ShutdownAsync(); } string url = ServerUrlMapping.GetServerUrl(replica); channel = GrpcChannel.ForAddress(url); replica_channels[replica] = channel; replica_clients[replica] = new ServerCommunicationService.ServerCommunicationServiceClient(channel); } }
public void UpdateServersContext(Dictionary <string, string> serverUrlMapping) { ServerUrlMapping.CreateServerUrlMapping(serverUrlMapping); }