Package org.apache.hadoop.fs.s3a.impl
Interface ContextAccessors
public interface ContextAccessors
An interface to implement for providing accessors to
S3AFileSystem-level API calls.
This is used to avoid giving any explicit reference to the owning FS in the store context; there are enough calls that using lambda-expressions gets over-complex.
- Test suites are free to provide their own implementation, using * the S3AFileSystem methods as the normative reference.
- All implementations MUST translate exceptions.
-
Method Summary
Modifier and TypeMethodDescriptioncreateTempFile(String prefix, long size) Create a temporary file.org.apache.hadoop.fs.store.audit.AuditSpanReturn the active audit span.Get the region of a bucket.Get the request factory.org.apache.hadoop.fs.PathConvert a key to a fully qualified path.org.apache.hadoop.fs.PathmakeQualified(org.apache.hadoop.fs.Path path) Qualify a path.pathToKey(org.apache.hadoop.fs.Path path) Turns a path (relative or otherwise) into an S3 key.
-
Method Details
-
keyToPath
Convert a key to a fully qualified path.- Parameters:
key- input key- Returns:
- the fully qualified path including URI scheme and bucket name.
-
pathToKey
Turns a path (relative or otherwise) into an S3 key.- Parameters:
path- input path, may be relative to the working dir- Returns:
- a key excluding the leading "/", or, if it is the root path, ""
-
createTempFile
Create a temporary file.- Parameters:
prefix- prefix for the temporary filesize- the size of the file that is going to be written- Returns:
- a unique temporary file
- Throws:
IOException- IO problems
-
getBucketLocation
Get the region of a bucket. This may be via an S3 API call if not already cached.- Returns:
- the region in which a bucket is located
- Throws:
AccessDeniedException- if the caller lacks permission.IOException- on any failure.
-
makeQualified
org.apache.hadoop.fs.Path makeQualified(org.apache.hadoop.fs.Path path) Qualify a path.- Parameters:
path- path to qualify/normalize- Returns:
- possibly new path.
-
getActiveAuditSpan
org.apache.hadoop.fs.store.audit.AuditSpan getActiveAuditSpan()Return the active audit span. This is thread local -it MUST be picked up and passed into workers. Collect and cache the value during construction.- Returns:
- active audit span.
-
getRequestFactory
RequestFactory getRequestFactory()Get the request factory.- Returns:
- the factory for requests.
-