Package org.apache.hadoop.fs.s3a
Class Listing
java.lang.Object
org.apache.hadoop.fs.s3a.impl.AbstractStoreOperation
org.apache.hadoop.fs.s3a.Listing
Place for the S3A listing classes; keeps all the small classes under control.
Spans passed in are attached to the listing iterators returned, but are not
closed at the end of the iteration. This is because the same span
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAccept all entries except the base path.static classAccept all entries except the base path and those which map to S3N pseudo directory markers. -
Constructor Summary
ConstructorsConstructorDescriptionListing(ListingOperationCallbacks listingOperationCallbacks, StoreContext storeContext) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.hadoop.fs.RemoteIterator<S3AFileStatus>createFileStatusListingIterator(org.apache.hadoop.fs.Path listPath, S3ListRequest request, org.apache.hadoop.fs.PathFilter filter, org.apache.hadoop.fs.s3a.Listing.FileStatusAcceptor acceptor, org.apache.hadoop.fs.store.audit.AuditSpan span) Create a FileStatus iterator against a path, with a given list object request.createListObjectsRequest(String key, String delimiter, org.apache.hadoop.fs.store.audit.AuditSpan span) org.apache.hadoop.fs.RemoteIterator<S3ALocatedFileStatus>createLocatedFileStatusIterator(org.apache.hadoop.fs.RemoteIterator<S3AFileStatus> statusIterator) Create a located status iterator over a file status iterator.org.apache.hadoop.fs.RemoteIterator<S3ALocatedFileStatus>Create a remote iterator from a single status entry.org.apache.hadoop.fs.RemoteIterator<S3AFileStatus>getFileStatusesAssumingNonEmptyDir(org.apache.hadoop.fs.Path path, org.apache.hadoop.fs.store.audit.AuditSpan span) Calculate list of file statuses assuming path to be a non-empty directory.org.apache.hadoop.fs.RemoteIterator<S3ALocatedFileStatus>getListFilesAssumingDir(org.apache.hadoop.fs.Path path, boolean recursive, org.apache.hadoop.fs.s3a.Listing.FileStatusAcceptor acceptor, org.apache.hadoop.fs.store.audit.AuditSpan span) List files under a path assuming the path to be a directory.org.apache.hadoop.fs.RemoteIterator<S3ALocatedFileStatus>getLocatedFileStatusIteratorForDir(org.apache.hadoop.fs.Path dir, org.apache.hadoop.fs.PathFilter filter, org.apache.hadoop.fs.store.audit.AuditSpan span) Generate list located status for a directory.static org.apache.hadoop.fs.RemoteIterator<org.apache.hadoop.fs.LocatedFileStatus>toLocatedFileStatusIterator(org.apache.hadoop.fs.RemoteIterator<? extends org.apache.hadoop.fs.LocatedFileStatus> iterator) static org.apache.hadoop.fs.RemoteIterator<S3AFileStatus>toProvidedFileStatusIterator(S3AFileStatus[] fileStatuses) Create a FileStatus iterator against a provided list of file status.Methods inherited from class org.apache.hadoop.fs.s3a.impl.AbstractStoreOperation
activateAuditSpan, getAuditSpan, getStoreContext
-
Constructor Details
-
Listing
-
-
Method Details
-
toProvidedFileStatusIterator
@VisibleForTesting public static org.apache.hadoop.fs.RemoteIterator<S3AFileStatus> toProvidedFileStatusIterator(S3AFileStatus[] fileStatuses) Create a FileStatus iterator against a provided list of file status.- Parameters:
fileStatuses- array of file status.- Returns:
- the file status iterator.
-
createFileStatusListingIterator
@RetryRaw public org.apache.hadoop.fs.RemoteIterator<S3AFileStatus> createFileStatusListingIterator(org.apache.hadoop.fs.Path listPath, S3ListRequest request, org.apache.hadoop.fs.PathFilter filter, org.apache.hadoop.fs.s3a.Listing.FileStatusAcceptor acceptor, org.apache.hadoop.fs.store.audit.AuditSpan span) throws IOException Create a FileStatus iterator against a path, with a given list object request.- Parameters:
listPath- path of the listingrequest- initial request to makefilter- the filter on which paths to acceptacceptor- the class/predicate to decide which entries to accept in the listing based on the full file status.span- audit span for this iterator- Returns:
- the iterator
- Throws:
IOException- IO Problems
-
createLocatedFileStatusIterator
@VisibleForTesting public org.apache.hadoop.fs.RemoteIterator<S3ALocatedFileStatus> createLocatedFileStatusIterator(org.apache.hadoop.fs.RemoteIterator<S3AFileStatus> statusIterator) Create a located status iterator over a file status iterator.- Parameters:
statusIterator- an iterator over the remote status entries- Returns:
- a new remote iterator
-
createSingleStatusIterator
public org.apache.hadoop.fs.RemoteIterator<S3ALocatedFileStatus> createSingleStatusIterator(S3ALocatedFileStatus status) Create a remote iterator from a single status entry.- Parameters:
status- status- Returns:
- iterator.
-
getListFilesAssumingDir
public org.apache.hadoop.fs.RemoteIterator<S3ALocatedFileStatus> getListFilesAssumingDir(org.apache.hadoop.fs.Path path, boolean recursive, org.apache.hadoop.fs.s3a.Listing.FileStatusAcceptor acceptor, org.apache.hadoop.fs.store.audit.AuditSpan span) throws IOException List files under a path assuming the path to be a directory.- Parameters:
path- input path.recursive- recursive listing?acceptor- file status filterspan- audit span for this iterator- Returns:
- an iterator over listing.
- Throws:
IOException- any exception.
-
getLocatedFileStatusIteratorForDir
public org.apache.hadoop.fs.RemoteIterator<S3ALocatedFileStatus> getLocatedFileStatusIteratorForDir(org.apache.hadoop.fs.Path dir, org.apache.hadoop.fs.PathFilter filter, org.apache.hadoop.fs.store.audit.AuditSpan span) throws IOException Generate list located status for a directory.- Parameters:
dir- directory to check.filter- a path filter.span- audit span for this iterator- Returns:
- an iterator that traverses statuses of the given dir.
- Throws:
IOException- in case of failure.
-
getFileStatusesAssumingNonEmptyDir
@RetryRaw public org.apache.hadoop.fs.RemoteIterator<S3AFileStatus> getFileStatusesAssumingNonEmptyDir(org.apache.hadoop.fs.Path path, org.apache.hadoop.fs.store.audit.AuditSpan span) throws IOException Calculate list of file statuses assuming path to be a non-empty directory.- Parameters:
path- input path.span- audit span for this iterator- Returns:
- iterator of file statuses.
- Throws:
IOException- Any IO problems.
-
createListObjectsRequest
public S3ListRequest createListObjectsRequest(String key, String delimiter, org.apache.hadoop.fs.store.audit.AuditSpan span) -
toLocatedFileStatusIterator
public static org.apache.hadoop.fs.RemoteIterator<org.apache.hadoop.fs.LocatedFileStatus> toLocatedFileStatusIterator(org.apache.hadoop.fs.RemoteIterator<? extends org.apache.hadoop.fs.LocatedFileStatus> iterator)
-