public void serialize(TreeRequest request, DataOutput dos, int version) throws IOException {
   dos.writeUTF(request.sessionid);
   CompactEndpointSerializationHelper.serialize(request.endpoint, dos);
   dos.writeUTF(request.cf.left);
   dos.writeUTF(request.cf.right);
   if (version > MessagingService.VERSION_07)
     AbstractBounds.serializer().serialize(request.range, dos, version);
 }
 public long serializedSize(GossipDigestAck ack, int version) {
   int size = GossipDigestSerializationHelper.serializedSize(ack.gDigestList, version);
   if (version <= MessagingService.VERSION_11) size += TypeSizes.NATIVE.sizeof(true);
   size += TypeSizes.NATIVE.sizeof(ack.epStateMap.size());
   for (Map.Entry<InetAddress, EndpointState> entry : ack.epStateMap.entrySet())
     size +=
         CompactEndpointSerializationHelper.serializedSize(entry.getKey())
             + EndpointState.serializer.serializedSize(entry.getValue(), version);
   return size;
 }
 public void serialize(GossipDigestAck gDigestAckMessage, DataOutput dos, int version)
     throws IOException {
   GossipDigestSerializationHelper.serialize(gDigestAckMessage.gDigestList, dos, version);
   if (version <= MessagingService.VERSION_11) dos.writeBoolean(true); // 0.6 compatibility
   dos.writeInt(gDigestAckMessage.epStateMap.size());
   for (Map.Entry<InetAddress, EndpointState> entry : gDigestAckMessage.epStateMap.entrySet()) {
     InetAddress ep = entry.getKey();
     CompactEndpointSerializationHelper.serialize(ep, dos);
     EndpointState.serializer.serialize(entry.getValue(), dos, version);
   }
 }
  public GossipDigestAck deserialize(DataInput dis, int version) throws IOException {
    List<GossipDigest> gDigestList = GossipDigestSerializationHelper.deserialize(dis, version);
    if (version <= MessagingService.VERSION_11) dis.readBoolean(); // 0.6 compatibility
    int size = dis.readInt();
    Map<InetAddress, EndpointState> epStateMap = new HashMap<InetAddress, EndpointState>(size);

    for (int i = 0; i < size; ++i) {
      InetAddress ep = CompactEndpointSerializationHelper.deserialize(dis);
      EndpointState epState = EndpointState.serializer.deserialize(dis, version);
      epStateMap.put(ep, epState);
    }
    return new GossipDigestAck(gDigestList, epStateMap);
  }
    public TreeRequest deserialize(DataInput dis, int version) throws IOException {
      String sessId = dis.readUTF();
      InetAddress endpoint = CompactEndpointSerializationHelper.deserialize(dis);
      CFPair cfpair = new CFPair(dis.readUTF(), dis.readUTF());
      Range<Token> range;
      if (version > MessagingService.VERSION_07)
        range = (Range<Token>) AbstractBounds.serializer().deserialize(dis, version);
      else
        range =
            new Range<Token>(
                StorageService.getPartitioner().getMinimumToken(),
                StorageService.getPartitioner().getMinimumToken());

      return new TreeRequest(sessId, endpoint, range, cfpair);
    }