Package org.apache.hadoop.fs.s3a
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
ConstructorsConstructorDescriptionS3AFileStatus(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 TypeMethodDescriptionbooleanCompare if this object is equal to another object.static S3AFileStatusfromFileStatus(org.apache.hadoop.fs.FileStatus source, Tristate isEmptyDirectory, String eTag, String versionId) Convenience constructor for creating from a vanilla FileStatus plus an isEmptyDirectory flag.getEtag()getETag()Deprecated.longGet the modification time of the file/directory.inthashCode()Returns a hash code value for the object, which is defined as the hash code of the path name.voidsetIsEmptyDirectory(Tristate isEmptyDirectory) Update isEmptyDirectory attribute.voidsetVersionId(String versionId) set the S3 object versionId, else null.toString()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
-
Constructor Details
-
S3AFileStatus
Create a directory status.- Parameters:
isemptydir- is this an empty directory?path- the pathowner- the owner
-
S3AFileStatus
Create a directory status.- Parameters:
isemptydir- is this an empty directory?path- the pathowner- 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 lengthmodification_time- mod timepath- pathblockSize- block sizeowner- ownereTag- eTag of the S3 object if available, else nullversionId- 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 S3AFileStatusisEmptyDirectory- 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 nullversionId- versionId of the S3 object if available, else null- Returns:
- a new S3AFileStatus
-
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
Update isEmptyDirectory attribute.- Parameters:
isEmptyDirectory- new isEmptyDirectory value
-
getETag
Deprecated.useEtagSource.getEtag()for public access.- Returns:
- the S3 object eTag when available, else null.
-
getEtag
- Specified by:
getEtagin interfaceorg.apache.hadoop.fs.EtagSource
-
getVersionId
- Returns:
- the S3 object versionId when available, else null.
-
setVersionId
set the S3 object versionId, else null.- Parameters:
versionId- version ID or null.
-
equals
Compare if this object is equal to another object.- Overrides:
equalsin classorg.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:
hashCodein classorg.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:
getModificationTimein classorg.apache.hadoop.fs.FileStatus- Returns:
- for files the modification time in milliseconds since January 1, 1970 UTC or for directories the current time.
-
toString
- Overrides:
toStringin classorg.apache.hadoop.fs.FileStatus
-
EtagSource.getEtag()for public access.