use of com.google.api.client.googleapis.batch.BatchRequest in project beam by apache.
the class GcsUtil method makeRemoveBatches.
List<BatchRequest> makeRemoveBatches(Collection<String> filenames) throws IOException {
List<BatchRequest> batches = new LinkedList<>();
for (List<String> filesToDelete : Lists.partition(Lists.newArrayList(filenames), MAX_REQUESTS_PER_BATCH)) {
BatchRequest batch = createBatchRequest();
for (String file : filesToDelete) {
enqueueDelete(GcsPath.fromUri(file), batch);
}
batches.add(batch);
}
return batches;
}
Aggregations