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


Java RestoreSnapshotRequest类代码示例

本文整理汇总了Java中org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotRequest的典型用法代码示例。如果您正苦于以下问题:Java RestoreSnapshotRequest类的具体用法?Java RestoreSnapshotRequest怎么用?Java RestoreSnapshotRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RestoreSnapshotRequest类属于org.elasticsearch.action.admin.cluster.snapshots.restore包,在下文中一共展示了RestoreSnapshotRequest类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: dispatch

import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotRequest; //导入依赖的package包/类
public ListenableFuture<Long> dispatch(final RestoreSnapshotAnalyzedStatement analysis) {
    final SettableFuture<Long> resultFuture = SettableFuture.create();

    boolean waitForCompletion = analysis.settings().getAsBoolean(WAIT_FOR_COMPLETION.settingName(), WAIT_FOR_COMPLETION.defaultValue());
    boolean ignoreUnavailable = analysis.settings().getAsBoolean(IGNORE_UNAVAILABLE.settingName(), IGNORE_UNAVAILABLE.defaultValue());

    // ignore_unavailable as set by statement
    IndicesOptions indicesOptions = IndicesOptions.fromOptions(ignoreUnavailable, true, true, false, IndicesOptions.lenientExpandOpen());

    RestoreSnapshotRequest request = new RestoreSnapshotRequest(analysis.repositoryName(), analysis.snapshotName())
            .indices(analysis.indices())
            .indicesOptions(indicesOptions)
            .settings(analysis.settings())
            .waitForCompletion(waitForCompletion)
            .includeGlobalState(false)
            .includeAliases(true);
    ActionListener<RestoreSnapshotResponse> listener = ActionListeners.wrap(resultFuture, Functions.constant(1L));
    transportActionProvider.transportRestoreSnapshotAction().execute(request, listener);
    return resultFuture;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:21,代码来源:SnapshotRestoreDDLDispatcher.java

示例2: prepareRequest

import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotRequest; //导入依赖的package包/类
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
    RestoreSnapshotRequest restoreSnapshotRequest = restoreSnapshotRequest(request.param("repository"), request.param("snapshot"));
    restoreSnapshotRequest.masterNodeTimeout(request.paramAsTime("master_timeout", restoreSnapshotRequest.masterNodeTimeout()));
    restoreSnapshotRequest.waitForCompletion(request.paramAsBoolean("wait_for_completion", false));
    request.applyContentParser(p -> restoreSnapshotRequest.source(p.mapOrdered()));
    return channel -> client.admin().cluster().restoreSnapshot(restoreSnapshotRequest, new RestToXContentListener<>(channel));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:9,代码来源:RestRestoreSnapshotAction.java

示例3: handleRequest

import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotRequest; //导入依赖的package包/类
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
    RestoreSnapshotRequest restoreSnapshotRequest = restoreSnapshotRequest(request.param("repository"), request.param("snapshot"));
    restoreSnapshotRequest.masterNodeTimeout(request.paramAsTime("master_timeout", restoreSnapshotRequest.masterNodeTimeout()));
    restoreSnapshotRequest.waitForCompletion(request.paramAsBoolean("wait_for_completion", false));
    restoreSnapshotRequest.source(request.content().toUtf8());
    client.admin().cluster().restoreSnapshot(restoreSnapshotRequest, new RestToXContentListener<RestoreSnapshotResponse>(channel));
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:9,代码来源:RestRestoreSnapshotAction.java

示例4: apply

import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotRequest; //导入依赖的package包/类
@Override
public void apply(final Task task, final String action,
        @SuppressWarnings("rawtypes") final ActionRequest request,
        @SuppressWarnings("rawtypes") final ActionListener listener,
        final ActionFilterChain chain) {
    if (!RestoreSnapshotAction.NAME.equals(action) || !clusterService.state().nodes().localNodeMaster()) {
        chain.proceed(task, action, request, listener);
    } else {
        final RestoreSnapshotRequest restoreSnapshotRequest = (RestoreSnapshotRequest) request;
        dictionaryRestoreService.restoreDictionarySnapshot(
                restoreSnapshotRequest.repository(), restoreSnapshotRequest.snapshot(),
                restoreSnapshotRequest.indices(), new ActionListener<Void>() {

                    @Override
                    public void onResponse(final Void response) {
                        chain.proceed(task, action, request, listener);
                    }

                    @Override
                    public void onFailure(final Throwable e) {
                        if (logger.isDebugEnabled()) {
                            logger.debug(
                                    "Failed to restore dictionaries for {} snapshot in {} repository.",
                                    e, restoreSnapshotRequest.repository(),
                                    restoreSnapshotRequest.snapshot());
                        }
                        listener.onFailure(e);
                    }
                });
    }
}
 
开发者ID:codelibs,项目名称:elasticsearch-dictionary,代码行数:32,代码来源:RestoreSnapshotActionFilter.java

示例5: restoreSnapshot

import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotRequest; //导入依赖的package包/类
@Override
public ActionFuture<RestoreSnapshotResponse> restoreSnapshot(RestoreSnapshotRequest request) {
    return execute(RestoreSnapshotAction.INSTANCE, request);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:AbstractClient.java

示例6: testRestoreSnapshotRequestParsing

import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotRequest; //导入依赖的package包/类
public void testRestoreSnapshotRequestParsing() throws IOException {
    RestoreSnapshotRequest request = new RestoreSnapshotRequest("test-repo", "test-snap");

    XContentBuilder builder = jsonBuilder().startObject();

    if(randomBoolean()) {
        builder.field("indices", "foo,bar,baz");
    } else {
        builder.startArray("indices");
        builder.value("foo");
        builder.value("bar");
        builder.value("baz");
        builder.endArray();
    }

    IndicesOptions indicesOptions = IndicesOptions.fromOptions(randomBoolean(), randomBoolean(), randomBoolean(), randomBoolean());
    if (indicesOptions.expandWildcardsClosed()) {
        if (indicesOptions.expandWildcardsOpen()) {
            builder.field("expand_wildcards", "all");
        } else {
            builder.field("expand_wildcards", "closed");
        }
    } else {
        if (indicesOptions.expandWildcardsOpen()) {
            builder.field("expand_wildcards", "open");
        } else {
            builder.field("expand_wildcards", "none");
        }
    }
    builder.field("allow_no_indices", indicesOptions.allowNoIndices());
    builder.field("rename_pattern", "rename-from");
    builder.field("rename_replacement", "rename-to");
    boolean partial = randomBoolean();
    builder.field("partial", partial);
    builder.startObject("settings").field("set1", "val1").endObject();
    builder.startObject("index_settings").field("set1", "val2").endObject();
    if (randomBoolean()) {
        builder.field("ignore_index_settings", "set2,set3");
    } else {
        builder.startArray("ignore_index_settings");
        builder.value("set2");
        builder.value("set3");
        builder.endArray();
    }

    BytesReference bytes = builder.endObject().bytes();

    request.source(XContentHelper.convertToMap(bytes, true, builder.contentType()).v2());

    assertEquals("test-repo", request.repository());
    assertEquals("test-snap", request.snapshot());
    assertArrayEquals(request.indices(), new String[]{"foo", "bar", "baz"});
    assertEquals("rename-from", request.renamePattern());
    assertEquals("rename-to", request.renameReplacement());
    assertEquals(partial, request.partial());
    assertEquals("val1", request.settings().get("set1"));
    assertArrayEquals(request.ignoreIndexSettings(), new String[]{"set2", "set3"});

}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:60,代码来源:SnapshotRequestsTests.java

示例7: testRestoreSnapshotRequestDescrptions

import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotRequest; //导入依赖的package包/类
public void testRestoreSnapshotRequestDescrptions() {
    RestoreSnapshotRequest restoreSnapshotRequest = new RestoreSnapshotRequest();
    restoreSnapshotRequest.snapshot("snapshot_name");
    restoreSnapshotRequest.repository("repo_name");
    assertEquals("snapshot [repo_name:snapshot_name]", restoreSnapshotRequest.getDescription());
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:7,代码来源:SnapshotTests.java

示例8: restoreSnapshot

import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotRequest; //导入依赖的package包/类
/**
 * Restores a snapshot.
 */
ActionFuture<RestoreSnapshotResponse> restoreSnapshot(RestoreSnapshotRequest request);
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:ClusterAdminClient.java

示例9: restoreSnapshotRequest

import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotRequest; //导入依赖的package包/类
/**
 * Restores new snapshot
 *
 * @param repository repository name
 * @param snapshot   snapshot name
 * @return snapshot creation request
 */
public static RestoreSnapshotRequest restoreSnapshotRequest(String repository, String snapshot) {
    return new RestoreSnapshotRequest(repository, snapshot);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:11,代码来源:Requests.java


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