org.elasticsearch.common.settings.Settings.size()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(10.0k)|赞(0)|评价(0)|浏览(91)

本文整理了Java中org.elasticsearch.common.settings.Settings.size()方法的一些代码示例,展示了Settings.size()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Settings.size()方法的具体详情如下:
包路径:org.elasticsearch.common.settings.Settings
类名称:Settings
方法名:size

Settings.size介绍

[英]Returns the number of settings in this settings object.
[中]返回此设置对象中的设置数。

代码示例

代码示例来源:origin: floragunncom/search-guard

if(log.isDebugEnabled() && this.settings.getByPrefix("tribe").size() > 0) {
  log.debug("Tribe configuration detected: {}", this.settings);
boolean tribeNode = this.settings.get("tribe.name", null) == null && this.settings.getByPrefix("tribe").size() > 0;
tribeNodeClient = this.settings.get("tribe.name", null) != null;

代码示例来源:origin: floragunncom/search-guard

&& settings.getByPrefix("tribe").size() > 0) {
getThreadContext().putHeader("_sg_header_tn", "true");

代码示例来源:origin: org.elasticsearch/elasticsearch

@Override
protected ClusterBlockException checkBlock(ClusterUpdateSettingsRequest request, ClusterState state) {
  // allow for dedicated changes to the metadata blocks, so we don't block those to allow to "re-enable" it
  if (request.transientSettings().size() + request.persistentSettings().size() == 1) {
    // only one setting
    if (MetaData.SETTING_READ_ONLY_SETTING.exists(request.persistentSettings())
      || MetaData.SETTING_READ_ONLY_SETTING.exists(request.transientSettings())
      || MetaData.SETTING_READ_ONLY_ALLOW_DELETE_SETTING.exists(request.transientSettings())
      || MetaData.SETTING_READ_ONLY_ALLOW_DELETE_SETTING.exists(request.persistentSettings())) {
      // one of the settings above as the only setting in the request means - resetting the block!
      return null;
    }
  }
  return state.blocks().globalBlockedException(ClusterBlockLevel.METADATA_WRITE);
}

代码示例来源:origin: org.elasticsearch/elasticsearch

@Override
protected ClusterBlockException checkBlock(UpdateSettingsRequest request, ClusterState state) {
  // allow for dedicated changes to the metadata blocks, so we don't block those to allow to "re-enable" it
  ClusterBlockException globalBlock = state.blocks().globalBlockedException(ClusterBlockLevel.METADATA_WRITE);
  if (globalBlock != null) {
    return globalBlock;
  }
  if (request.settings().size() == 1 &&  // we have to allow resetting these settings otherwise users can't unblock an index
    IndexMetaData.INDEX_BLOCKS_METADATA_SETTING.exists(request.settings())
    || IndexMetaData.INDEX_READ_ONLY_SETTING.exists(request.settings())
    || IndexMetaData.INDEX_BLOCKS_READ_ONLY_ALLOW_DELETE_SETTING.exists(request.settings())) {
    return null;
  }
  return state.blocks().indicesBlockedException(ClusterBlockLevel.METADATA_WRITE,
    indexNameExpressionResolver.concreteIndexNames(state, request));
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

public static void writeSettingsToStream(Settings settings, StreamOutput out) throws IOException {
  out.writeVInt(settings.size());
  for (Map.Entry<String, String> entry : settings.getAsMap().entrySet()) {
    out.writeString(entry.getKey());
    out.writeOptionalString(entry.getValue());
  }
}

代码示例来源:origin: com.floragunn/search-guard-6

if(log.isDebugEnabled() && this.settings.getByPrefix("tribe").size() > 0) {
  log.debug("Tribe configuration detected: {}", this.settings);
boolean tribeNode = this.settings.get("tribe.name", null) == null && this.settings.getByPrefix("tribe").size() > 0;
tribeNodeClient = this.settings.get("tribe.name", null) != null;

代码示例来源:origin: com.floragunn/search-guard-6

&& settings.getByPrefix("tribe").size() > 0) {
getThreadContext().putHeader("_sg_header_tn", "true");

代码示例来源:origin: com.strapdata.elasticsearch.test/framework

@After
@Override
public void tearDown() throws Exception {
  logger.info("[{}#{}]: cleaning up after test", getTestClass().getSimpleName(), getTestName());
  try {
    DeleteIndexRequestBuilder builder = ElassandraDaemon.instance.node().client().admin().indices().prepareDelete("*");
    assertAcked(builder.get());
    MetaData metaData = client().admin().cluster().prepareState().get().getState().getMetaData();
    assertThat("test leaves persistent cluster metadata behind: " + metaData.persistentSettings().getAsGroups(),
        metaData.persistentSettings().size(), equalTo(0));
    assertThat("test leaves transient cluster metadata behind: " + metaData.transientSettings().getAsGroups(),
        metaData.transientSettings().size(), equalTo(0));
    List<String> userKeyspaces = Schema.instance.getUserKeyspaces();
    userKeyspaces.remove(this.clusterService().getElasticAdminKeyspaceName());
    assertThat("test leaves a user keyspace behind:" + userKeyspaces, userKeyspaces.size(), equalTo(0));
  } catch(Exception e) {
    logger.warn("[{}#{}]: failed to clean indices and metadata: error="+e, getTestClass().getSimpleName(), getTestName());
  } finally {
    testMutex.release();
    logger.info("[{}#{}]: released semaphore={}", getTestClass().getSimpleName(), getTestName(), testMutex.toString());
  }
  super.tearDown();
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

@Override
protected ClusterBlockException checkBlock(ClusterUpdateSettingsRequest request, ClusterState state) {
  // allow for dedicated changes to the metadata blocks, so we don't block those to allow to "re-enable" it
  if (request.transientSettings().size() + request.persistentSettings().size() == 1) {
    // only one setting
    if (MetaData.SETTING_READ_ONLY_SETTING.exists(request.persistentSettings())
      || MetaData.SETTING_READ_ONLY_SETTING.exists(request.transientSettings())
      || MetaData.SETTING_READ_ONLY_ALLOW_DELETE_SETTING.exists(request.transientSettings())
      || MetaData.SETTING_READ_ONLY_ALLOW_DELETE_SETTING.exists(request.persistentSettings())) {
      // one of the settings above as the only setting in the request means - resetting the block!
      return null;
    }
  }
  return state.blocks().globalBlockedException(ClusterBlockLevel.METADATA_WRITE);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

@Override
protected ClusterBlockException checkBlock(ClusterUpdateSettingsRequest request, ClusterState state) {
  // allow for dedicated changes to the metadata blocks, so we don't block those to allow to "re-enable" it
  if (request.transientSettings().size() + request.persistentSettings().size() == 1) {
    // only one setting
    if (MetaData.SETTING_READ_ONLY_SETTING.exists(request.persistentSettings())
      || MetaData.SETTING_READ_ONLY_SETTING.exists(request.transientSettings())
      || MetaData.SETTING_READ_ONLY_ALLOW_DELETE_SETTING.exists(request.transientSettings())
      || MetaData.SETTING_READ_ONLY_ALLOW_DELETE_SETTING.exists(request.persistentSettings())) {
      // one of the settings above as the only setting in the request means - resetting the block!
      return null;
    }
  }
  return state.blocks().globalBlockedException(ClusterBlockLevel.METADATA_WRITE);
}

代码示例来源:origin: apache/servicemix-bundles

@Override
protected ClusterBlockException checkBlock(ClusterUpdateSettingsRequest request, ClusterState state) {
  // allow for dedicated changes to the metadata blocks, so we don't block those to allow to "re-enable" it
  if (request.transientSettings().size() + request.persistentSettings().size() == 1) {
    // only one setting
    if (MetaData.SETTING_READ_ONLY_SETTING.exists(request.persistentSettings())
      || MetaData.SETTING_READ_ONLY_SETTING.exists(request.transientSettings())
      || MetaData.SETTING_READ_ONLY_ALLOW_DELETE_SETTING.exists(request.transientSettings())
      || MetaData.SETTING_READ_ONLY_ALLOW_DELETE_SETTING.exists(request.persistentSettings())) {
      // one of the settings above as the only setting in the request means - resetting the block!
      return null;
    }
  }
  return state.blocks().globalBlockedException(ClusterBlockLevel.METADATA_WRITE);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

@Override
protected ClusterBlockException checkBlock(UpdateSettingsRequest request, ClusterState state) {
  // allow for dedicated changes to the metadata blocks, so we don't block those to allow to "re-enable" it
  ClusterBlockException globalBlock = state.blocks().globalBlockedException(ClusterBlockLevel.METADATA_WRITE);
  if (globalBlock != null) {
    return globalBlock;
  }
  if (request.settings().size() == 1 &&  // we have to allow resetting these settings otherwise users can't unblock an index
    IndexMetaData.INDEX_BLOCKS_METADATA_SETTING.exists(request.settings())
    || IndexMetaData.INDEX_READ_ONLY_SETTING.exists(request.settings())
    || IndexMetaData.INDEX_BLOCKS_READ_ONLY_ALLOW_DELETE_SETTING.exists(request.settings())) {
    return null;
  }
  return state.blocks().indicesBlockedException(ClusterBlockLevel.METADATA_WRITE, indexNameExpressionResolver.concreteIndexNames(state, request));
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

@Override
protected ClusterBlockException checkBlock(UpdateSettingsRequest request, ClusterState state) {
  // allow for dedicated changes to the metadata blocks, so we don't block those to allow to "re-enable" it
  ClusterBlockException globalBlock = state.blocks().globalBlockedException(ClusterBlockLevel.METADATA_WRITE);
  if (globalBlock != null) {
    return globalBlock;
  }
  if (request.settings().size() == 1 &&  // we have to allow resetting these settings otherwise users can't unblock an index
    IndexMetaData.INDEX_BLOCKS_METADATA_SETTING.exists(request.settings())
    || IndexMetaData.INDEX_READ_ONLY_SETTING.exists(request.settings())
    || IndexMetaData.INDEX_BLOCKS_READ_ONLY_ALLOW_DELETE_SETTING.exists(request.settings())) {
    return null;
  }
  return state.blocks().indicesBlockedException(ClusterBlockLevel.METADATA_WRITE, indexNameExpressionResolver.concreteIndexNames(state, request));
}

代码示例来源:origin: apache/servicemix-bundles

@Override
protected ClusterBlockException checkBlock(UpdateSettingsRequest request, ClusterState state) {
  // allow for dedicated changes to the metadata blocks, so we don't block those to allow to "re-enable" it
  ClusterBlockException globalBlock = state.blocks().globalBlockedException(ClusterBlockLevel.METADATA_WRITE);
  if (globalBlock != null) {
    return globalBlock;
  }
  if (request.settings().size() == 1 &&  // we have to allow resetting these settings otherwise users can't unblock an index
    IndexMetaData.INDEX_BLOCKS_METADATA_SETTING.exists(request.settings())
    || IndexMetaData.INDEX_READ_ONLY_SETTING.exists(request.settings())
    || IndexMetaData.INDEX_BLOCKS_READ_ONLY_ALLOW_DELETE_SETTING.exists(request.settings())) {
    return null;
  }
  return state.blocks().indicesBlockedException(ClusterBlockLevel.METADATA_WRITE, indexNameExpressionResolver.concreteIndexNames(state, request));
}

相关文章