Class MountTable
java.lang.Object
org.apache.hadoop.hdfs.server.federation.store.records.BaseRecord
org.apache.hadoop.hdfs.server.federation.store.records.MountTable
- All Implemented Interfaces:
Comparable<BaseRecord>
- Direct Known Subclasses:
MountTablePBImpl
Data schema for
MountTableStore data stored in the StateStoreService. Supports string serialization.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Comparator<String>Comparator for paths which considers the /.static final Comparator<MountTable>Comparator based on the mount table source.Fields inherited from class org.apache.hadoop.hdfs.server.federation.store.records.BaseRecord
ERROR_MSG_CREATION_TIME_NEGATIVE, ERROR_MSG_MODIFICATION_TIME_NEGATIVE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract booleanaddDestination(String nsId, String path) Add a new destination to this mount table entry.booleanOverride equals check to use primary key(s) for comparison.Get the default location.abstract List<RemoteLocation>Get a list of destinations (namespace + path) present for this entry.abstract DestinationOrderGet the order of the destinations for this mount table entry.longGet the expiration time for the record.abstract StringGet group name of this mount table entry.abstract org.apache.hadoop.fs.permission.FsPermissiongetMode()Get permission of this mount table entry.abstract StringGet owner name of this mount table entry.Map of primary key names to values for the record.abstract RouterQuotaUsagegetQuota()Get quota of this mount table entry.abstract StringGet source path in the federated namespace.inthashCode()Override hash code to use primary key(s) for comparison.booleanisAll()Check if a mount table spans all locations.abstract booleanCheck if the mount point supports a failed destination.abstract booleanCheck if the entry is read only.booleanlike(BaseRecord o) Check if this record matches a partial record.static MountTablestatic MountTablenewInstance(String src, Map<String, String> destinations) Constructor for a mount table entry with multiple destinations.static MountTablenewInstance(String src, Map<String, String> destinations, long dateCreated, long dateModified) Constructor for a mount table entry with a single destinations.abstract voidsetDestinations(List<RemoteLocation> dests) Set the destination paths.abstract voidsetDestOrder(DestinationOrder order) Set the order of the destinations for this mount table entry.abstract voidsetFaultTolerant(boolean faultTolerant) Set if the mount point supports failed destinations.abstract voidsetGroupName(String group) Set group name of this mount table entry.abstract voidsetMode(org.apache.hadoop.fs.permission.FsPermission mode) Set permission for this mount table entry.abstract voidsetOwnerName(String owner) Set owner name of this mount table entry.abstract voidsetQuota(RouterQuotaUsage quota) Set quota for this mount table entry.abstract voidsetReadOnly(boolean ro) Set an entry to be read only.abstract voidsetSourcePath(String path) Set source path in the federated namespace.toString()voidvalidate()Validates the record.Methods inherited from class org.apache.hadoop.hdfs.server.federation.store.records.BaseRecord
checkExpired, compareTo, generateMashupKey, getDateCreated, getDateModified, getDeletionMs, getPrimaryKey, hasOtherFields, init, isExpired, setDateCreated, setDateModified, shouldBeDeleted
-
Field Details
-
ERROR_MSG_NO_SOURCE_PATH
- See Also:
-
ERROR_MSG_MUST_START_WITH_BACK_SLASH
- See Also:
-
ERROR_MSG_NO_DEST_PATH_SPECIFIED
- See Also:
-
ERROR_MSG_INVALID_DEST_NS
- See Also:
-
ERROR_MSG_INVALID_DEST_PATH
- See Also:
-
ERROR_MSG_ALL_DEST_MUST_START_WITH_BACK_SLASH
- See Also:
-
PATH_COMPARATOR
Comparator for paths which considers the /. -
SOURCE_COMPARATOR
Comparator based on the mount table source.
-
-
Constructor Details
-
MountTable
public MountTable()Default constructor for a mount table entry.
-
-
Method Details
-
newInstance
-
newInstance
public static MountTable newInstance(String src, Map<String, String> destinations, long dateCreated, long dateModified) throws IOExceptionConstructor for a mount table entry with a single destinations.- Parameters:
src- Source path in the mount entry.destinations- Name service destination of the mount point.dateCreated- Created date.dateModified- Modified date.- Returns:
- New mount table instance.
- Throws:
IOException- If it cannot be created.
-
newInstance
public static MountTable newInstance(String src, Map<String, String> destinations) throws IOExceptionConstructor for a mount table entry with multiple destinations.- Parameters:
src- Source path in the mount entry.destinations- Name service destinations of the mount point.- Returns:
- The MountTable object.
- Throws:
IOException- If it cannot be created.
-
getSourcePath
Get source path in the federated namespace.- Returns:
- Source path in the federated namespace.
-
setSourcePath
Set source path in the federated namespace.- Parameters:
path- Source path in the federated namespace.
-
getDestinations
Get a list of destinations (namespace + path) present for this entry.- Returns:
- List of RemoteLocation destinations. Null if no destinations.
-
setDestinations
Set the destination paths.- Parameters:
dests- Destination paths.
-
addDestination
Add a new destination to this mount table entry.- Parameters:
nsId- Name service identifier.path- Path in the remote name service.- Returns:
- If the destination was added.
-
isReadOnly
public abstract boolean isReadOnly()Check if the entry is read only.- Returns:
- If the entry is read only.
-
setReadOnly
public abstract void setReadOnly(boolean ro) Set an entry to be read only.- Parameters:
ro- If the entry is read only.
-
getDestOrder
Get the order of the destinations for this mount table entry.- Returns:
- Order of the destinations.
-
setDestOrder
Set the order of the destinations for this mount table entry.- Parameters:
order- Order of the destinations.
-
isFaultTolerant
public abstract boolean isFaultTolerant()Check if the mount point supports a failed destination.- Returns:
- If it supports failures.
-
setFaultTolerant
public abstract void setFaultTolerant(boolean faultTolerant) Set if the mount point supports failed destinations.- Parameters:
faultTolerant- If it supports failures.
-
getOwnerName
Get owner name of this mount table entry.- Returns:
- Owner name
-
setOwnerName
Set owner name of this mount table entry.- Parameters:
owner- Owner name for mount table entry
-
getGroupName
Get group name of this mount table entry.- Returns:
- Group name
-
setGroupName
Set group name of this mount table entry.- Parameters:
group- Group name for mount table entry
-
getMode
public abstract org.apache.hadoop.fs.permission.FsPermission getMode()Get permission of this mount table entry.- Returns:
- FsPermission permission mode
-
setMode
public abstract void setMode(org.apache.hadoop.fs.permission.FsPermission mode) Set permission for this mount table entry.- Parameters:
mode- Permission for mount table entry
-
getQuota
Get quota of this mount table entry.- Returns:
- RouterQuotaUsage quota usage
-
setQuota
Set quota for this mount table entry.- Parameters:
quota- QuotaUsage for mount table entry
-
getDefaultLocation
Get the default location.- Returns:
- The default location.
-
like
Description copied from class:BaseRecordCheck if this record matches a partial record.- Overrides:
likein classBaseRecord- Parameters:
o- Partial record.- Returns:
- If this record matches.
-
toString
- Overrides:
toStringin classBaseRecord
-
getPrimaryKeys
Description copied from class:BaseRecordMap of primary key names to values for the record. The primary key can be a combination of 1-n different State Store serialized values.- Specified by:
getPrimaryKeysin classBaseRecord- Returns:
- Map of key/value pairs that constitute this object's primary key.
-
validate
public void validate()Description copied from class:BaseRecordValidates the record. Called when the record is created, populated from the state store, and before committing to the state store. If validate failed, there throws an exception.- Overrides:
validatein classBaseRecord
-
getExpirationMs
public long getExpirationMs()Description copied from class:BaseRecordGet the expiration time for the record.- Specified by:
getExpirationMsin classBaseRecord- Returns:
- Expiration time for the record.
-
hashCode
public int hashCode()Description copied from class:BaseRecordOverride hash code to use primary key(s) for comparison.- Overrides:
hashCodein classBaseRecord
-
equals
Description copied from class:BaseRecordOverride equals check to use primary key(s) for comparison.- Overrides:
equalsin classBaseRecord
-
isAll
public boolean isAll()Check if a mount table spans all locations.- Returns:
- If the mount table spreads across all locations.
-