public static ReplicaMetadataResponse readFrom(DataInputStream stream, FindTokenHelper helper, ClusterMap clusterMap)
      throws IOException {
    RequestOrResponseType type = RequestOrResponseType.values()[stream.readShort()];
    if (type != RequestOrResponseType.ReplicaMetadataResponse) {
      throw new IllegalArgumentException("The type of request response is not compatible");
    }
    Short versionId = stream.readShort();
    int correlationId = stream.readInt();
    String clientId = Utils.readIntString(stream);
    ServerErrorCode error = ServerErrorCode.values()[stream.readShort()];
    int replicaMetadataResponseInfoListCount = stream.readInt();
    ArrayList<ReplicaMetadataResponseInfo> replicaMetadataResponseInfoList =
        new ArrayList<ReplicaMetadataResponseInfo>(replicaMetadataResponseInfoListCount);
    for (int i = 0; i < replicaMetadataResponseInfoListCount; i++) {
      ReplicaMetadataResponseInfo replicaMetadataResponseInfo =
          ReplicaMetadataResponseInfo.readFrom(stream, helper, clusterMap, versionId);
      replicaMetadataResponseInfoList.add(replicaMetadataResponseInfo);
    }
    if (error != ServerErrorCode.NoError) {
      return new ReplicaMetadataResponse(correlationId, clientId, error, versionId);
    } else {
      return new ReplicaMetadataResponse(correlationId, clientId, error, replicaMetadataResponseInfoList, versionId);
    }
  }
The response for a ReplicaMetadataRequest. This returns the new entries found
and the new token that could be used for future searches
ambry-protocol/src/main/java/com/github/ambry/protocol/ReplicaMetadataResponse.java