use of com.amazonaws.services.s3.model.ListObjectsV2Result in project alluxio by Alluxio.
the class S3AUnderFileSystem method getObjectListingChunk.
@Override
protected ObjectListingChunk getObjectListingChunk(String key, boolean recursive) throws IOException {
String delimiter = recursive ? "" : PATH_SEPARATOR;
key = PathUtils.normalizePath(key, PATH_SEPARATOR);
// In case key is root (empty string) do not normalize prefix
key = key.equals(PATH_SEPARATOR) ? "" : key;
ListObjectsV2Request request = new ListObjectsV2Request().withBucketName(mBucketName).withPrefix(key).withDelimiter(delimiter).withMaxKeys(getListingChunkLength());
ListObjectsV2Result result = getObjectListingChunk(request);
if (result != null) {
return new S3AObjectListingChunk(request, result);
}
return null;
}
use of com.amazonaws.services.s3.model.ListObjectsV2Result in project alluxio by Alluxio.
the class S3AUnderFileSystem method getObjectListingChunk.
// Get next chunk of listing result
private ListObjectsV2Result getObjectListingChunk(ListObjectsV2Request request) {
ListObjectsV2Result result;
try {
// Query S3 for the next batch of objects
result = mClient.listObjectsV2(request);
// Advance the request continuation token to the next set of objects
request.setContinuationToken(result.getNextContinuationToken());
} catch (AmazonClientException e) {
LOG.error("Failed to list path {}", request.getPrefix(), e);
result = null;
}
return result;
}
Aggregations