当前位置: 首页>>代码示例>>Java>>正文


Java ImmutableOpenMap.of方法代码示例

本文整理汇总了Java中org.elasticsearch.common.collect.ImmutableOpenMap.of方法的典型用法代码示例。如果您正苦于以下问题:Java ImmutableOpenMap.of方法的具体用法?Java ImmutableOpenMap.of怎么用?Java ImmutableOpenMap.of使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.elasticsearch.common.collect.ImmutableOpenMap的用法示例。


在下文中一共展示了ImmutableOpenMap.of方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: InternalClusterInfoService

import org.elasticsearch.common.collect.ImmutableOpenMap; //导入方法依赖的package包/类
public InternalClusterInfoService(Settings settings, ClusterService clusterService, ThreadPool threadPool, NodeClient client) {
    super(settings);
    this.leastAvailableSpaceUsages = ImmutableOpenMap.of();
    this.mostAvailableSpaceUsages = ImmutableOpenMap.of();
    this.shardRoutingToDataPath = ImmutableOpenMap.of();
    this.shardSizes = ImmutableOpenMap.of();
    this.clusterService = clusterService;
    this.threadPool = threadPool;
    this.client = client;
    this.updateFrequency = INTERNAL_CLUSTER_INFO_UPDATE_INTERVAL_SETTING.get(settings);
    this.fetchTimeout = INTERNAL_CLUSTER_INFO_TIMEOUT_SETTING.get(settings);
    this.enabled = DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED_SETTING.get(settings);
    ClusterSettings clusterSettings = clusterService.getClusterSettings();
    clusterSettings.addSettingsUpdateConsumer(INTERNAL_CLUSTER_INFO_TIMEOUT_SETTING, this::setFetchTimeout);
    clusterSettings.addSettingsUpdateConsumer(INTERNAL_CLUSTER_INFO_UPDATE_INTERVAL_SETTING, this::setUpdateFrequency);
    clusterSettings.addSettingsUpdateConsumer(DiskThresholdSettings.CLUSTER_ROUTING_ALLOCATION_DISK_THRESHOLD_ENABLED_SETTING, this::setEnabled);

    // Add InternalClusterInfoService to listen for Master changes
    this.clusterService.addLocalNodeMasterListener(this);
    // Add to listen for state changes (when nodes are added)
    this.clusterService.addListener(this);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:23,代码来源:InternalClusterInfoService.java

示例2: Entry

import org.elasticsearch.common.collect.ImmutableOpenMap; //导入方法依赖的package包/类
public Entry(Snapshot snapshot, boolean includeGlobalState, boolean partial, State state, List<IndexId> indices,
             long startTime, long repositoryStateId, ImmutableOpenMap<ShardId, ShardSnapshotStatus> shards) {
    this.state = state;
    this.snapshot = snapshot;
    this.includeGlobalState = includeGlobalState;
    this.partial = partial;
    this.indices = indices;
    this.startTime = startTime;
    if (shards == null) {
        this.shards = ImmutableOpenMap.of();
        this.waitingIndices = ImmutableOpenMap.of();
    } else {
        this.shards = shards;
        this.waitingIndices = findWaitingIndices(shards);
    }
    this.repositoryStateId = repositoryStateId;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:18,代码来源:SnapshotsInProgress.java

示例3: Entry

import org.elasticsearch.common.collect.ImmutableOpenMap; //导入方法依赖的package包/类
/**
 * Creates new restore metadata
 *
 * @param snapshot   snapshot
 * @param state      current state of the restore process
 * @param indices    list of indices being restored
 * @param shards     map of shards being restored to their current restore status
 */
public Entry(Snapshot snapshot, State state, List<String> indices, ImmutableOpenMap<ShardId, ShardRestoreStatus> shards) {
    this.snapshot = Objects.requireNonNull(snapshot);
    this.state = Objects.requireNonNull(state);
    this.indices = Objects.requireNonNull(indices);
    if (shards == null) {
        this.shards = ImmutableOpenMap.of();
    } else {
        this.shards = shards;
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:19,代码来源:RestoreInProgress.java

示例4: testGlobalBlocksCheckedIfNoIndicesSpecified

import org.elasticsearch.common.collect.ImmutableOpenMap; //导入方法依赖的package包/类
public void testGlobalBlocksCheckedIfNoIndicesSpecified() {
    EnumSet<ClusterBlockLevel> levels = EnumSet.noneOf(ClusterBlockLevel.class);
    int nbLevels = randomIntBetween(1, ClusterBlockLevel.values().length);
    for (int j = 0; j < nbLevels; j++) {
        levels.add(randomFrom(ClusterBlockLevel.values()));
    }
    ClusterBlock globalBlock = new ClusterBlock(randomInt(), "cluster block #" + randomInt(), randomBoolean(),
        randomBoolean(), randomFrom(RestStatus.values()), levels);
    ClusterBlocks clusterBlocks = new ClusterBlocks(Collections.singleton(globalBlock), ImmutableOpenMap.of());
    ClusterBlockException exception = clusterBlocks.indicesBlockedException(randomFrom(globalBlock.levels()), new String[0]);
    assertNotNull(exception);
    assertEquals(exception.blocks(), Collections.singleton(globalBlock));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:14,代码来源:ClusterBlockTests.java

示例5: testDeleteSnapshotting

import org.elasticsearch.common.collect.ImmutableOpenMap; //导入方法依赖的package包/类
public void testDeleteSnapshotting() {
    String index = randomAsciiOfLength(5);
    Snapshot snapshot = new Snapshot("doesn't matter", new SnapshotId("snapshot name", "snapshot uuid"));
    SnapshotsInProgress snaps = new SnapshotsInProgress(new SnapshotsInProgress.Entry(snapshot, true, false,
            SnapshotsInProgress.State.INIT, singletonList(new IndexId(index, "doesn't matter")),
            System.currentTimeMillis(), (long) randomIntBetween(0, 1000), ImmutableOpenMap.of()));
    ClusterState state = ClusterState.builder(clusterState(index))
            .putCustom(SnapshotsInProgress.TYPE, snaps)
            .build();
    Exception e = expectThrows(IllegalArgumentException.class,
            () -> service.deleteIndices(state, singleton(state.metaData().getIndices().get(index).getIndex())));
    assertEquals("Cannot delete indices that are being snapshotted: [[" + index + "]]. Try again after snapshot finishes "
            + "or cancel the currently running snapshot.", e.getMessage());
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:15,代码来源:MetaDataDeleteIndexServiceTests.java

示例6: empty

import org.elasticsearch.common.collect.ImmutableOpenMap; //导入方法依赖的package包/类
public static MultiFields empty() {
    return new MultiFields(ImmutableOpenMap.<String, FieldMapper>of());
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:4,代码来源:FieldMapper.java

示例7: ClusterInfo

import org.elasticsearch.common.collect.ImmutableOpenMap; //导入方法依赖的package包/类
protected ClusterInfo() {
   this(ImmutableOpenMap.of(), ImmutableOpenMap.of(), ImmutableOpenMap.of(), ImmutableOpenMap.of());
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:4,代码来源:ClusterInfo.java

示例8: doMasterOperation

import org.elasticsearch.common.collect.ImmutableOpenMap; //导入方法依赖的package包/类
@Override
protected void doMasterOperation(final GetIndexRequest request, String[] concreteIndices, final ClusterState state,
                                 final ActionListener<GetIndexResponse> listener) {
    ImmutableOpenMap<String, ImmutableOpenMap<String, MappingMetaData>> mappingsResult = ImmutableOpenMap.of();
    ImmutableOpenMap<String, List<AliasMetaData>> aliasesResult = ImmutableOpenMap.of();
    ImmutableOpenMap<String, Settings> settings = ImmutableOpenMap.of();
    Feature[] features = request.features();
    boolean doneAliases = false;
    boolean doneMappings = false;
    boolean doneSettings = false;
    for (Feature feature : features) {
        switch (feature) {
        case MAPPINGS:
                if (!doneMappings) {
                    mappingsResult = state.metaData().findMappings(concreteIndices, request.types());
                    doneMappings = true;
                }
                break;
        case ALIASES:
                if (!doneAliases) {
                    aliasesResult = state.metaData().findAliases(Strings.EMPTY_ARRAY, concreteIndices);
                    doneAliases = true;
                }
                break;
        case SETTINGS:
                if (!doneSettings) {
                    ImmutableOpenMap.Builder<String, Settings> settingsMapBuilder = ImmutableOpenMap.builder();
                    for (String index : concreteIndices) {
                        Settings indexSettings = state.metaData().index(index).getSettings();
                        if (request.humanReadable()) {
                            indexSettings = IndexMetaData.addHumanReadableSettings(indexSettings);
                        }
                        settingsMapBuilder.put(index, indexSettings);
                    }
                    settings = settingsMapBuilder.build();
                    doneSettings = true;
                }
                break;

            default:
                throw new IllegalStateException("feature [" + feature + "] is not valid");
        }
    }
    listener.onResponse(new GetIndexResponse(concreteIndices, mappingsResult, aliasesResult, settings));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:46,代码来源:TransportGetIndexAction.java

示例9: IndicesShardStoresResponse

import org.elasticsearch.common.collect.ImmutableOpenMap; //导入方法依赖的package包/类
IndicesShardStoresResponse() {
    this(ImmutableOpenMap.<String, ImmutableOpenIntMap<List<StoreStatus>>>of(), Collections.<Failure>emptyList());
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:4,代码来源:IndicesShardStoresResponse.java

示例10: testCanAllocateUsesMaxAvailableSpace

import org.elasticsearch.common.collect.ImmutableOpenMap; //导入方法依赖的package包/类
public void testCanAllocateUsesMaxAvailableSpace() {
    ClusterSettings nss = new ClusterSettings(Settings.EMPTY, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS);
    DiskThresholdDecider decider = new DiskThresholdDecider(Settings.EMPTY, nss);

    MetaData metaData = MetaData.builder()
            .put(IndexMetaData.builder("test").settings(settings(Version.CURRENT)).numberOfShards(1).numberOfReplicas(1))
            .build();

    final Index index = metaData.index("test").getIndex();

    ShardRouting test_0 = ShardRouting.newUnassigned(new ShardId(index, 0), true, StoreRecoverySource.EMPTY_STORE_INSTANCE, new UnassignedInfo(UnassignedInfo.Reason.INDEX_CREATED, "foo"));
    DiscoveryNode node_0 = new DiscoveryNode("node_0", buildNewFakeTransportAddress(), Collections.emptyMap(),
            new HashSet<>(Arrays.asList(DiscoveryNode.Role.values())), Version.CURRENT);
    DiscoveryNode node_1 = new DiscoveryNode("node_1", buildNewFakeTransportAddress(), Collections.emptyMap(),
            new HashSet<>(Arrays.asList(DiscoveryNode.Role.values())), Version.CURRENT);

    RoutingTable routingTable = RoutingTable.builder()
            .addAsNew(metaData.index("test"))
            .build();

    ClusterState clusterState = ClusterState.builder(org.elasticsearch.cluster.ClusterName.CLUSTER_NAME_SETTING.getDefault(Settings.EMPTY)).metaData(metaData).routingTable(routingTable).build();

    clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder()
                    .add(node_0)
                    .add(node_1)
    ).build();

    // actual test -- after all that bloat :)
    ImmutableOpenMap.Builder<String, DiskUsage> leastAvailableUsages = ImmutableOpenMap.builder();
    leastAvailableUsages.put("node_0", new DiskUsage("node_0", "node_0", "_na_", 100, 0)); // all full
    leastAvailableUsages.put("node_1", new DiskUsage("node_1", "node_1", "_na_", 100, 0)); // all full

    ImmutableOpenMap.Builder<String, DiskUsage> mostAvailableUsage = ImmutableOpenMap.builder();
    mostAvailableUsage.put("node_0", new DiskUsage("node_0", "node_0", "_na_", 100, randomIntBetween(20, 100))); // 20 - 99 percent since after allocation there must be at least 10% left and shard is 10byte
    mostAvailableUsage.put("node_1", new DiskUsage("node_1", "node_1", "_na_", 100, randomIntBetween(0, 10))); // this is weird and smells like a bug! it should be up to 20%?

    ImmutableOpenMap.Builder<String, Long> shardSizes = ImmutableOpenMap.builder();
    shardSizes.put("[test][0][p]", 10L); // 10 bytes
    final ClusterInfo clusterInfo = new ClusterInfo(leastAvailableUsages.build(), mostAvailableUsage.build(), shardSizes.build(), ImmutableOpenMap.of());
    RoutingAllocation allocation = new RoutingAllocation(new AllocationDeciders(Settings.EMPTY, Collections.singleton(decider)), clusterState.getRoutingNodes(), clusterState, clusterInfo, System.nanoTime(), false);
    allocation.debugDecision(true);
    Decision decision = decider.canAllocate(test_0, new RoutingNode("node_0", node_0), allocation);
    assertEquals(mostAvailableUsage.toString(), Decision.Type.YES, decision.type());
    assertThat(((Decision.Single) decision).getExplanation(), containsString("enough disk for shard on node"));
    decision = decider.canAllocate(test_0, new RoutingNode("node_1", node_1), allocation);
    assertEquals(mostAvailableUsage.toString(), Decision.Type.NO, decision.type());
    assertThat(((Decision.Single) decision).getExplanation(), containsString(
        "the node is above the high watermark cluster setting [cluster.routing.allocation.disk.watermark.high=90%], using more " +
        "disk space than the maximum allowed [90.0%]"));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:51,代码来源:DiskThresholdDeciderUnitTests.java

示例11: getContext

import org.elasticsearch.common.collect.ImmutableOpenMap; //导入方法依赖的package包/类
@Override
public ImmutableOpenMap<Object, Object> getContext() {
    return ImmutableOpenMap.of();
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:5,代码来源:PercolateContext.java

示例12: empty

import org.elasticsearch.common.collect.ImmutableOpenMap; //导入方法依赖的package包/类
@Override
protected AtomicParentChildFieldData empty(int maxDoc) {
    return new ParentChildAtomicFieldData(ImmutableOpenMap.<String, AtomicOrdinalsFieldData>of());
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:5,代码来源:ParentChildIndexFieldData.java

示例13: empty

import org.elasticsearch.common.collect.ImmutableOpenMap; //导入方法依赖的package包/类
public static MultiFields empty() {
    return new MultiFields(ContentPath.Type.FULL, ImmutableOpenMap.<String, FieldMapper>of());
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:4,代码来源:FieldMapper.java

示例14: getContext

import org.elasticsearch.common.collect.ImmutableOpenMap; //导入方法依赖的package包/类
@Override
public synchronized ImmutableOpenMap<Object, Object> getContext() {
    return context != null ? ImmutableOpenMap.copyOf(context) : ImmutableOpenMap.of();
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:5,代码来源:ContextAndHeaderHolder.java

示例15: doMasterOperation

import org.elasticsearch.common.collect.ImmutableOpenMap; //导入方法依赖的package包/类
@Override
protected void doMasterOperation(final GetIndexRequest request, String[] concreteIndices, final ClusterState state,
                                 final ActionListener<GetIndexResponse> listener) {
    ImmutableOpenMap<String, List<Entry>> warmersResult = ImmutableOpenMap.of();
    ImmutableOpenMap<String, ImmutableOpenMap<String, MappingMetaData>> mappingsResult = ImmutableOpenMap.of();
    ImmutableOpenMap<String, List<AliasMetaData>> aliasesResult = ImmutableOpenMap.of();
    ImmutableOpenMap<String, Settings> settings = ImmutableOpenMap.of();
    Feature[] features = request.features();
    boolean doneAliases = false;
    boolean doneMappings = false;
    boolean doneSettings = false;
    boolean doneWarmers = false;
    for (Feature feature : features) {
        switch (feature) {
        case WARMERS:
                if (!doneWarmers) {
                    warmersResult = state.metaData().findWarmers(concreteIndices, request.types(), Strings.EMPTY_ARRAY);
                    doneWarmers = true;
                }
                break;
        case MAPPINGS:
                if (!doneMappings) {
                    mappingsResult = state.metaData().findMappings(concreteIndices, request.types());
                    doneMappings = true;
                }
                break;
        case ALIASES:
                if (!doneAliases) {
                    aliasesResult = state.metaData().findAliases(Strings.EMPTY_ARRAY, concreteIndices);
                    doneAliases = true;
                }
                break;
        case SETTINGS:
                if (!doneSettings) {
                    ImmutableOpenMap.Builder<String, Settings> settingsMapBuilder = ImmutableOpenMap.builder();
                    for (String index : concreteIndices) {
                        Settings indexSettings = state.metaData().index(index).getSettings();
                        if (request.humanReadable()) {
                            indexSettings = IndexMetaData.addHumanReadableSettings(indexSettings);
                        }
                        settingsMapBuilder.put(index, indexSettings);
                    }
                    settings = settingsMapBuilder.build();
                    doneSettings = true;
                }
                break;

            default:
                throw new IllegalStateException("feature [" + feature + "] is not valid");
        }
    }
    listener.onResponse(new GetIndexResponse(concreteIndices, warmersResult, mappingsResult, aliasesResult, settings));
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:54,代码来源:TransportGetIndexAction.java


注:本文中的org.elasticsearch.common.collect.ImmutableOpenMap.of方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。