Search in sources :

Example 1 with OneRowActionListener

use of io.crate.executor.transport.OneRowActionListener in project crate by crate.

the class ESClusterUpdateSettingsTask method execute.

@Override
public void execute(BatchConsumer consumer, Row parameters) {
    ClusterUpdateSettingsRequest request = buildESUpdateClusterSettingRequest(buildSettingsFrom(plan.persistentSettings(), parameters), buildSettingsFrom(plan.transientSettings(), parameters));
    OneRowActionListener<ClusterUpdateSettingsResponse> actionListener = new OneRowActionListener<>(consumer, TO_ONE_ROW);
    transport.execute(request, actionListener);
}
Also used : OneRowActionListener(io.crate.executor.transport.OneRowActionListener) ClusterUpdateSettingsResponse(org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse) ClusterUpdateSettingsRequest(org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest)

Example 2 with OneRowActionListener

use of io.crate.executor.transport.OneRowActionListener in project crate by crate.

the class CreateAnalyzerTask method execute.

@Override
public void execute(BatchConsumer consumer, Row parameters) {
    ClusterUpdateSettingsRequest request = new ClusterUpdateSettingsRequest();
    request.persistentSettings(plan.createAnalyzerSettings());
    OneRowActionListener<ClusterUpdateSettingsResponse> actionListener = new OneRowActionListener<>(consumer, TO_ONE_ROW);
    transport.execute(request, actionListener);
}
Also used : OneRowActionListener(io.crate.executor.transport.OneRowActionListener) ClusterUpdateSettingsResponse(org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse) ClusterUpdateSettingsRequest(org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest)

Example 3 with OneRowActionListener

use of io.crate.executor.transport.OneRowActionListener in project crate by crate.

the class DDLTask method execute.

@Override
public void execute(final BatchConsumer consumer, Row parameters) {
    CompletableFuture<Long> future = ddlStatementDispatcher.dispatch(analyzedStatement, jobId());
    OneRowActionListener<Long> responseOneRowActionListener = new OneRowActionListener<>(consumer, new Function<Long, Row>() {

        @Nullable
        @Override
        public Row apply(@Nullable Long input) {
            return new Row1(input == null ? -1 : input);
        }
    });
    future.whenComplete(responseOneRowActionListener);
}
Also used : Row1(io.crate.data.Row1) OneRowActionListener(io.crate.executor.transport.OneRowActionListener) Row(io.crate.data.Row) Nullable(javax.annotation.Nullable)

Aggregations

OneRowActionListener (io.crate.executor.transport.OneRowActionListener)3 ClusterUpdateSettingsRequest (org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest)2 ClusterUpdateSettingsResponse (org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse)2 Row (io.crate.data.Row)1 Row1 (io.crate.data.Row1)1 Nullable (javax.annotation.Nullable)1