public ClusterBlockException globalBlockedException(ClusterBlockLevel level) { if (globalBlocked(level) == false) { return null; } return new ClusterBlockException(global(level)); }
public boolean hasGlobalBlock(ClusterBlockLevel level) { return global(level).size() > 0; }
public ClusterBlockException indicesBlockedException(ClusterBlockLevel level, String[] indices) { boolean indexIsBlocked = false; for (String index : indices) { if (indexBlocked(level, index)) { indexIsBlocked = true; } } if (globalBlocked(level) == false && indexIsBlocked == false) { return null; } Function<String, Stream<ClusterBlock>> blocksForIndexAtLevel = index -> blocksForIndex(level, index).stream(); Stream<ClusterBlock> blocks = concat( global(level).stream(), Stream.of(indices).flatMap(blocksForIndexAtLevel)); return new ClusterBlockException(unmodifiableSet(blocks.collect(toSet()))); }
private boolean globalBlocked(ClusterBlockLevel level) { return global(level).isEmpty() == false; }
public ClusterBlockException globalBlockedException(ClusterBlockLevel level) { if (globalBlocked(level) == false) { return null; } return new ClusterBlockException(global(level)); }
public Builder blocks(ClusterBlocks blocks) { global.addAll(blocks.global()); for (ObjectObjectCursor<String, Set<ClusterBlock>> entry : blocks.indices()) { if (!indices.containsKey(entry.key)) { indices.put(entry.key, new HashSet<>()); } indices.get(entry.key).addAll(entry.value); } return this; }
public ClusterBlockException globalBlockedException(ClusterBlockLevel level) { if (globalBlocked(level) == false) { return null; } return new ClusterBlockException(global(level)); }
public ClusterBlockException indexBlockedException(ClusterBlockLevel level, String index) { if (!indexBlocked(level, index)) { return null; } Stream<ClusterBlock> blocks = concat( global(level).stream(), blocksForIndex(level, index).stream()); return new ClusterBlockException(unmodifiableSet(blocks.collect(toSet()))); }
public ClusterBlockException globalBlockedException(ClusterBlockLevel level) { if (globalBlocked(level) == false) { return null; } return new ClusterBlockException(global(level)); }
/** * Returns <code>true</code> iff non of the given have a {@link ClusterBlockLevel#METADATA_WRITE} in place where the * {@link ClusterBlock#isAllowReleaseResources()} returns <code>false</code>. This is used in places where resources will be released * like the deletion of an index to free up resources on nodes. * @param indices the indices to check */ public ClusterBlockException indicesAllowReleaseResources(String[] indices) { final Function<String, Stream<ClusterBlock>> blocksForIndexAtLevel = index -> blocksForIndex(ClusterBlockLevel.METADATA_WRITE, index).stream(); Stream<ClusterBlock> blocks = concat( global(ClusterBlockLevel.METADATA_WRITE).stream(), Stream.of(indices).flatMap(blocksForIndexAtLevel)).filter(clusterBlock -> clusterBlock.isAllowReleaseResources() == false); Set<ClusterBlock> clusterBlocks = unmodifiableSet(blocks.collect(toSet())); if (clusterBlocks.isEmpty()) { return null; } return new ClusterBlockException(clusterBlocks); }
public ClusterBlockException globalBlockedException(ClusterBlockLevel level) { if (globalBlocked(level) == false) { return null; } return new ClusterBlockException(ImmutableSet.copyOf(global(level))); }
public Builder blocks(ClusterBlocks blocks) { global.addAll(blocks.global()); for (ObjectObjectCursor<String, Set<ClusterBlock>> entry : blocks.indices()) { if (!indices.containsKey(entry.key)) { indices.put(entry.key, new HashSet<>()); } indices.get(entry.key).addAll(entry.value); } return this; }
public Builder blocks(ClusterBlocks blocks) { global.addAll(blocks.global()); for (ObjectObjectCursor<String, Set<ClusterBlock>> entry : blocks.indices()) { if (!indices.containsKey(entry.key)) { indices.put(entry.key, new HashSet<>()); } indices.get(entry.key).addAll(entry.value); } return this; }
public Builder blocks(ClusterBlocks blocks) { global.addAll(blocks.global()); for (ObjectObjectCursor<String, Set<ClusterBlock>> entry : blocks.indices()) { if (!indices.containsKey(entry.key)) { indices.put(entry.key, new HashSet<>()); } indices.get(entry.key).addAll(entry.value); } return this; }
public Builder blocks(ClusterBlocks blocks) { global.addAll(blocks.global()); for (Map.Entry<String, ImmutableSet<ClusterBlock>> entry : blocks.indices().entrySet()) { if (!indices.containsKey(entry.getKey())) { indices.put(entry.getKey(), Sets.<ClusterBlock>newHashSet()); } indices.get(entry.getKey()).addAll(entry.getValue()); } return this; }
public ClusterBlockException indexBlockedException(ClusterBlockLevel level, String index) { if (!indexBlocked(level, index)) { return null; } Stream<ClusterBlock> blocks = concat( global(level).stream(), blocksForIndex(level, index).stream()); return new ClusterBlockException(unmodifiableSet(blocks.collect(toSet()))); }
public ClusterBlockException indexBlockedException(ClusterBlockLevel level, String index) { if (!indexBlocked(level, index)) { return null; } Stream<ClusterBlock> blocks = concat( global(level).stream(), blocksForIndex(level, index).stream()); return new ClusterBlockException(unmodifiableSet(blocks.collect(toSet()))); }
public ClusterBlockException indexBlockedException(ClusterBlockLevel level, String index) { if (!indexBlocked(level, index)) { return null; } Stream<ClusterBlock> blocks = concat( global(level).stream(), blocksForIndex(level, index).stream()); return new ClusterBlockException(unmodifiableSet(blocks.collect(toSet()))); }
public ClusterBlockException indexBlockedException(ClusterBlockLevel level, String index) { if (!indexBlocked(level, index)) { return null; } ImmutableSet.Builder<ClusterBlock> builder = ImmutableSet.builder(); builder.addAll(global(level)); ImmutableSet<ClusterBlock> indexBlocks = indices(level).get(index); if (indexBlocks != null) { builder.addAll(indexBlocks); } return new ClusterBlockException(builder.build()); }