Class S3AFileStatus

java.lang.Object
org.apache.hadoop.fs.FileStatus
org.apache.hadoop.fs.s3a.S3AFileStatus
All Implemented Interfaces:
ObjectInputValidation, Serializable, Comparable<Object>, org.apache.hadoop.fs.EtagSource, org.apache.hadoop.io.Writable

@Private @Evolving public class S3AFileStatus extends org.apache.hadoop.fs.FileStatus implements org.apache.hadoop.fs.EtagSource
File status for an S3A "file". Modification time is trouble, see getModificationTime(). The subclass is private as it should not be created directly.
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.apache.hadoop.fs.FileStatus

    org.apache.hadoop.fs.FileStatus.AttrFlags
  • Field Summary

    Fields inherited from class org.apache.hadoop.fs.FileStatus

    NONE
  • Constructor Summary

    Constructors
    Constructor
    Description
    S3AFileStatus(boolean isemptydir, org.apache.hadoop.fs.Path path, String owner)
    Create a directory status.
    S3AFileStatus(long length, long modification_time, org.apache.hadoop.fs.Path path, long blockSize, String owner, String eTag, String versionId)
    A simple file.
    S3AFileStatus(Tristate isemptydir, org.apache.hadoop.fs.Path path, String owner)
    Create a directory status.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Compare if this object is equal to another object.
    fromFileStatus(org.apache.hadoop.fs.FileStatus source, Tristate isEmptyDirectory, String eTag, String versionId)
    Convenience constructor for creating from a vanilla FileStatus plus an isEmptyDirectory flag.
     
    Deprecated.
    use EtagSource.getEtag() for public access.
    long
    Get the modification time of the file/directory.
     
    int
    Returns a hash code value for the object, which is defined as the hash code of the path name.
     
    void
    setIsEmptyDirectory(Tristate isEmptyDirectory)
    Update isEmptyDirectory attribute.
    void
    setVersionId(String versionId)
    set the S3 object versionId, else null.
     

    Methods inherited from class org.apache.hadoop.fs.FileStatus

    attributes, compareTo, compareTo, getAccessTime, getBlockSize, getGroup, getLen, getOwner, getPath, getPermission, getReplication, getSymlink, hasAcl, isDir, isDirectory, isEncrypted, isErasureCoded, isFile, isSnapshotEnabled, isSymlink, readFields, setGroup, setOwner, setPath, setPermission, setSymlink, validateObject, write

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • S3AFileStatus

      public S3AFileStatus(boolean isemptydir, org.apache.hadoop.fs.Path path, String owner)
      Create a directory status.
      Parameters:
      isemptydir - is this an empty directory?
      path - the path
      owner - the owner
    • S3AFileStatus

      public S3AFileStatus(Tristate isemptydir, org.apache.hadoop.fs.Path path, String owner)
      Create a directory status.
      Parameters:
      isemptydir - is this an empty directory?
      path - the path
      owner - the owner
    • S3AFileStatus

      public S3AFileStatus(long length, long modification_time, org.apache.hadoop.fs.Path path, long blockSize, String owner, String eTag, String versionId)
      A simple file.
      Parameters:
      length - file length
      modification_time - mod time
      path - path
      blockSize - block size
      owner - owner
      eTag - eTag of the S3 object if available, else null
      versionId - versionId of the S3 object if available, else null
  • Method Details

    • fromFileStatus

      public static S3AFileStatus fromFileStatus(org.apache.hadoop.fs.FileStatus source, Tristate isEmptyDirectory, String eTag, String versionId)
      Convenience constructor for creating from a vanilla FileStatus plus an isEmptyDirectory flag.
      Parameters:
      source - FileStatus to convert to S3AFileStatus
      isEmptyDirectory - TRUE/FALSE if known to be / not be an empty directory, UNKNOWN if that information was not computed.
      eTag - eTag of the S3 object if available, else null
      versionId - versionId of the S3 object if available, else null
      Returns:
      a new S3AFileStatus
    • isEmptyDirectory

      public Tristate isEmptyDirectory()
      Returns:
      FALSE if status is not a directory, or its a dir, but known to not be empty. TRUE if it is an empty directory. UNKNOWN if it is a directory, but we have not computed whether or not it is empty.
    • setIsEmptyDirectory

      public void setIsEmptyDirectory(Tristate isEmptyDirectory)
      Update isEmptyDirectory attribute.
      Parameters:
      isEmptyDirectory - new isEmptyDirectory value
    • getETag

      @Deprecated public String getETag()
      Deprecated.
      use EtagSource.getEtag() for public access.
      Returns:
      the S3 object eTag when available, else null.
    • getEtag

      public String getEtag()
      Specified by:
      getEtag in interface org.apache.hadoop.fs.EtagSource
    • getVersionId

      public String getVersionId()
      Returns:
      the S3 object versionId when available, else null.
    • setVersionId

      public void setVersionId(String versionId)
      set the S3 object versionId, else null.
      Parameters:
      versionId - version ID or null.
    • equals

      public boolean equals(Object o)
      Compare if this object is equal to another object.
      Overrides:
      equals in class org.apache.hadoop.fs.FileStatus
      Parameters:
      o - the object to be compared.
      Returns:
      true if two file status has the same path name; false if not.
    • hashCode

      public int hashCode()
      Returns a hash code value for the object, which is defined as the hash code of the path name.
      Overrides:
      hashCode in class org.apache.hadoop.fs.FileStatus
      Returns:
      a hash code value for the path name.
    • getModificationTime

      public long getModificationTime()
      Get the modification time of the file/directory. s3a uses objects as "fake" directories, which are not updated to reflect the accurate modification time. We choose to report the current time because some parts of the ecosystem (e.g. the HistoryServer) use modification time to ignore "old" directories.
      Overrides:
      getModificationTime in class org.apache.hadoop.fs.FileStatus
      Returns:
      for files the modification time in milliseconds since January 1, 1970 UTC or for directories the current time.
    • toString

      public String toString()
      Overrides:
      toString in class org.apache.hadoop.fs.FileStatus