use of org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequest in project crate by crate.
the class SnapshotRestoreDDLDispatcher method dispatch.
public CompletableFuture<Long> dispatch(final DropSnapshotAnalyzedStatement statement) {
final CompletableFuture<Long> future = new CompletableFuture<>();
final String repositoryName = statement.repository();
final String snapshotName = statement.snapshot();
transportActionProvider.transportDeleteSnapshotAction().execute(new DeleteSnapshotRequest(repositoryName, snapshotName), new ActionListener<DeleteSnapshotResponse>() {
@Override
public void onResponse(DeleteSnapshotResponse response) {
if (!response.isAcknowledged()) {
LOGGER.info("delete snapshot '{}.{}' not acknowledged", repositoryName, snapshotName);
}
future.complete(1L);
}
@Override
public void onFailure(Throwable e) {
future.completeExceptionally(e);
}
});
return future;
}
use of org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequest in project elasticsearch by elastic.
the class RestDeleteSnapshotAction method prepareRequest.
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
DeleteSnapshotRequest deleteSnapshotRequest = deleteSnapshotRequest(request.param("repository"), request.param("snapshot"));
deleteSnapshotRequest.masterNodeTimeout(request.paramAsTime("master_timeout", deleteSnapshotRequest.masterNodeTimeout()));
return channel -> client.admin().cluster().deleteSnapshot(deleteSnapshotRequest, new AcknowledgedRestListener<>(channel));
}
use of org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequest in project crate by crate.
the class DropSnapshotPlan method executeOrFail.
@Override
public void executeOrFail(DependencyCarrier dependencies, PlannerContext plannerContext, RowConsumer consumer, Row parameters, SubQueryResults subQueryResult) {
DeleteSnapshotRequest request = new DeleteSnapshotRequest(dropSnapshot.repository(), dropSnapshot.snapshot());
var transportDeleteSnapshotAction = dependencies.transportActionProvider().transportDeleteSnapshotAction();
transportDeleteSnapshotAction.execute(request, new OneRowActionListener<>(consumer, response -> {
if (!response.isAcknowledged()) {
LOGGER.info("delete snapshot '{}.{}' not acknowledged", request.repository(), request.snapshot());
}
return new Row1(1L);
}));
}
Aggregations