org.elasticsearch.cluster.ClusterState.getCustoms()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(81)

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

ClusterState.getCustoms介绍

暂无

代码示例

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

@Override
public ClusterTasksResult<Task> execute(final ClusterState currentState, final List<Task> tasks) throws Exception {
  final ClusterTasksResult.Builder<Task> resultBuilder = ClusterTasksResult.<Task>builder().successes(tasks);
  Set<String> completedRestores = tasks.stream().map(e -> e.uuid).collect(Collectors.toSet());
  RestoreInProgress.Builder restoreInProgressBuilder = new RestoreInProgress.Builder();
  final RestoreInProgress restoreInProgress = currentState.custom(RestoreInProgress.TYPE);
  boolean changed = false;
  if (restoreInProgress != null) {
    for (RestoreInProgress.Entry entry : restoreInProgress) {
      if (completedRestores.contains(entry.uuid())) {
        changed = true;
      } else {
        restoreInProgressBuilder.add(entry);
      }
    }
  }
  if (changed == false) {
    return resultBuilder.build(currentState);
  }
  ImmutableOpenMap.Builder<String, ClusterState.Custom> builder = ImmutableOpenMap.builder(currentState.getCustoms());
  builder.put(RestoreInProgress.TYPE, restoreInProgressBuilder.build());
  ImmutableOpenMap<String, ClusterState.Custom> customs = builder.build();
  return resultBuilder.build(ClusterState.builder(currentState).customs(customs).build());
}

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

ImmutableOpenMap<String, ClusterState.Custom> customs = currentState.getCustoms();
final RestoreInProgress restoreInProgress = currentState.custom(RestoreInProgress.TYPE);
if (restoreInProgress != null) {

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

@Override
public ClusterTasksResult<Task> execute(final ClusterState currentState, final List<Task> tasks) throws Exception {
  final ClusterTasksResult.Builder<Task> resultBuilder = ClusterTasksResult.<Task>builder().successes(tasks);
  Set<Snapshot> completedSnapshots = tasks.stream().map(e -> e.snapshot).collect(Collectors.toSet());
  final List<RestoreInProgress.Entry> entries = new ArrayList<>();
  final RestoreInProgress restoreInProgress = currentState.custom(RestoreInProgress.TYPE);
  boolean changed = false;
  if (restoreInProgress != null) {
    for (RestoreInProgress.Entry entry : restoreInProgress.entries()) {
      if (completedSnapshots.contains(entry.snapshot()) == false) {
        entries.add(entry);
      } else {
        changed = true;
      }
    }
  }
  if (changed == false) {
    return resultBuilder.build(currentState);
  }
  RestoreInProgress updatedRestoreInProgress = new RestoreInProgress(entries.toArray(new RestoreInProgress.Entry[entries.size()]));
  ImmutableOpenMap.Builder<String, ClusterState.Custom> builder = ImmutableOpenMap.builder(currentState.getCustoms());
  builder.put(RestoreInProgress.TYPE, updatedRestoreInProgress);
  ImmutableOpenMap<String, ClusterState.Custom> customs = builder.build();
  return resultBuilder.build(ClusterState.builder(currentState).customs(customs).build());
}

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

@Override
public ClusterTasksResult<Task> execute(final ClusterState currentState, final List<Task> tasks) throws Exception {
  final ClusterTasksResult.Builder<Task> resultBuilder = ClusterTasksResult.<Task>builder().successes(tasks);
  Set<Snapshot> completedSnapshots = tasks.stream().map(e -> e.snapshot).collect(Collectors.toSet());
  final List<RestoreInProgress.Entry> entries = new ArrayList<>();
  final RestoreInProgress restoreInProgress = currentState.custom(RestoreInProgress.TYPE);
  boolean changed = false;
  if (restoreInProgress != null) {
    for (RestoreInProgress.Entry entry : restoreInProgress.entries()) {
      if (completedSnapshots.contains(entry.snapshot()) == false) {
        entries.add(entry);
      } else {
        changed = true;
      }
    }
  }
  if (changed == false) {
    return resultBuilder.build(currentState);
  }
  RestoreInProgress updatedRestoreInProgress = new RestoreInProgress(entries.toArray(new RestoreInProgress.Entry[entries.size()]));
  ImmutableOpenMap.Builder<String, ClusterState.Custom> builder = ImmutableOpenMap.builder(currentState.getCustoms());
  builder.put(RestoreInProgress.TYPE, updatedRestoreInProgress);
  ImmutableOpenMap<String, ClusterState.Custom> customs = builder.build();
  return resultBuilder.build(ClusterState.builder(currentState).customs(customs).build());
}

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

@Override
public ClusterTasksResult<Task> execute(final ClusterState currentState, final List<Task> tasks) throws Exception {
  final ClusterTasksResult.Builder<Task> resultBuilder = ClusterTasksResult.<Task>builder().successes(tasks);
  Set<Snapshot> completedSnapshots = tasks.stream().map(e -> e.snapshot).collect(Collectors.toSet());
  final List<RestoreInProgress.Entry> entries = new ArrayList<>();
  final RestoreInProgress restoreInProgress = currentState.custom(RestoreInProgress.TYPE);
  boolean changed = false;
  if (restoreInProgress != null) {
    for (RestoreInProgress.Entry entry : restoreInProgress.entries()) {
      if (completedSnapshots.contains(entry.snapshot()) == false) {
        entries.add(entry);
      } else {
        changed = true;
      }
    }
  }
  if (changed == false) {
    return resultBuilder.build(currentState);
  }
  RestoreInProgress updatedRestoreInProgress = new RestoreInProgress(entries.toArray(new RestoreInProgress.Entry[entries.size()]));
  ImmutableOpenMap.Builder<String, ClusterState.Custom> builder = ImmutableOpenMap.builder(currentState.getCustoms());
  builder.put(RestoreInProgress.TYPE, updatedRestoreInProgress);
  ImmutableOpenMap<String, ClusterState.Custom> customs = builder.build();
  return resultBuilder.build(ClusterState.builder(currentState).customs(customs).build());
}

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

ImmutableOpenMap<String, ClusterState.Custom> customs = currentState.getCustoms();

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

ImmutableOpenMap<String, ClusterState.Custom> customs = currentState.getCustoms();
final RestoreInProgress restoreInProgress = currentState.custom(RestoreInProgress.TYPE);
if (restoreInProgress != null) {

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

ImmutableOpenMap<String, ClusterState.Custom> customs = currentState.getCustoms();
final RestoreInProgress restoreInProgress = currentState.custom(RestoreInProgress.TYPE);
if (restoreInProgress != null) {

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

ImmutableOpenMap.Builder<String, ClusterState.Custom> builder = ImmutableOpenMap.builder(currentState.getCustoms());
builder.put(RestoreInProgress.TYPE, updatedRestoreInProgress);
ImmutableOpenMap<String, ClusterState.Custom> customs = builder.build();

相关文章