public final class S3RestUtils extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
S3RestUtils.RestCallable<T>
An interface representing a callable.
|
static class |
S3RestUtils.URIStatusNameComparator
Comparator based on uri nameļ¼ treat uri name as a Long number.
|
Modifier and Type | Field and Description |
---|---|
static String |
BUCKET_SEPARATOR
Bucket must be a directory directly under a mount point.
|
Modifier and Type | Method and Description |
---|---|
static <T> javax.ws.rs.core.Response |
call(String resource,
S3RestUtils.RestCallable<T> callable)
Calls the given
S3RestUtils.RestCallable and handles any exceptions thrown. |
static void |
checkPathIsAlluxioDirectory(FileSystem fs,
String bucketPath)
Check if a path in alluxio is a directory.
|
static void |
checkUploadId(FileSystem fs,
AlluxioURI multipartTemporaryDir,
long uploadId)
Check if uploadId equals directory id.
|
static String |
getMultipartTemporaryDirForObject(String bucketPath,
String objectKey) |
static WritePType |
getS3WriteType() |
static String |
parsePath(String bucketPath)
Format bucket path.
|
static String |
quoteETag(String etag) |
static S3Exception |
toBucketS3Exception(Exception exception,
String resource)
Convert an exception to instance of
S3Exception . |
static S3Exception |
toObjectS3Exception(Exception exception,
String resource)
Convert an exception to instance of
S3Exception . |
static String |
toS3Date(long epoch) |
public static final String BUCKET_SEPARATOR
public static <T> javax.ws.rs.core.Response call(String resource, S3RestUtils.RestCallable<T> callable)
S3RestUtils.RestCallable
and handles any exceptions thrown.T
- the return type of the callableresource
- the resource (bucket or object) to be operated oncallable
- the callable to callpublic static String getMultipartTemporaryDirForObject(String bucketPath, String objectKey)
bucketPath
- the bucket path like "/bucket", "/mount/point/bucket"objectKey
- the object key like "img/2017/9/1/s3.jpg"public static String toS3Date(long epoch)
epoch
- the milliseconds from the epochpublic static String quoteETag(String etag)
etag
- the entity tag to be used in the ETag field in the HTTP headerpublic static String parsePath(String bucketPath) throws S3Exception
bucketPath
- bucket pathS3Exception
public static S3Exception toBucketS3Exception(Exception exception, String resource)
S3Exception
.exception
- Exception thrown when process s3 object rest requestresource
- complete bucket pathS3Exception
public static S3Exception toObjectS3Exception(Exception exception, String resource)
S3Exception
.exception
- Exception thrown when process s3 object rest requestresource
- object complete pathS3Exception
public static void checkPathIsAlluxioDirectory(FileSystem fs, String bucketPath) throws S3Exception
fs
- instance of FileSystem
bucketPath
- bucket complete pathS3Exception
public static void checkUploadId(FileSystem fs, AlluxioURI multipartTemporaryDir, long uploadId) throws S3Exception
fs
- instance of FileSystem
multipartTemporaryDir
- multipart upload tmp directoryuploadId
- multipart upload IdS3Exception
public static WritePType getS3WriteType()
Copyright © 2023. All Rights Reserved.