@ThreadSafe public class GCSUnderFileSystem extends ObjectUnderFileSystem
UnderFileSystem
implementation based on the jets3t library.ObjectUnderFileSystem.DeleteBuffer, ObjectUnderFileSystem.ObjectListingChunk, ObjectUnderFileSystem.ObjectPermissions, ObjectUnderFileSystem.ObjectStatus, ObjectUnderFileSystem.ObjectStoreOperation<T>, ObjectUnderFileSystem.OperationBuffer<T>, ObjectUnderFileSystem.RenameBuffer
UnderFileSystem.Factory, UnderFileSystem.SpaceType
mExecutorService, mRootKeySupplier, PATH_SEPARATOR, PATH_SEPARATOR_CHAR
EMPTY_ACL, mUfsConf, mUri
Modifier | Constructor and Description |
---|---|
protected |
GCSUnderFileSystem(AlluxioURI uri,
org.jets3t.service.impl.rest.httpclient.GoogleStorageService googleStorageService,
String bucketName,
UnderFileSystemConfiguration conf)
Constructor for
GCSUnderFileSystem . |
Modifier and Type | Method and Description |
---|---|
protected boolean |
copyObject(String src,
String dst)
Copies an object to another key.
|
boolean |
createEmptyObject(String key)
Creates a zero-byte object used to encode a directory.
|
static GCSUnderFileSystem |
createInstance(AlluxioURI uri,
UnderFileSystemConfiguration conf)
Constructs a new instance of
GCSUnderFileSystem . |
protected OutputStream |
createObject(String key)
Creates an
OutputStream for object uploads. |
protected boolean |
deleteObject(String key)
Internal function to delete a key.
|
UfsDirectoryStatus |
getExistingDirectoryStatus(String path)
Gets the directory status.
|
protected String |
getFolderSuffix()
Get suffix used to encode a directory.
|
protected ObjectUnderFileSystem.ObjectListingChunk |
getObjectListingChunk(String key,
boolean recursive)
Gets a (partial) object listing result for the given key.
|
protected ObjectUnderFileSystem.ObjectStatus |
getObjectStatus(String key)
Get metadata information about object.
|
protected ObjectUnderFileSystem.ObjectPermissions |
getPermissions()
Permissions for the mounted bucket.
|
protected String |
getRootKey()
Get full path of root in object store.
|
String |
getUnderFSType()
Returns the name of the under filesystem implementation.
|
InputStream |
openExistingFile(String path)
Opens an
InputStream for a file in under filesystem at the indicated path. |
InputStream |
openExistingFile(String path,
OpenOptions options)
Opens an
InputStream for a file in under filesystem at the indicated path. |
protected InputStream |
openObject(String key,
OpenOptions options,
RetryPolicy retryPolicy)
Internal function to open an input stream to an object.
|
void |
setMode(String path,
short mode)
Changes posix file mode.
|
void |
setOwner(String path,
String user,
String group)
Sets the user and group of the given path.
|
cleanup, close, connectFromMaster, connectFromWorker, convertToFolderName, create, createNonexistingFile, createNonexistingFile, deleteDirectory, deleteExistingDirectory, deleteExistingDirectory, deleteExistingFile, deleteFile, deleteObjects, getBlockSizeByte, getChildName, getDirectoryStatus, getExistingFileStatus, getExistingStatus, getFileLocations, getFileLocations, getFileStatus, getListingChunkLength, getListingChunkLengthMax, getObjectListingChunkForPath, getParentPath, getSpace, getStatus, isDirectory, isExistingDirectory, isFile, isObjectStorage, isRoot, listInternal, listStatus, listStatus, mkdirs, mkdirsInternal, open, parentExists, renameDirectory, renameFile, renameRenamableDirectory, renameRenamableFile, retryOnException, stripPrefixIfPresent, supportsFlush
create, deleteDirectory, exists, getAclPair, getActiveSyncInfo, getConfiguration, getFingerprint, getOperationMode, getParsedFingerprint, getParsedFingerprint, getPhysicalStores, isSeekable, mkdirs, open, resolveUri, setAclEntries, startActiveSyncPolling, startSync, stopActiveSyncPolling, stopSync, supportsActiveSync, validatePath
protected GCSUnderFileSystem(AlluxioURI uri, org.jets3t.service.impl.rest.httpclient.GoogleStorageService googleStorageService, String bucketName, UnderFileSystemConfiguration conf)
GCSUnderFileSystem
.uri
- the AlluxioURI
for this UFSgoogleStorageService
- the Jets3t GCS clientbucketName
- bucket name of user's configured Alluxio bucketconf
- configuration for this UFSpublic static GCSUnderFileSystem createInstance(AlluxioURI uri, UnderFileSystemConfiguration conf) throws org.jets3t.service.ServiceException
GCSUnderFileSystem
.uri
- the AlluxioURI
for this UFSconf
- the configuration for this UFSGCSUnderFileSystem
instanceorg.jets3t.service.ServiceException
- when a connection to GCS could not be createdpublic String getUnderFSType()
UnderFileSystem
public void setOwner(String path, String user, String group)
UnderFileSystem
path
- the path of the fileuser
- the new owner to set, unchanged if nullgroup
- the new group to set, unchanged if nullpublic void setMode(String path, short mode) throws IOException
UnderFileSystem
path
- the path of the filemode
- the mode to set in short format, e.g. 0777IOException
public UfsDirectoryStatus getExistingDirectoryStatus(String path) throws IOException
UnderFileSystem
UnderFileSystem.getDirectoryStatus(String)
but
deals with the write-then-get-status eventual consistency issue.getExistingDirectoryStatus
in interface UnderFileSystem
getExistingDirectoryStatus
in class ObjectUnderFileSystem
path
- the path to the directoryIOException
public InputStream openExistingFile(String path) throws IOException
UnderFileSystem
InputStream
for a file in under filesystem at the indicated path.
Similar to UnderFileSystem.open(String)
but
deals with the write-then-read eventual consistency issue.openExistingFile
in interface UnderFileSystem
openExistingFile
in class ObjectUnderFileSystem
path
- the file nameInputStream
objectIOException
public InputStream openExistingFile(String path, OpenOptions options) throws IOException
UnderFileSystem
InputStream
for a file in under filesystem at the indicated path.
Similar to UnderFileSystem.open(String, OpenOptions)
but
deals with the write-then-read eventual consistency issue.openExistingFile
in interface UnderFileSystem
openExistingFile
in class ObjectUnderFileSystem
path
- the file nameoptions
- to open input streamInputStream
objectIOException
protected boolean copyObject(String src, String dst)
ObjectUnderFileSystem
copyObject
in class ObjectUnderFileSystem
src
- the source key to copydst
- the destination key to copy topublic boolean createEmptyObject(String key)
ObjectUnderFileSystem
createEmptyObject
in class ObjectUnderFileSystem
key
- the key to createprotected OutputStream createObject(String key) throws IOException
ObjectUnderFileSystem
OutputStream
for object uploads.createObject
in class ObjectUnderFileSystem
key
- ufs key including scheme and bucketIOException
protected boolean deleteObject(String key) throws IOException
ObjectUnderFileSystem
deleteObject
in class ObjectUnderFileSystem
key
- the key to deleteIOException
protected String getFolderSuffix()
ObjectUnderFileSystem
getFolderSuffix
in class ObjectUnderFileSystem
protected ObjectUnderFileSystem.ObjectListingChunk getObjectListingChunk(String key, boolean recursive) throws IOException
ObjectUnderFileSystem
getObjectListingChunk
in class ObjectUnderFileSystem
key
- pseudo-directory key excluding header and bucketrecursive
- whether to request immediate children only, or all descendantsIOException
protected ObjectUnderFileSystem.ObjectStatus getObjectStatus(String key) throws IOException
ObjectUnderFileSystem
getObjectStatus
in class ObjectUnderFileSystem
key
- ufs key to get metadata forObjectUnderFileSystem.ObjectStatus
if key exists and successful, otherwise nullIOException
protected ObjectUnderFileSystem.ObjectPermissions getPermissions()
ObjectUnderFileSystem
getPermissions
in class ObjectUnderFileSystem
protected String getRootKey()
ObjectUnderFileSystem
getRootKey
in class ObjectUnderFileSystem
protected InputStream openObject(String key, OpenOptions options, RetryPolicy retryPolicy)
ObjectUnderFileSystem
openObject
in class ObjectUnderFileSystem
key
- the key to openoptions
- the open optionsretryPolicy
- the retry policy of the opened stream to solve eventual consistency issueInputStream
to read from keyCopyright © 2023. All Rights Reserved.