/// <summary> /// Removes data from a peer. /// </summary> /// <param name="remotePeer">The remote peer on which to store the data.</param> /// <param name="removeBuilder">The builder to use for this operation.</param> /// <param name="channelCreator">The channel creator that will be used.</param> /// <returns>The future response message.</returns> public Task <Message> RemoveAsync(PeerAddress remotePeer, RemoveBuilder removeBuilder, ChannelCreator channelCreator) { var message = CreateRequestMessage(remotePeer, Rpc.Commands.Remove.GetNr(), removeBuilder.IsReturnResults ? Message.MessageType.Request2 : Message.MessageType.Request1); if (removeBuilder.IsSign) { message.SetPublicKeyAndSign(removeBuilder.KeyPair); } if (removeBuilder.IsRange) { var keys = new List <Number640>(2); keys.Add(removeBuilder.From); keys.Add(removeBuilder.To); message.SetIntValue(0); // marker message.SetKeyCollection(new KeyCollection(keys)); } else if (removeBuilder.Keys == null) { if (removeBuilder.LocationKey == null || removeBuilder.DomainKey == null) { throw new ArgumentException("Null not allowed in location or domain."); } message.SetKey(removeBuilder.LocationKey); message.SetKey(removeBuilder.DomainKey); if (removeBuilder.ContentKeys != null) { message.SetKeyCollection(new KeyCollection(removeBuilder.LocationKey, removeBuilder.DomainKey, removeBuilder.VersionKey, removeBuilder.ContentKeys)); } } else { message.SetKeyCollection(new KeyCollection(removeBuilder.Keys)); } var tcsResponse = new TaskCompletionSource <Message>(message); var requestHandler = new RequestHandler(tcsResponse, PeerBean, ConnectionBean, removeBuilder); if (!removeBuilder.IsForceUdp) { return(requestHandler.SendTcpAsync(channelCreator)); } return(requestHandler.SendUdpAsync(channelCreator)); }
public TcsRemove Remove(RemoveBuilder builder) { throw new NotImplementedException(); }