public Builder indicesRouting(Map<String, IndexRoutingTable> indicesRouting) { if (indicesRouting == null) { throw new IllegalStateException("once build is called the builder cannot be reused"); } this.indicesRouting.putAll(indicesRouting); return this; }
@Override public ImmutableOpenMap<K, T> apply(ImmutableOpenMap<K, T> map) { ImmutableOpenMap.Builder<K, T> builder = ImmutableOpenMap.builder(); builder.putAll(map); for (K part : deletes) { builder.remove(part); } for (Map.Entry<K, Diff<T>> diff : diffs.entrySet()) { builder.put(diff.getKey(), diff.getValue().apply(builder.get(diff.getKey()))); } for (Map.Entry<K, T> upsert : upserts.entrySet()) { builder.put(upsert.getKey(), upsert.getValue()); } return builder.build(); } }
logger.trace("[{}] Updating shard [{}] with status [{}]", updateSnapshotState.snapshot(), updateSnapshotState.shardId(), updateSnapshotState.status().state()); if (updated == false) { shards.putAll(entry.shards()); updated = true;
public Builder customs(ImmutableOpenMap<String, Custom> customs) { this.customs.putAll(customs); return this; }
public Builder indices(ImmutableOpenMap<String, IndexMetaData> indices) { this.indices.putAll(indices); return this; }
/** * @return An immutable copy of the given map */ public static <KType, VType> ImmutableOpenMap<KType, VType> copyOf(ObjectObjectMap<KType, VType> map) { Builder<KType, VType> builder = builder(); builder.putAll(map); return builder.build(); }
public Builder indicesRouting(Map<String, IndexRoutingTable> indicesRouting) { if (indicesRouting == null) { throw new IllegalStateException("once build is called the builder cannot be reused"); } this.indicesRouting.putAll(indicesRouting); return this; }
/** * @return An immutable copy of the given map */ public static <KType, VType> ImmutableOpenMap<KType, VType> copyOf(ObjectObjectMap<KType, VType> map) { Builder<KType, VType> builder = builder(); builder.putAll(map); return builder.build(); }
/** * @return An immutable copy of the given map */ public static <KType, VType> ImmutableOpenMap<KType, VType> copyOf(ObjectObjectMap<KType, VType> map) { Builder<KType, VType> builder = builder(); builder.putAll(map); return builder.build(); }
public Builder indicesRouting(Map<String, IndexRoutingTable> indicesRouting) { if (indicesRouting == null) { throw new IllegalStateException("once build is called the builder cannot be reused"); } this.indicesRouting.putAll(indicesRouting); return this; }
public static GetSettingsResponse fromXContent(XContentParser parser) throws IOException { HashMap<String, Settings> indexToSettings = new HashMap<>(); HashMap<String, Settings> indexToDefaultSettings = new HashMap<>(); if (parser.currentToken() == null) { parser.nextToken(); } XContentParserUtils.ensureExpectedToken(XContentParser.Token.START_OBJECT, parser.currentToken(), parser::getTokenLocation); parser.nextToken(); while (!parser.isClosed()) { if (parser.currentToken() == XContentParser.Token.START_OBJECT) { //we must assume this is an index entry parseIndexEntry(parser, indexToSettings, indexToDefaultSettings); } else if (parser.currentToken() == XContentParser.Token.START_ARRAY) { parser.skipChildren(); } else { parser.nextToken(); } } ImmutableOpenMap<String, Settings> settingsMap = ImmutableOpenMap.<String, Settings>builder().putAll(indexToSettings).build(); ImmutableOpenMap<String, Settings> defaultSettingsMap = ImmutableOpenMap.<String, Settings>builder().putAll(indexToDefaultSettings).build(); return new GetSettingsResponse(settingsMap, defaultSettingsMap); }
@Override public IndexMetaData apply(IndexMetaData part) { Builder builder = builder(index); builder.version(version); builder.mappingVersion(mappingVersion); builder.settingsVersion(settingsVersion); builder.setRoutingNumShards(routingNumShards); builder.state(state); builder.settings(settings); builder.primaryTerms(primaryTerms); builder.mappings.putAll(mappings.apply(part.mappings)); builder.aliases.putAll(aliases.apply(part.aliases)); builder.customMetaData.putAll(customData.apply(part.customData)); builder.inSyncAllocationIds.putAll(inSyncAllocationIds.apply(part.inSyncAllocationIds)); builder.rolloverInfos.putAll(rolloverInfos.apply(part.rolloverInfos)); return builder.build(); } }
public Builder(RestoreInProgress restoreInProgress) { entries.putAll(restoreInProgress.entries); }
public ClusterInfo(StreamInput in) throws IOException { Map<String, DiskUsage> leastMap = in.readMap(StreamInput::readString, DiskUsage::new); Map<String, DiskUsage> mostMap = in.readMap(StreamInput::readString, DiskUsage::new); Map<String, Long> sizeMap = in.readMap(StreamInput::readString, StreamInput::readLong); Map<ShardRouting, String> routingMap = in.readMap(ShardRouting::new, StreamInput::readString); ImmutableOpenMap.Builder<String, DiskUsage> leastBuilder = ImmutableOpenMap.builder(); this.leastAvailableSpaceUsage = leastBuilder.putAll(leastMap).build(); ImmutableOpenMap.Builder<String, DiskUsage> mostBuilder = ImmutableOpenMap.builder(); this.mostAvailableSpaceUsage = mostBuilder.putAll(mostMap).build(); ImmutableOpenMap.Builder<String, Long> sizeBuilder = ImmutableOpenMap.builder(); this.shardSizes = sizeBuilder.putAll(sizeMap).build(); ImmutableOpenMap.Builder<ShardRouting, String> routingBuilder = ImmutableOpenMap.builder(); this.routingToDataPath = routingBuilder.putAll(routingMap).build(); }
public Builder customs(ImmutableOpenMap<String, Custom> customs) { this.customs.putAll(customs); return this; }
public Builder customs(ImmutableOpenMap<String, Custom> customs) { this.customs.putAll(customs); return this; }
public Builder templates(ImmutableOpenMap<String, IndexTemplateMetaData> templates) { this.templates.putAll(templates); return this; }
/** * @return An immutable copy of the given map */ public static <KType, VType> ImmutableOpenMap<KType, VType> copyOf(ObjectObjectMap<KType, VType> map) { Builder<KType, VType> builder = builder(); builder.putAll(map); return builder.build(); }
public Builder indices(ImmutableOpenMap<String, IndexMetaData> indices) { this.indices.putAll(indices); return this; }
/** * Get a {@link Map} of the discovered master and data nodes arranged by their ids * * @return {@link Map} of the discovered master and data nodes arranged by their ids */ public ImmutableOpenMap<String, DiscoveryNode> getMasterAndDataNodes() { ImmutableOpenMap.Builder<String, DiscoveryNode> nodes = ImmutableOpenMap.builder(dataNodes); nodes.putAll(masterNodes); return nodes.build(); }