@Override
 public void writeTo(StreamOutput out) throws IOException {
   super.writeTo(out);
   out.writeVInt(shards.length);
   for (ShardSegments shard : shards) {
     shard.writeTo(out);
   }
 }
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   super.writeTo(out);
   out.writeInt(simple.size());
   for (String t : simple) {
     out.writeString(t);
   }
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   shards = new ShardSegments[in.readVInt()];
   for (int i = 0; i < shards.length; i++) {
     shards[i] = ShardSegments.readShardSegments(in);
   }
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   int n = in.readInt();
   simple = new HashSet<String>();
   for (int i = 0; i < n; i++) {
     simple.add(in.readString());
   }
 }
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   super.writeTo(out);
   out.writeVLong(tookInMillis);
   out.writeVLong(count);
   out.writeVInt(matches.length);
   for (Match match : matches) {
     match.writeTo(out);
   }
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   tookInMillis = in.readVLong();
   count = in.readVLong();
   int size = in.readVInt();
   matches = new Match[size];
   for (int i = 0; i < size; i++) {
     matches[i] = new Match();
     matches[i].readFrom(in);
   }
 }
Ejemplo n.º 7
0
 public static void buildBroadcastShardsHeader(
     JsonBuilder builder, BroadcastOperationResponse response) throws IOException {
   builder.startObject("_shards");
   builder.field("total", response.totalShards());
   builder.field("successful", response.successfulShards());
   builder.field("failed", response.failedShards());
   if (!response.shardFailures().isEmpty()) {
     builder.startArray("failures");
     for (ShardOperationFailedException shardFailure : response.shardFailures()) {
       builder.startObject();
       if (shardFailure.index() != null) {
         builder.field("index", shardFailure.index());
       }
       if (shardFailure.shardId() != -1) {
         builder.field("shard", shardFailure.shardId());
       }
       builder.field("reason", shardFailure.reason());
       builder.endObject();
     }
     builder.endArray();
   }
   builder.endObject();
 }
Ejemplo n.º 8
0
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   super.writeTo(out);
   out.writeVLong(count);
 }
Ejemplo n.º 9
0
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   count = in.readVLong();
 }