Search in sources :

Example 1 with FutureActionListener

use of io.crate.action.FutureActionListener in project crate by crate.

the class BlobAdminClient method alterBlobTable.

/**
     * can be used to alter the number of replicas.
     *
     * @param tableName     name of the blob table
     * @param indexSettings updated index settings
     */
public CompletableFuture<Void> alterBlobTable(String tableName, Settings indexSettings) {
    FutureActionListener<UpdateSettingsResponse, Void> listener = new FutureActionListener<>(Functions.<Void>constant(null));
    updateSettingsAction.execute(new UpdateSettingsRequest(indexSettings, fullIndexName(tableName)), listener);
    return listener;
}
Also used : UpdateSettingsResponse(org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsResponse) UpdateSettingsRequest(org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequest) FutureActionListener(io.crate.action.FutureActionListener)

Example 2 with FutureActionListener

use of io.crate.action.FutureActionListener in project crate by crate.

the class BlobAdminClient method dropBlobTable.

public CompletableFuture<Void> dropBlobTable(final String tableName) {
    FutureActionListener<DeleteIndexResponse, Void> listener = new FutureActionListener<>(Functions.<Void>constant(null));
    deleteIndexAction.execute(new DeleteIndexRequest(fullIndexName(tableName)), listener);
    return listener;
}
Also used : DeleteIndexResponse(org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse) DeleteIndexRequest(org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest) FutureActionListener(io.crate.action.FutureActionListener)

Example 3 with FutureActionListener

use of io.crate.action.FutureActionListener in project crate by crate.

the class AlterTableOperation method updateSettings.

private CompletableFuture<Long> updateSettings(TableParameter concreteTableParameter, String... indices) {
    if (concreteTableParameter.settings().getAsMap().isEmpty() || indices.length == 0) {
        return CompletableFuture.completedFuture(null);
    }
    UpdateSettingsRequest request = new UpdateSettingsRequest(concreteTableParameter.settings(), indices);
    request.indicesOptions(IndicesOptions.lenientExpandOpen());
    FutureActionListener<UpdateSettingsResponse, Long> listener = new FutureActionListener<>(LONG_NULL_FUNCTION);
    transportActionProvider.transportUpdateSettingsAction().execute(request, listener);
    return listener;
}
Also used : UpdateSettingsResponse(org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsResponse) UpdateSettingsRequest(org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequest) FutureActionListener(io.crate.action.FutureActionListener)

Example 4 with FutureActionListener

use of io.crate.action.FutureActionListener in project crate by crate.

the class DDLStatementDispatcher method executeMergeSegments.

private static CompletableFuture<Long> executeMergeSegments(OptimizeTableAnalyzedStatement analysis, TransportForceMergeAction transportForceMergeAction) {
    ForceMergeRequest request = new ForceMergeRequest(analysis.indexNames().toArray(new String[0]));
    // Pass parameters to ES request
    request.maxNumSegments(analysis.settings().getAsInt(OptimizeSettings.MAX_NUM_SEGMENTS.name(), ForceMergeRequest.Defaults.MAX_NUM_SEGMENTS));
    request.onlyExpungeDeletes(analysis.settings().getAsBoolean(OptimizeSettings.ONLY_EXPUNGE_DELETES.name(), ForceMergeRequest.Defaults.ONLY_EXPUNGE_DELETES));
    request.flush(analysis.settings().getAsBoolean(OptimizeSettings.FLUSH.name(), ForceMergeRequest.Defaults.FLUSH));
    request.indicesOptions(IndicesOptions.lenientExpandOpen());
    FutureActionListener<ForceMergeResponse, Long> listener = new FutureActionListener<>(Functions.constant((long) analysis.indexNames().size()));
    transportForceMergeAction.execute(request, listener);
    return listener;
}
Also used : ForceMergeRequest(org.elasticsearch.action.admin.indices.forcemerge.ForceMergeRequest) ForceMergeResponse(org.elasticsearch.action.admin.indices.forcemerge.ForceMergeResponse) FutureActionListener(io.crate.action.FutureActionListener)

Example 5 with FutureActionListener

use of io.crate.action.FutureActionListener in project crate by crate.

the class DDLStatementDispatcher method executeUpgradeSegments.

private static CompletableFuture<Long> executeUpgradeSegments(OptimizeTableAnalyzedStatement analysis, TransportUpgradeAction transportUpgradeAction) {
    UpgradeRequest request = new UpgradeRequest(analysis.indexNames().toArray(new String[0]));
    FutureActionListener<UpgradeResponse, Long> listener = new FutureActionListener<>(Functions.constant((long) analysis.indexNames().size()));
    transportUpgradeAction.execute(request, listener);
    return listener;
}
Also used : UpgradeResponse(org.elasticsearch.action.admin.indices.upgrade.post.UpgradeResponse) UpgradeRequest(org.elasticsearch.action.admin.indices.upgrade.post.UpgradeRequest) FutureActionListener(io.crate.action.FutureActionListener)

Aggregations

FutureActionListener (io.crate.action.FutureActionListener)9 UpdateSettingsRequest (org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequest)2 UpdateSettingsResponse (org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsResponse)2 AliasMetaData (org.elasticsearch.cluster.metadata.AliasMetaData)2 IndexTemplateMetaData (org.elasticsearch.cluster.metadata.IndexTemplateMetaData)2 IntObjectMap (com.carrotsearch.hppc.IntObjectMap)1 ImmutableList (com.google.common.collect.ImmutableList)1 Bucket (io.crate.data.Bucket)1 NodeFetchRequest (io.crate.executor.transport.NodeFetchRequest)1 NodeFetchResponse (io.crate.executor.transport.NodeFetchResponse)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 RestoreSnapshotRequest (org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotRequest)1 RestoreSnapshotResponse (org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse)1 Alias (org.elasticsearch.action.admin.indices.alias.Alias)1 DeleteIndexRequest (org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest)1 DeleteIndexResponse (org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse)1 ForceMergeRequest (org.elasticsearch.action.admin.indices.forcemerge.ForceMergeRequest)1 ForceMergeResponse (org.elasticsearch.action.admin.indices.forcemerge.ForceMergeResponse)1