public ClusterBlocks build() { // We copy the block sets here in case of the builder is modified after build is called ImmutableOpenMap.Builder<String, Set<ClusterBlock>> indicesBuilder = ImmutableOpenMap.builder(indices.size()); for (Map.Entry<String, Set<ClusterBlock>> entry : indices.entrySet()) { indicesBuilder.put(entry.getKey(), unmodifiableSet(new HashSet<>(entry.getValue()))); } return new ClusterBlocks(unmodifiableSet(new HashSet<>(global)), indicesBuilder.build()); } }
public Builder add(IndexRoutingTable indexRoutingTable) { if (indicesRouting == null) { throw new IllegalStateException("once build is called the builder cannot be reused"); } indicesRouting.put(indexRoutingTable.getIndex().getName(), indexRoutingTable); return this; }
public ClusterBlocks(StreamInput in) throws IOException { Set<ClusterBlock> global = readBlockSet(in); int size = in.readVInt(); ImmutableOpenMap.Builder<String, Set<ClusterBlock>> indicesBuilder = ImmutableOpenMap.builder(size); for (int j = 0; j < size; j++) { indicesBuilder.put(in.readString().intern(), readBlockSet(in)); } this.global = global; this.indicesBlocks = indicesBuilder.build(); levelHolders = generateLevelHolders(global, indicesBlocks); }
public Builder putAlias(AliasMetaData.Builder aliasMetaData) { aliases.put(aliasMetaData.alias(), aliasMetaData.build()); return this; }
public Builder putMapping(String mappingType, CompressedXContent mappingSource) throws IOException { mappings.put(mappingType, mappingSource); return this; }
public Builder putCustom(String type, Custom custom) { customs.put(type, custom); return this; }
public Builder putCustom(String type, Custom custom) { customs.put(type, custom); return this; }
public Builder putAlias(AliasMetaData aliasMetaData) { aliases.put(aliasMetaData.alias(), aliasMetaData); return this; }
public Builder add(Entry entry) { entries.put(entry.uuid, entry); return this; }
public Builder putRolloverInfo(RolloverInfo rolloverInfo) { rolloverInfos.put(rolloverInfo.getAlias(), rolloverInfo); return this; }
public Builder putMapping(MappingMetaData mappingMd) { mappings.put(mappingMd.type(), mappingMd); return this; }
public Builder(RoutingTable routingTable) { version = routingTable.version; for (IndexRoutingTable indexRoutingTable : routingTable) { indicesRouting.put(indexRoutingTable.getIndex().getName(), indexRoutingTable); } }
public Builder putAlias(AliasMetaData aliasMetaData) { aliases.put(aliasMetaData.alias(), aliasMetaData); return this; }
public Builder add(Mapper.Builder builder) { mapperBuilders.put(builder.name(), builder); return this; }
public Builder putCustom(String type, Map<String, String> customIndexMetaData) { this.customMetaData.put(type, new DiffableStringMap(customIndexMetaData)); return this; }
private MultiFields(ImmutableOpenMap<String, FieldMapper> mappers) { ImmutableOpenMap.Builder<String, FieldMapper> builder = new ImmutableOpenMap.Builder<>(); // we disable the all in multi-field mappers for (ObjectObjectCursor<String, FieldMapper> cursor : mappers) { builder.put(cursor.key, cursor.value); } this.mappers = builder.build(); }
static void buildShardLevelInfo(Logger logger, ShardStats[] stats, ImmutableOpenMap.Builder<String, Long> newShardSizes, ImmutableOpenMap.Builder<ShardRouting, String> newShardRoutingToDataPath, ClusterState state) { for (ShardStats s : stats) { newShardRoutingToDataPath.put(s.getShardRouting(), s.getDataPath()); long size = s.getStats().getStore().sizeInBytes(); String sid = ClusterInfo.shardIdentifierFromRouting(s.getShardRouting()); if (logger.isTraceEnabled()) { logger.trace("shard: {} size: {}", sid, size); } newShardSizes.put(sid, size); } }
public Builder put(IndexMetaData.Builder indexMetaDataBuilder) { // we know its a new one, increment the version and store indexMetaDataBuilder.version(indexMetaDataBuilder.version() + 1); IndexMetaData indexMetaData = indexMetaDataBuilder.build(); indices.put(indexMetaData.getIndex().getName(), indexMetaData); return this; }
private static ImmutableOpenMap<String, MappingMetaData> filterFields(ImmutableOpenMap<String, MappingMetaData> mappings, Predicate<String> fieldPredicate) throws IOException { if (fieldPredicate == MapperPlugin.NOOP_FIELD_PREDICATE) { return mappings; } ImmutableOpenMap.Builder<String, MappingMetaData> builder = ImmutableOpenMap.builder(mappings.size()); for (ObjectObjectCursor<String, MappingMetaData> cursor : mappings) { builder.put(cursor.key, filterFields(cursor.value, fieldPredicate)); } return builder.build(); // No types specified means return them all }
public Builder put(IndexMetaData indexMetaData, boolean incrementVersion) { if (indices.get(indexMetaData.getIndex().getName()) == indexMetaData) { return this; } // if we put a new index metadata, increment its version if (incrementVersion) { indexMetaData = IndexMetaData.builder(indexMetaData).version(indexMetaData.getVersion() + 1).build(); } indices.put(indexMetaData.getIndex().getName(), indexMetaData); return this; }