@Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); if (in.readBoolean()) { storeFilesMetaData = StoreFilesMetaData.readStoreFilesMetaData(in); } }
@Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); if (storeFilesMetaData == null) { out.writeBoolean(false); } else { out.writeBoolean(true); storeFilesMetaData.writeTo(out); } }
@Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); if (status != null) { out.writeVInt(status.size()); for (Map.Entry<SnapshotId, Map<ShardId, SnapshotIndexShardStatus>> entry : status.entrySet()) { entry.getKey().writeTo(out); out.writeVInt(entry.getValue().size()); for (Map.Entry<ShardId, SnapshotIndexShardStatus> shardEntry : entry.getValue().entrySet()) { shardEntry.getKey().writeTo(out); shardEntry.getValue().writeTo(out); } } } else { out.writeVInt(0); } }
@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); }