public void SendRpcCommand(NodeDto connectingNode, DhtProtocolCommandDto protocolCommandDto) { if (connectingNode == null) { return; } Client(connectingNode, protocolCommandDto); }
public void PutResponse(NodeDto connectingNode, NodeDto destinationNode, uint key, string value) { var protocolCommandDto = new DhtProtocolCommandDto { Command = DhtCommand.PUT_RESPONSE, NodeDto = connectingNode, Key = key, Value = value, }; EnqueueRpcCall(destinationNode, protocolCommandDto); }
public void FoundSuccessor(NodeDto destinationNode, uint key, NodeDto foundSuccessor) { var protocolCommandDto = new DhtProtocolCommandDto { Command = DhtCommand.FOUND_SUCCESSOR, Key = key, NodeDto = foundSuccessor }; EnqueueRpcCall(destinationNode, protocolCommandDto); }
public void Stabilize(NodeDto connectingNode, uint key, NodeDto destinationNode) { var protocolCommandDto = new DhtProtocolCommandDto { Command = DhtCommand.STABILIZE, Key = key, NodeDto = destinationNode }; EnqueueRpcCall(connectingNode, protocolCommandDto); }
public void Notify(NodeDto connectingNode, uint key, NodeDto destinationNode) { var protocolCommandDto = new DhtProtocolCommandDto { NodeDto = destinationNode, Key = key, Command = DhtCommand.NOTIFY }; EnqueueRpcCall(connectingNode, protocolCommandDto); }
public void CheckPredecessorResponse(NodeDto destinationNode, uint key, NodeDto myPredecessor) { var protocolCommandDto = new DhtProtocolCommandDto { Command = DhtCommand.CHECK_PREDECESSOR_RESPONSE, Key = key, NodeDto = myPredecessor }; EnqueueRpcCall(destinationNode, protocolCommandDto); }
public void FindSuccessor(NodeDto connectingNode, uint key, NodeDto destinationNode) { var protocolCommandDto = new DhtProtocolCommandDto { Command = DhtCommand.FIND_SUCCESSOR, Key = key, NodeDto = destinationNode }; Log.Debug(protocolCommandDto.ToString()); EnqueueRpcCall(connectingNode, protocolCommandDto); }
public void Put(NodeDto connectingNode, NodeDto destinationNode, uint key, string value, int currentNumberOfReplicas, uint keyToAdd) { var protocolCommandDto = new DhtProtocolCommandDto { Command = DhtCommand.PUT, NodeDto = destinationNode, Key = key, Value = value, KeyToAdd = keyToAdd, CurrentNumberOfReplicas = currentNumberOfReplicas, }; EnqueueRpcCall(connectingNode, protocolCommandDto); }
public void Client(NodeDto connectingNode, DhtProtocolCommandDto protocolCommandDto) { var cleanAddress = connectingNode.IpAddress.Replace("127.0.0.1", "localhost"); var address = $"tcp://{cleanAddress}:{connectingNode.Port}"; // client = _clients.FirstOrDefault(socket => socket.Options.LastEndpoint.Equals(address)); // if (client == null) // { // client = new RequestSocket(); // _clients.Add(client); // } try { client.Connect(address); client.TrySendFrame(protocolCommandDto.ToString()); client?.Disconnect(address); // client.TryReceiveSignal(out bool signal); } catch (NetMQException e) { Log.Logger.Error(e, e.Message); Log.Debug(e.ErrorCode.ToString()); Log.Debug(e.StackTrace); Log.Debug(e.Message); Console.WriteLine(e.ErrorCode); Console.WriteLine(e.Message); Console.WriteLine(e.InnerException); Console.WriteLine(address); } catch (Exception exception) { Log.Logger.Error(exception, exception.Message); Log.Debug(exception.Message); } finally { // _clients.Remove(client); // client?.Disconnect(address); // client?.Dispose(); } }
public void ForwardRequest(NodeDto connectingNode, DhtProtocolCommandDto request) { EnqueueRpcCall(connectingNode, request); }