Package org.apache.flink.fs.gs.utils
Class BlobUtils
java.lang.Object
org.apache.flink.fs.gs.utils.BlobUtils
Utility functions related to blobs.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe maximum number of blobs that can be composed in a single operation. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic GSBlobIdentifiergetTemporaryBlobIdentifier(GSBlobIdentifier finalBlobIdentifier, UUID temporaryObjectId, GSFileSystemOptions options) Resolves a temporary blob identifier for a provided temporary object id and the provided options.static StringgetTemporaryBucketName(GSBlobIdentifier finalBlobIdentifier, GSFileSystemOptions options) Returns the temporary bucket name.static StringgetTemporaryObjectName(GSBlobIdentifier finalBlobIdentifier, UUID temporaryObjectId) Returns a temporary object name, formed by appending the temporary object id to the temporary object partial name, i.e. .inprogress/foo/bar/abc for the final blob with object name "foo/bar" and temporary object id "abc".static StringgetTemporaryObjectNameWithEntropy(GSBlobIdentifier finalBlobIdentifier, UUID temporaryObjectId) Returns a temporary object name with entropy, formed by adding the temporary object id to the temporary object partial name in both start and end of path, i.e. abc.inprogress/foo/bar/abc for the final blob with object name "foo/bar" and temporary object id "abc".static StringgetTemporaryObjectPartialName(GSBlobIdentifier finalBlobIdentifier) Returns a temporary object partial name, i.e. .inprogress/foo/bar/ for the final blob with object name "foo/bar".static GSBlobIdentifierParses a blob id from a Google storage uri, i.e. gs://bucket/foo/bar yields a blob with bucket name "bucket" and object name "foo/bar".
-
Field Details
-
COMPOSE_MAX_BLOBS
public static final int COMPOSE_MAX_BLOBSThe maximum number of blobs that can be composed in a single operation.- See Also:
-
-
Constructor Details
-
BlobUtils
public BlobUtils()
-
-
Method Details
-
parseUri
Parses a blob id from a Google storage uri, i.e. gs://bucket/foo/bar yields a blob with bucket name "bucket" and object name "foo/bar".- Parameters:
uri- The gs uri- Returns:
- The blob id
-
getTemporaryBucketName
public static String getTemporaryBucketName(GSBlobIdentifier finalBlobIdentifier, GSFileSystemOptions options) Returns the temporary bucket name. If options specifies a temporary bucket name, we use that one; otherwise, we use the bucket name of the final blob.- Parameters:
finalBlobIdentifier- The final blob identifieroptions- The file system options- Returns:
- The temporary bucket name
-
getTemporaryObjectPartialName
Returns a temporary object partial name, i.e. .inprogress/foo/bar/ for the final blob with object name "foo/bar". The included trailing slash is deliberate, so that we can be sure that object names that start with this partial name are, in fact, temporary files associated with the upload of the associated final blob.- Parameters:
finalBlobIdentifier- The final blob identifier- Returns:
- The temporary object partial name
-
getTemporaryObjectName
public static String getTemporaryObjectName(GSBlobIdentifier finalBlobIdentifier, UUID temporaryObjectId) Returns a temporary object name, formed by appending the temporary object id to the temporary object partial name, i.e. .inprogress/foo/bar/abc for the final blob with object name "foo/bar" and temporary object id "abc".- Parameters:
finalBlobIdentifier- The final blob identifiertemporaryObjectId- The temporary object id- Returns:
- The temporary object name
-
getTemporaryObjectNameWithEntropy
public static String getTemporaryObjectNameWithEntropy(GSBlobIdentifier finalBlobIdentifier, UUID temporaryObjectId) Returns a temporary object name with entropy, formed by adding the temporary object id to the temporary object partial name in both start and end of path, i.e. abc.inprogress/foo/bar/abc for the final blob with object name "foo/bar" and temporary object id "abc".- Parameters:
finalBlobIdentifier- The final blob identifiertemporaryObjectId- The temporary object id- Returns:
- The temporary object name with entropy
-
getTemporaryBlobIdentifier
public static GSBlobIdentifier getTemporaryBlobIdentifier(GSBlobIdentifier finalBlobIdentifier, UUID temporaryObjectId, GSFileSystemOptions options) Resolves a temporary blob identifier for a provided temporary object id and the provided options.- Parameters:
finalBlobIdentifier- The final blob identifiertemporaryObjectId- The temporary object idoptions- The file system options- Returns:
- The blob identifier
-