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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations