示例#1
0
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   out.writeString(index.getName()); // uuid will come as part of settings
   out.writeLong(version);
   out.writeByte(state.id());
   writeSettingsToStream(settings, out);
   out.writeVInt(mappings.size());
   for (ObjectCursor<MappingMetaData> cursor : mappings.values()) {
     cursor.value.writeTo(out);
   }
   out.writeVInt(aliases.size());
   for (ObjectCursor<AliasMetaData> cursor : aliases.values()) {
     cursor.value.writeTo(out);
   }
   out.writeVInt(customs.size());
   for (ObjectObjectCursor<String, Custom> cursor : customs) {
     out.writeString(cursor.key);
     cursor.value.writeTo(out);
   }
   out.writeVInt(activeAllocationIds.size());
   for (IntObjectCursor<Set<String>> cursor : activeAllocationIds) {
     out.writeVInt(cursor.key);
     DiffableUtils.StringSetValueSerializer.getInstance().write(cursor.value, out);
   }
 }
示例#2
0
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   out.writeLong(version);
   out.writeString(clusterUUID);
   writeSettingsToStream(transientSettings, out);
   writeSettingsToStream(persistentSettings, out);
   out.writeVInt(indices.size());
   for (IndexMetaData indexMetaData : this) {
     indexMetaData.writeTo(out);
   }
   out.writeVInt(templates.size());
   for (ObjectCursor<IndexTemplateMetaData> cursor : templates.values()) {
     cursor.value.writeTo(out);
   }
   out.writeVInt(customs.size());
   for (ObjectObjectCursor<String, Custom> cursor : customs) {
     out.writeString(cursor.key);
     cursor.value.writeTo(out);
   }
 }
示例#3
0
  @SuppressWarnings("unchecked")
  MetaData(
      String clusterUUID,
      long version,
      Settings transientSettings,
      Settings persistentSettings,
      ImmutableOpenMap<String, IndexMetaData> indices,
      ImmutableOpenMap<String, IndexTemplateMetaData> templates,
      ImmutableOpenMap<String, Custom> customs,
      String[] allIndices,
      String[] allOpenIndices,
      String[] allClosedIndices,
      SortedMap<String, AliasOrIndex> aliasAndIndexLookup) {
    this.clusterUUID = clusterUUID;
    this.version = version;
    this.transientSettings = transientSettings;
    this.persistentSettings = persistentSettings;
    this.settings =
        Settings.settingsBuilder().put(persistentSettings).put(transientSettings).build();
    this.indices = indices;
    this.customs = customs;
    this.templates = templates;
    int totalNumberOfShards = 0;
    int numberOfShards = 0;
    for (ObjectCursor<IndexMetaData> cursor : indices.values()) {
      totalNumberOfShards += cursor.value.getTotalNumberOfShards();
      numberOfShards += cursor.value.getNumberOfShards();
    }
    this.totalNumberOfShards = totalNumberOfShards;
    this.numberOfShards = numberOfShards;

    this.allIndices = allIndices;
    this.allOpenIndices = allOpenIndices;
    this.allClosedIndices = allClosedIndices;
    this.aliasAndIndexLookup = aliasAndIndexLookup;
  }