public static void writeTo(ClusterState state, StreamOutput out) throws IOException {
   out.writeLong(state.version());
   MetaData.Builder.writeTo(state.metaData(), out);
   RoutingTable.Builder.writeTo(state.routingTable(), out);
   DiscoveryNodes.Builder.writeTo(state.nodes(), out);
   ClusterBlocks.Builder.writeClusterBlocks(state.blocks(), out);
   state.allocationExplanation().writeTo(out);
 }
Beispiel #2
0
 private void removeIndex(
     ClusterBlocks.Builder blocks,
     MetaData.Builder metaData,
     RoutingTable.Builder routingTable,
     IndexMetaData index) {
   metaData.remove(index.getIndex());
   routingTable.remove(index.getIndex());
   blocks.removeIndexBlocks(index.getIndex());
 }
Beispiel #3
0
 private void addNewIndex(
     ClusterState tribeState,
     ClusterBlocks.Builder blocks,
     MetaData.Builder metaData,
     RoutingTable.Builder routingTable,
     IndexMetaData tribeIndex) {
   Settings tribeSettings =
       Settings.builder().put(tribeIndex.getSettings()).put(TRIBE_NAME, tribeName).build();
   metaData.put(IndexMetaData.builder(tribeIndex).settings(tribeSettings));
   routingTable.add(tribeState.routingTable().index(tribeIndex.getIndex()));
   if (Regex.simpleMatch(blockIndicesMetadata, tribeIndex.getIndex())) {
     blocks.addIndexBlock(tribeIndex.getIndex(), IndexMetaData.INDEX_METADATA_BLOCK);
   }
   if (Regex.simpleMatch(blockIndicesRead, tribeIndex.getIndex())) {
     blocks.addIndexBlock(tribeIndex.getIndex(), IndexMetaData.INDEX_READ_BLOCK);
   }
   if (Regex.simpleMatch(blockIndicesWrite, tribeIndex.getIndex())) {
     blocks.addIndexBlock(tribeIndex.getIndex(), IndexMetaData.INDEX_WRITE_BLOCK);
   }
 }
 public static ClusterState readFrom(
     StreamInput in, @Nullable Settings globalSettings, @Nullable DiscoveryNode localNode)
     throws IOException {
   Builder builder = new Builder();
   builder.version = in.readLong();
   builder.metaData = MetaData.Builder.readFrom(in, globalSettings);
   builder.routingTable = RoutingTable.Builder.readFrom(in);
   builder.nodes = DiscoveryNodes.Builder.readFrom(in, localNode);
   builder.blocks = ClusterBlocks.Builder.readClusterBlocks(in);
   builder.allocationExplanation = AllocationExplanation.readAllocationExplanation(in);
   return builder.build();
 }
 /** Remove an initial block to be set on the first cluster state created. */
 public synchronized void removeInitialStateBlock(int blockId) throws IllegalStateException {
   if (lifecycle.started()) {
     throw new IllegalStateException("can't set initial block when started");
   }
   initialBlocks.removeGlobalBlock(blockId);
 }
 /** Adds an initial block to be set on the first cluster state created. */
 public synchronized void addInitialStateBlock(ClusterBlock block) throws IllegalStateException {
   if (lifecycle.started()) {
     throw new IllegalStateException("can't set initial block when started");
   }
   initialBlocks.addGlobalBlock(block);
 }
 public void addInitialStateBlock(ClusterBlock block) throws ElasticSearchIllegalStateException {
   if (lifecycle.started()) {
     throw new ElasticSearchIllegalStateException("can't set initial block when started");
   }
   initialBlocks.addGlobalBlock(block);
 }
 public Builder blocks(ClusterBlocks.Builder blocksBuilder) {
   return blocks(blocksBuilder.build());
 }