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

public abstract class MountTable extends BaseRecord
Data schema for MountTableStore data stored in the StateStoreService. Supports string serialization.
  • Field Details

    • ERROR_MSG_NO_SOURCE_PATH

      public static final String ERROR_MSG_NO_SOURCE_PATH
      See Also:
    • ERROR_MSG_MUST_START_WITH_BACK_SLASH

      public static final String ERROR_MSG_MUST_START_WITH_BACK_SLASH
      See Also:
    • ERROR_MSG_NO_DEST_PATH_SPECIFIED

      public static final String ERROR_MSG_NO_DEST_PATH_SPECIFIED
      See Also:
    • ERROR_MSG_INVALID_DEST_NS

      public static final String ERROR_MSG_INVALID_DEST_NS
      See Also:
    • ERROR_MSG_INVALID_DEST_PATH

      public static final String ERROR_MSG_INVALID_DEST_PATH
      See Also:
    • ERROR_MSG_ALL_DEST_MUST_START_WITH_BACK_SLASH

      public static final String ERROR_MSG_ALL_DEST_MUST_START_WITH_BACK_SLASH
      See Also:
    • PATH_COMPARATOR

      public static final Comparator<String> PATH_COMPARATOR
      Comparator for paths which considers the /.
    • SOURCE_COMPARATOR

      public static final Comparator<MountTable> SOURCE_COMPARATOR
      Comparator based on the mount table source.
  • Constructor Details

    • MountTable

      public MountTable()
      Default constructor for a mount table entry.
  • Method Details

    • newInstance

      public static MountTable newInstance()
    • newInstance

      public static MountTable newInstance(String src, Map<String,String> destinations, long dateCreated, long dateModified) throws IOException
      Constructor 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 IOException
      Constructor 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

      public abstract String getSourcePath()
      Get source path in the federated namespace.
      Returns:
      Source path in the federated namespace.
    • setSourcePath

      public abstract void setSourcePath(String path)
      Set source path in the federated namespace.
      Parameters:
      path - Source path in the federated namespace.
    • getDestinations

      public abstract List<RemoteLocation> getDestinations()
      Get a list of destinations (namespace + path) present for this entry.
      Returns:
      List of RemoteLocation destinations. Null if no destinations.
    • setDestinations

      public abstract void setDestinations(List<RemoteLocation> dests)
      Set the destination paths.
      Parameters:
      dests - Destination paths.
    • addDestination

      public abstract boolean addDestination(String nsId, String path)
      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

      public abstract DestinationOrder getDestOrder()
      Get the order of the destinations for this mount table entry.
      Returns:
      Order of the destinations.
    • setDestOrder

      public abstract void setDestOrder(DestinationOrder order)
      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

      public abstract String getOwnerName()
      Get owner name of this mount table entry.
      Returns:
      Owner name
    • setOwnerName

      public abstract void setOwnerName(String owner)
      Set owner name of this mount table entry.
      Parameters:
      owner - Owner name for mount table entry
    • getGroupName

      public abstract String getGroupName()
      Get group name of this mount table entry.
      Returns:
      Group name
    • setGroupName

      public abstract void setGroupName(String group)
      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

      public abstract RouterQuotaUsage getQuota()
      Get quota of this mount table entry.
      Returns:
      RouterQuotaUsage quota usage
    • setQuota

      public abstract void setQuota(RouterQuotaUsage quota)
      Set quota for this mount table entry.
      Parameters:
      quota - QuotaUsage for mount table entry
    • getDefaultLocation

      public RemoteLocation getDefaultLocation()
      Get the default location.
      Returns:
      The default location.
    • like

      public boolean like(BaseRecord o)
      Description copied from class: BaseRecord
      Check if this record matches a partial record.
      Overrides:
      like in class BaseRecord
      Parameters:
      o - Partial record.
      Returns:
      If this record matches.
    • toString

      public String toString()
      Overrides:
      toString in class BaseRecord
    • getPrimaryKeys

      public SortedMap<String,String> getPrimaryKeys()
      Description copied from class: BaseRecord
      Map 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:
      getPrimaryKeys in class BaseRecord
      Returns:
      Map of key/value pairs that constitute this object's primary key.
    • validate

      public void validate()
      Description copied from class: BaseRecord
      Validates 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:
      validate in class BaseRecord
    • getExpirationMs

      public long getExpirationMs()
      Description copied from class: BaseRecord
      Get the expiration time for the record.
      Specified by:
      getExpirationMs in class BaseRecord
      Returns:
      Expiration time for the record.
    • hashCode

      public int hashCode()
      Description copied from class: BaseRecord
      Override hash code to use primary key(s) for comparison.
      Overrides:
      hashCode in class BaseRecord
    • equals

      public boolean equals(Object obj)
      Description copied from class: BaseRecord
      Override equals check to use primary key(s) for comparison.
      Overrides:
      equals in class BaseRecord
    • isAll

      public boolean isAll()
      Check if a mount table spans all locations.
      Returns:
      If the mount table spreads across all locations.