Package io.trino.hdfs.s3
Class TrinoS3FileSystem
java.lang.Object
org.apache.hadoop.conf.Configured
org.apache.hadoop.fs.FileSystem
io.trino.hdfs.s3.TrinoS3FileSystem
- All Implemented Interfaces:
FileSystemWithBatchDelete,MemoryAwareFileSystem,OpenTelemetryAwareFileSystem,Closeable,AutoCloseable,org.apache.hadoop.conf.Configurable,org.apache.hadoop.fs.PathCapabilities,org.apache.hadoop.security.token.DelegationTokenIssuer
- Direct Known Subclasses:
TrinoCosFileSystem
public class TrinoS3FileSystem
extends org.apache.hadoop.fs.FileSystem
implements FileSystemWithBatchDelete, MemoryAwareFileSystem, OpenTelemetryAwareFileSystem
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThis exception is for stopping retries for S3 calls that shouldn't be retried.Nested classes/interfaces inherited from class org.apache.hadoop.fs.FileSystem
org.apache.hadoop.fs.FileSystem.DirectoryEntries, org.apache.hadoop.fs.FileSystem.DirListingIterator<T extends org.apache.hadoop.fs.FileStatus>, org.apache.hadoop.fs.FileSystem.Statistics -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from class org.apache.hadoop.fs.FileSystem
DEFAULT_FS, FS_DEFAULT_NAME_KEY, LOG, SHUTDOWN_HOOK_PRIORITY, statistics, TRASH_PREFIX, USER_HOME_PREFIX -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.hadoop.fs.FSDataOutputStreamappend(org.apache.hadoop.fs.Path f, int bufferSize, org.apache.hadoop.util.Progressable progress) voidclose()org.apache.hadoop.fs.FSDataOutputStreamcreate(org.apache.hadoop.fs.Path path, AggregatedMemoryContext aggregatedMemoryContext) org.apache.hadoop.fs.FSDataOutputStreamcreate(org.apache.hadoop.fs.Path path, org.apache.hadoop.fs.permission.FsPermission permission, boolean overwrite, int bufferSize, short replication, long blockSize, org.apache.hadoop.util.Progressable progress) booleandelete(org.apache.hadoop.fs.Path path, boolean recursive) voiddeleteFiles(Collection<org.apache.hadoop.fs.Path> paths) static StringextractBucketName(URI uri) Helper function used to work around the fact that if you use an S3 bucket with an '_' that java.net.URI behaves differently and sets the host value to null whereas S3 buckets without '_' have a properly set host field.protected StringgetBucketName(URI uri) org.apache.hadoop.fs.FileStatusgetFileStatus(org.apache.hadoop.fs.Path path) static TrinoS3FileSystemStatscom.amazonaws.services.s3.AmazonS3getUri()org.apache.hadoop.fs.Pathvoidinitialize(URI uri, org.apache.hadoop.conf.Configuration conf) static StringkeyFromPath(org.apache.hadoop.fs.Path path) org.apache.hadoop.fs.RemoteIterator<org.apache.hadoop.fs.LocatedFileStatus>listFiles(org.apache.hadoop.fs.Path path, boolean recursive) org.apache.hadoop.fs.RemoteIterator<org.apache.hadoop.fs.LocatedFileStatus>listLocatedStatus(org.apache.hadoop.fs.Path path) org.apache.hadoop.fs.FileStatus[]listStatus(org.apache.hadoop.fs.Path path) booleanmkdirs(org.apache.hadoop.fs.Path f, org.apache.hadoop.fs.permission.FsPermission permission) org.apache.hadoop.fs.FSDataInputStreamopen(org.apache.hadoop.fs.Path path, int bufferSize) booleanrename(org.apache.hadoop.fs.Path src, org.apache.hadoop.fs.Path dst) voidsetOpenTelemetry(io.opentelemetry.api.OpenTelemetry openTelemetry) voidsetWorkingDirectory(org.apache.hadoop.fs.Path path) Methods inherited from class org.apache.hadoop.fs.FileSystem
access, append, append, appendFile, areSymlinksEnabled, cancelDeleteOnExit, canonicalizeUri, checkPath, clearStatistics, closeAll, closeAllForUGI, completeLocalOutput, concat, copyFromLocalFile, copyFromLocalFile, copyFromLocalFile, copyFromLocalFile, copyToLocalFile, copyToLocalFile, copyToLocalFile, create, create, create, create, create, create, create, create, create, create, create, create, createDataInputStreamBuilder, createDataInputStreamBuilder, createDataOutputStreamBuilder, createFile, createMultipartUploader, createNewFile, createNonRecursive, createNonRecursive, createNonRecursive, createPathHandle, createSnapshot, createSnapshot, createSymlink, delete, deleteOnExit, deleteSnapshot, enableSymlinks, exists, fixRelativePart, get, get, get, getAclStatus, getAdditionalTokenIssuers, getAllStatistics, getAllStoragePolicies, getBlockSize, getCanonicalServiceName, getCanonicalUri, getChildFileSystems, getContentSummary, getDefaultBlockSize, getDefaultBlockSize, getDefaultPort, getDefaultReplication, getDefaultReplication, getDefaultUri, getDelegationToken, getFileBlockLocations, getFileBlockLocations, getFileChecksum, getFileChecksum, getFileLinkStatus, getFileSystemClass, getFSofPath, getGlobalStorageStatistics, getHomeDirectory, getInitialWorkingDirectory, getLength, getLinkTarget, getLocal, getName, getNamed, getPathHandle, getQuotaUsage, getReplication, getServerDefaults, getServerDefaults, getStatistics, getStatistics, getStatus, getStatus, getStoragePolicy, getStorageStatistics, getTrashRoot, getTrashRoots, getUsed, getUsed, getXAttr, getXAttrs, getXAttrs, globStatus, globStatus, hasPathCapability, isDirectory, isFile, listCorruptFileBlocks, listLocatedStatus, listStatus, listStatus, listStatus, listStatusBatch, listStatusIterator, listXAttrs, makeQualified, mkdirs, mkdirs, modifyAclEntries, moveFromLocalFile, moveFromLocalFile, moveToLocalFile, msync, newInstance, newInstance, newInstance, newInstanceLocal, open, open, open, openFile, openFile, openFileWithOptions, openFileWithOptions, primitiveCreate, primitiveMkdir, primitiveMkdir, printStatistics, processDeleteOnExit, removeAcl, removeAclEntries, removeDefaultAcl, removeXAttr, rename, renameSnapshot, resolveLink, resolvePath, satisfyStoragePolicy, setAcl, setDefaultUri, setDefaultUri, setOwner, setPermission, setQuota, setQuotaByStorageType, setReplication, setStoragePolicy, setTimes, setVerifyChecksum, setWriteChecksum, setXAttr, setXAttr, startLocalOutput, supportsSymlinks, truncate, unsetStoragePolicyMethods inherited from class org.apache.hadoop.conf.Configured
getConf, setConfMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.security.token.DelegationTokenIssuer
addDelegationTokens
-
Field Details
-
S3_USER_AGENT_PREFIX
- See Also:
-
S3_CREDENTIALS_PROVIDER
- See Also:
-
S3_SSE_TYPE
- See Also:
-
S3_SSE_ENABLED
- See Also:
-
S3_SSE_KMS_KEY_ID
- See Also:
-
S3_KMS_KEY_ID
- See Also:
-
S3_ENCRYPTION_MATERIALS_PROVIDER
- See Also:
-
S3_PIN_CLIENT_TO_CURRENT_REGION
- See Also:
-
S3_MULTIPART_MIN_PART_SIZE
- See Also:
-
S3_MULTIPART_MIN_FILE_SIZE
- See Also:
-
S3_STAGING_DIRECTORY
- See Also:
-
S3_MAX_CONNECTIONS
- See Also:
-
S3_SOCKET_TIMEOUT
- See Also:
-
S3_CONNECT_TIMEOUT
- See Also:
-
S3_CONNECT_TTL
- See Also:
-
S3_MAX_RETRY_TIME
- See Also:
-
S3_MAX_BACKOFF_TIME
- See Also:
-
S3_MAX_CLIENT_RETRIES
- See Also:
-
S3_MAX_ERROR_RETRIES
- See Also:
-
S3_SSL_ENABLED
- See Also:
-
S3_PATH_STYLE_ACCESS
- See Also:
-
S3_SIGNER_TYPE
- See Also:
-
S3_SIGNER_CLASS
- See Also:
-
S3_ENDPOINT
- See Also:
-
S3_REGION
- See Also:
-
S3_SECRET_KEY
- See Also:
-
S3_ACCESS_KEY
- See Also:
-
S3_SESSION_TOKEN
- See Also:
-
S3_IAM_ROLE
- See Also:
-
S3_EXTERNAL_ID
- See Also:
-
S3_ACL_TYPE
- See Also:
-
S3_SKIP_GLACIER_OBJECTS
- See Also:
-
S3_REQUESTER_PAYS_ENABLED
- See Also:
-
S3_STREAMING_UPLOAD_ENABLED
- See Also:
-
S3_STREAMING_UPLOAD_PART_SIZE
- See Also:
-
S3_STORAGE_CLASS
- See Also:
-
S3_ROLE_SESSION_NAME
- See Also:
-
S3_PROXY_HOST
- See Also:
-
S3_PROXY_PORT
- See Also:
-
S3_PROXY_PROTOCOL
- See Also:
-
S3_NON_PROXY_HOSTS
- See Also:
-
S3_PROXY_USERNAME
- See Also:
-
S3_PROXY_PASSWORD
- See Also:
-
S3_PREEMPTIVE_BASIC_PROXY_AUTH
- See Also:
-
S3_STS_ENDPOINT
- See Also:
-
S3_STS_REGION
- See Also:
-
DELETE_BATCH_SIZE
public static final int DELETE_BATCH_SIZE- See Also:
-
-
Constructor Details
-
TrinoS3FileSystem
public TrinoS3FileSystem()
-
-
Method Details
-
initialize
- Overrides:
initializein classorg.apache.hadoop.fs.FileSystem- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classorg.apache.hadoop.fs.FileSystem- Throws:
IOException
-
setOpenTelemetry
public void setOpenTelemetry(io.opentelemetry.api.OpenTelemetry openTelemetry) - Specified by:
setOpenTelemetryin interfaceOpenTelemetryAwareFileSystem
-
getScheme
- Overrides:
getSchemein classorg.apache.hadoop.fs.FileSystem
-
getUri
- Specified by:
getUriin classorg.apache.hadoop.fs.FileSystem
-
getWorkingDirectory
public org.apache.hadoop.fs.Path getWorkingDirectory()- Specified by:
getWorkingDirectoryin classorg.apache.hadoop.fs.FileSystem
-
setWorkingDirectory
public void setWorkingDirectory(org.apache.hadoop.fs.Path path) - Specified by:
setWorkingDirectoryin classorg.apache.hadoop.fs.FileSystem
-
listStatus
public org.apache.hadoop.fs.FileStatus[] listStatus(org.apache.hadoop.fs.Path path) throws IOException - Specified by:
listStatusin classorg.apache.hadoop.fs.FileSystem- Throws:
IOException
-
listFiles
public org.apache.hadoop.fs.RemoteIterator<org.apache.hadoop.fs.LocatedFileStatus> listFiles(org.apache.hadoop.fs.Path path, boolean recursive) - Overrides:
listFilesin classorg.apache.hadoop.fs.FileSystem
-
listLocatedStatus
public org.apache.hadoop.fs.RemoteIterator<org.apache.hadoop.fs.LocatedFileStatus> listLocatedStatus(org.apache.hadoop.fs.Path path) - Overrides:
listLocatedStatusin classorg.apache.hadoop.fs.FileSystem
-
getFileStatus
public org.apache.hadoop.fs.FileStatus getFileStatus(org.apache.hadoop.fs.Path path) throws IOException - Specified by:
getFileStatusin classorg.apache.hadoop.fs.FileSystem- Throws:
IOException
-
open
public org.apache.hadoop.fs.FSDataInputStream open(org.apache.hadoop.fs.Path path, int bufferSize) - Specified by:
openin classorg.apache.hadoop.fs.FileSystem
-
create
public org.apache.hadoop.fs.FSDataOutputStream create(org.apache.hadoop.fs.Path path, org.apache.hadoop.fs.permission.FsPermission permission, boolean overwrite, int bufferSize, short replication, long blockSize, org.apache.hadoop.util.Progressable progress) throws IOException - Specified by:
createin classorg.apache.hadoop.fs.FileSystem- Throws:
IOException
-
create
public org.apache.hadoop.fs.FSDataOutputStream create(org.apache.hadoop.fs.Path path, AggregatedMemoryContext aggregatedMemoryContext) throws IOException - Specified by:
createin interfaceMemoryAwareFileSystem- Throws:
IOException
-
append
public org.apache.hadoop.fs.FSDataOutputStream append(org.apache.hadoop.fs.Path f, int bufferSize, org.apache.hadoop.util.Progressable progress) - Specified by:
appendin classorg.apache.hadoop.fs.FileSystem
-
rename
public boolean rename(org.apache.hadoop.fs.Path src, org.apache.hadoop.fs.Path dst) throws IOException - Specified by:
renamein classorg.apache.hadoop.fs.FileSystem- Throws:
IOException
-
delete
- Specified by:
deletein classorg.apache.hadoop.fs.FileSystem- Throws:
IOException
-
deleteFiles
- Specified by:
deleteFilesin interfaceFileSystemWithBatchDelete- Throws:
IOException
-
mkdirs
public boolean mkdirs(org.apache.hadoop.fs.Path f, org.apache.hadoop.fs.permission.FsPermission permission) - Specified by:
mkdirsin classorg.apache.hadoop.fs.FileSystem
-
keyFromPath
-
getS3Client
public com.amazonaws.services.s3.AmazonS3 getS3Client() -
getBucketName
-
extractBucketName
Helper function used to work around the fact that if you use an S3 bucket with an '_' that java.net.URI behaves differently and sets the host value to null whereas S3 buckets without '_' have a properly set host field. '_' is only allowed in S3 bucket names in us-east-1.- Parameters:
uri- The URI from which to extract a host value.- Returns:
- The host value where uri.getAuthority() is used when uri.getHost() returns null as long as no UserInfo is present.
- Throws:
IllegalArgumentException- If the bucket cannot be determined from the URI.
-
getFileSystemStats
-