Class Listing


@Private public class Listing extends AbstractStoreOperation
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
  • Constructor Details

  • 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 listing
      request - initial request to make
      filter - the filter on which paths to accept
      acceptor - 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 filter
      span - 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)