@Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   tookInMillis = in.readLong();
   ingestId = in.readLong();
   shardId = ShardId.readShardId(in);
   successCount = in.readVInt();
   quorumShards = in.readVInt();
   actionRequests = newLinkedList();
   int size = in.readVInt();
   for (int i = 0; i < size; i++) {
     boolean exists = in.readBoolean();
     if (exists) {
       boolean b = in.readBoolean();
       if (b) {
         IndexRequest indexRequest = new IndexRequest();
         indexRequest.readFrom(in);
         actionRequests.add(indexRequest);
       } else {
         DeleteRequest deleteRequest = new DeleteRequest();
         deleteRequest.readFrom(in);
         actionRequests.add(deleteRequest);
       }
     } else {
       actionRequests.add(null);
     }
   }
   failures = newLinkedList();
   size = in.readVInt();
   for (int i = 0; i < size; i++) {
     failures.add(IngestActionFailure.from(in));
   }
 }
  @Override
  public void readFrom(StreamInput in) throws IOException {
    shardId = ShardId.readShardId(in);
    int size = in.readVInt();
    phase1FileNames = new ArrayList<String>(size);
    for (int i = 0; i < size; i++) {
      phase1FileNames.add(in.readUTF());
    }

    size = in.readVInt();
    phase1FileSizes = new ArrayList<Long>(size);
    for (int i = 0; i < size; i++) {
      phase1FileSizes.add(in.readVLong());
    }

    size = in.readVInt();
    phase1ExistingFileNames = new ArrayList<String>(size);
    for (int i = 0; i < size; i++) {
      phase1ExistingFileNames.add(in.readUTF());
    }

    size = in.readVInt();
    phase1ExistingFileSizes = new ArrayList<Long>(size);
    for (int i = 0; i < size; i++) {
      phase1ExistingFileSizes.add(in.readVLong());
    }

    phase1TotalSize = in.readVLong();
    phase1ExistingTotalSize = in.readVLong();
  }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   shardId = ShardId.readShardId(in);
   int shardSize = in.readVInt();
   shards = new ShardStats[shardSize];
   for (int i = 0; i < shardSize; i++) {
     shards[i] = ShardStats.readShardStats(in);
   }
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   request = newRequest();
   request.readFrom(in);
   if (in.getVersion().onOrAfter(Version.V_1_4_0)) {
     shardId = ShardId.readShardId(in);
   } else {
     // older nodes will send the concrete index as part of the request
     shardId = new ShardId(request.index(), in.readVInt());
   }
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   if (in.readBoolean()) {
     shardId = ShardId.readShardId(in);
   } else {
     shardId = null;
   }
   consistencyLevel = WriteConsistencyLevel.fromId(in.readByte());
   timeout = TimeValue.readTimeValue(in);
   index = in.readString();
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   recoveryId = in.readLong();
   shardId = ShardId.readShardId(in);
   if (in.getVersion().onOrAfter(Version.V_1_5_0)) {
     snapshotFiles = Store.MetadataSnapshot.read(in);
   } else {
     int size = in.readVInt();
     legacySnapshotFiles = Sets.newHashSetWithExpectedSize(size);
     for (int i = 0; i < size; i++) {
       legacySnapshotFiles.add(in.readString());
     }
   }
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   recoveryId = in.readLong();
   shardId = ShardId.readShardId(in);
   String name = in.readString();
   position = in.readVLong();
   long length = in.readVLong();
   String checksum = in.readOptionalString();
   content = in.readBytesReference();
   Version writtenBy = null;
   if (in.getVersion().onOrAfter(org.elasticsearch.Version.V_1_3_0)) {
     String versionString = in.readOptionalString();
     writtenBy = versionString == null ? null : Version.parseLeniently(versionString);
   }
   metaData = new StoreFileMetaData(name, length, checksum, writtenBy);
 }
  public ClusterAllocationExplanation(StreamInput in) throws IOException {
    this.shard = ShardId.readShardId(in);
    this.primary = in.readBoolean();
    this.hasPendingAsyncFetch = in.readBoolean();
    this.assignedNodeId = in.readOptionalString();
    this.unassignedInfo = in.readOptionalWriteable(UnassignedInfo::new);
    this.allocationDelayMillis = in.readVLong();
    this.remainingDelayMillis = in.readVLong();

    int mapSize = in.readVInt();
    Map<DiscoveryNode, NodeExplanation> nodeToExplanation = new HashMap<>(mapSize);
    for (int i = 0; i < mapSize; i++) {
      NodeExplanation nodeExplanation = new NodeExplanation(in);
      nodeToExplanation.put(nodeExplanation.getNode(), nodeExplanation);
    }
    this.nodeExplanations = nodeToExplanation;
  }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   int numberOfSnapshots = in.readVInt();
   Map<SnapshotId, Map<ShardId, SnapshotIndexShardStatus>> snapshotMapBuilder =
       new HashMap<>(numberOfSnapshots);
   for (int i = 0; i < numberOfSnapshots; i++) {
     SnapshotId snapshotId = SnapshotId.readSnapshotId(in);
     int numberOfShards = in.readVInt();
     Map<ShardId, SnapshotIndexShardStatus> shardMapBuilder = new HashMap<>(numberOfShards);
     for (int j = 0; j < numberOfShards; j++) {
       ShardId shardId = ShardId.readShardId(in);
       SnapshotIndexShardStatus status = SnapshotIndexShardStatus.readShardSnapshotStatus(in);
       shardMapBuilder.put(shardId, status);
     }
     snapshotMapBuilder.put(snapshotId, unmodifiableMap(shardMapBuilder));
   }
   status = unmodifiableMap(snapshotMapBuilder);
 }
 @Override
 public CancelAllocationCommand readFrom(StreamInput in) throws IOException {
   return new CancelAllocationCommand(
       ShardId.readShardId(in), in.readString(), in.readBoolean());
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   recoveryId = in.readLong();
   shardId = ShardId.readShardId(in);
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   super.readFrom(in);
   shardId = ShardId.readShardId(in);
   unallocated = in.readBoolean();
 }
 @Override
 public void readFrom(StreamInput in) throws IOException {
   allocated = in.readBoolean();
   shardId = ShardId.readShardId(in);
   this.metadataSnapshot = new Store.MetadataSnapshot(in);
 }