|
69 | 69 | import org.opensearch.index.IndexModule;
|
70 | 70 | import org.opensearch.index.mapper.MapperService;
|
71 | 71 | import org.opensearch.index.seqno.SequenceNumbers;
|
| 72 | +import org.opensearch.index.translog.BufferedChecksumStreamOutput; |
72 | 73 | import org.opensearch.indices.replication.SegmentReplicationSource;
|
73 | 74 | import org.opensearch.indices.replication.common.ReplicationType;
|
74 | 75 |
|
|
88 | 89 | import java.util.Map;
|
89 | 90 | import java.util.Objects;
|
90 | 91 | import java.util.Set;
|
| 92 | +import java.util.TreeSet; |
91 | 93 | import java.util.function.Function;
|
92 | 94 |
|
93 | 95 | import static org.opensearch.cluster.metadata.Metadata.CONTEXT_MODE_PARAM;
|
@@ -1287,6 +1289,31 @@ public void writeTo(StreamOutput out) throws IOException {
|
1287 | 1289 | }
|
1288 | 1290 | }
|
1289 | 1291 |
|
| 1292 | + public void writeVerifiableTo(BufferedChecksumStreamOutput out) throws IOException { |
| 1293 | + out.writeString(index.getName()); // uuid will come as part of settings |
| 1294 | + out.writeLong(version); |
| 1295 | + out.writeVLong(mappingVersion); |
| 1296 | + out.writeVLong(settingsVersion); |
| 1297 | + out.writeVLong(aliasesVersion); |
| 1298 | + out.writeInt(routingNumShards); |
| 1299 | + out.writeByte(state.id()); |
| 1300 | + writeSettingsToStream(settings, out); |
| 1301 | + out.writeVLongArray(primaryTerms); |
| 1302 | + out.writeMapValues(mappings, (stream, val) -> val.writeTo(stream)); |
| 1303 | + out.writeMapValues(aliases, (stream, val) -> val.writeTo(stream)); |
| 1304 | + out.writeMap(customData, StreamOutput::writeString, (stream, val) -> val.writeTo(stream)); |
| 1305 | + out.writeMap( |
| 1306 | + inSyncAllocationIds, |
| 1307 | + StreamOutput::writeVInt, |
| 1308 | + (stream, val) -> DiffableUtils.StringSetValueSerializer.getInstance().write(new TreeSet<>(val), stream) |
| 1309 | + ); |
| 1310 | + out.writeMapValues(rolloverInfos, (stream, val) -> val.writeTo(stream)); |
| 1311 | + out.writeBoolean(isSystem); |
| 1312 | + if (out.getVersion().onOrAfter(Version.V_2_17_0)) { |
| 1313 | + out.writeOptionalWriteable(context); |
| 1314 | + } |
| 1315 | + } |
| 1316 | + |
1290 | 1317 | public boolean isSystem() {
|
1291 | 1318 | return isSystem;
|
1292 | 1319 | }
|
|
0 commit comments