Package alluxio.underfs
Class Fingerprint
- java.lang.Object
-
- alluxio.underfs.Fingerprint
-
@NotThreadSafe public final class Fingerprint extends java.lang.Object
Fingerprint for a UFS file or directory.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Fingerprint.Tag
The possible tags within the fingerprint.static class
Fingerprint.Type
The possible types of the fingerprint.
-
Field Summary
Fields Modifier and Type Field Description static Fingerprint
INVALID_FINGERPRINT
static java.lang.String
UNDERSCORE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Fingerprint
create(java.lang.String ufsName, UfsStatus status)
Parses the input string and returns the fingerprint object.static Fingerprint
create(java.lang.String ufsName, UfsStatus status, java.lang.String contentHash)
Parses the input string and returns the fingerprint object.static Fingerprint
create(java.lang.String ufsName, UfsStatus status, java.lang.String contentHash, AccessControlList acl)
Parses the input string and returns the fingerprint object.java.lang.String
getTag(Fingerprint.Tag tag)
boolean
isValid()
Checks if the fingerprint object was generated from an INVALID_UFS_FINGERPRINT.boolean
matchContent(Fingerprint fp)
Returns true if the serialized fingerprint matches the fingerprint in the content part.boolean
matchMetadata(Fingerprint fp)
Returns true if the serialized fingerprint matches the fingerprint in metadata.static Fingerprint
parse(java.lang.String input)
Parses the input string and returns the fingerprint object.void
putTag(Fingerprint.Tag tag, java.lang.String value)
Updates a specific tag in the fingerprint.java.lang.String
serialize()
-
-
-
Field Detail
-
INVALID_FINGERPRINT
public static final Fingerprint INVALID_FINGERPRINT
-
UNDERSCORE
public static final java.lang.String UNDERSCORE
- See Also:
- Constant Field Values
-
-
Method Detail
-
create
public static Fingerprint create(java.lang.String ufsName, UfsStatus status)
Parses the input string and returns the fingerprint object.- Parameters:
ufsName
- the name of the ufs, should beUnderFileSystem.getUnderFSType()
status
- theUfsStatus
to create the fingerprint from- Returns:
- the fingerprint object
-
create
public static Fingerprint create(java.lang.String ufsName, UfsStatus status, @Nullable java.lang.String contentHash)
Parses the input string and returns the fingerprint object.- Parameters:
ufsName
- the name of the ufs, should beUnderFileSystem.getUnderFSType()
status
- theUfsStatus
to create the fingerprint fromcontentHash
- the hash of the contents, if null the hash will be taken from theUfsStatus
parameter- Returns:
- the fingerprint object
-
create
public static Fingerprint create(java.lang.String ufsName, UfsStatus status, @Nullable java.lang.String contentHash, @Nullable AccessControlList acl)
Parses the input string and returns the fingerprint object.- Parameters:
ufsName
- the name of the ufs, should beUnderFileSystem.getUnderFSType()
status
- theUfsStatus
to create the fingerprint fromcontentHash
- the hash of the contents, if null the hash will be taken from theUfsStatus
parameteracl
- theAccessControlList
to create the fingerprint from- Returns:
- the fingerprint object
-
parse
@Nullable public static Fingerprint parse(java.lang.String input)
Parses the input string and returns the fingerprint object.- Parameters:
input
- the string to parse- Returns:
- the parsed fingerprint object, or null if parsing failed
-
isValid
public boolean isValid()
Checks if the fingerprint object was generated from an INVALID_UFS_FINGERPRINT.- Returns:
- returns true if the fingerprint is valid
-
serialize
public java.lang.String serialize()
- Returns:
- the serialized string of the fingerprint
-
matchMetadata
public boolean matchMetadata(Fingerprint fp)
Returns true if the serialized fingerprint matches the fingerprint in metadata.- Parameters:
fp
- a parsed fingerprint object- Returns:
- true if the given fingerprint matches the current fingerprint in metadata
-
matchContent
public boolean matchContent(Fingerprint fp)
Returns true if the serialized fingerprint matches the fingerprint in the content part.- Parameters:
fp
- a parsed fingerprint object- Returns:
- true if the given fingerprint matches the current fingerprint's content
-
putTag
public void putTag(Fingerprint.Tag tag, java.lang.String value)
Updates a specific tag in the fingerprint. If the new value is null, the fingerprint is kept unchanged.- Parameters:
tag
- the tag to updatevalue
- the new value of the tag
-
getTag
public java.lang.String getTag(Fingerprint.Tag tag)
- Parameters:
tag
- the tag to get- Returns:
- the value of the tag
-
-