|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.hadoop.tools.util.DistCpUtils
public class DistCpUtils
Utility functions used in DistCp.
| Constructor Summary | |
|---|---|
DistCpUtils()
|
|
| Method Summary | ||
|---|---|---|
static void |
checkFileSystemAclSupport(org.apache.hadoop.fs.FileSystem fs)
Determines if a file system supports ACLs by running a canary getAclStatus request on the file system root. |
|
static void |
checkFileSystemXAttrSupport(org.apache.hadoop.fs.FileSystem fs)
Determines if a file system supports XAttrs by running a getXAttrs request on the file system root. |
|
static boolean |
checksumsAreEqual(org.apache.hadoop.fs.FileSystem sourceFS,
org.apache.hadoop.fs.Path source,
org.apache.hadoop.fs.FileChecksum sourceChecksum,
org.apache.hadoop.fs.FileSystem targetFS,
org.apache.hadoop.fs.Path target)
Utility to compare checksums for the paths specified. |
|
static boolean |
compareFs(org.apache.hadoop.fs.FileSystem srcFs,
org.apache.hadoop.fs.FileSystem destFs)
|
|
static List<org.apache.hadoop.fs.permission.AclEntry> |
getAcl(org.apache.hadoop.fs.FileSystem fileSystem,
org.apache.hadoop.fs.FileStatus fileStatus)
Returns a file's full logical ACL. |
|
static long |
getFileSize(org.apache.hadoop.fs.Path path,
org.apache.hadoop.conf.Configuration configuration)
Retrieves size of the file at the specified path. |
|
static DecimalFormat |
getFormatter()
|
|
static int |
getInt(org.apache.hadoop.conf.Configuration configuration,
String label)
Utility to retrieve a specified key from a Configuration. |
|
static long |
getLong(org.apache.hadoop.conf.Configuration configuration,
String label)
Utility to retrieve a specified key from a Configuration. |
|
static String |
getRelativePath(org.apache.hadoop.fs.Path sourceRootPath,
org.apache.hadoop.fs.Path childPath)
Gets relative path of child path with respect to a root path For ex. |
|
static Class<? extends org.apache.hadoop.mapreduce.InputFormat> |
getStrategy(org.apache.hadoop.conf.Configuration conf,
DistCpOptions options)
Returns the class that implements a copy strategy. |
|
static String |
getStringDescriptionFor(long nBytes)
|
|
static Map<String,byte[]> |
getXAttrs(org.apache.hadoop.fs.FileSystem fileSystem,
org.apache.hadoop.fs.Path path)
Returns a file's all xAttrs. |
|
static String |
packAttributes(EnumSet<DistCpOptions.FileAttribute> attributes)
Pack file preservation attributes into a string, containing just the first character of each preservation attribute |
|
static void |
preserve(org.apache.hadoop.fs.FileSystem targetFS,
org.apache.hadoop.fs.Path path,
CopyListingFileStatus srcFileStatus,
EnumSet<DistCpOptions.FileAttribute> attributes,
boolean preserveRawXattrs)
Preserve attribute on file matching that of the file status being sent as argument. |
|
static
|
publish(org.apache.hadoop.conf.Configuration configuration,
String label,
T value)
Utility to publish a value to a configuration. |
|
static org.apache.hadoop.fs.Path |
sortListing(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.Path sourceListing)
Sort sequence file containing FileStatus and Text as key and value respecitvely |
|
static CopyListingFileStatus |
toCopyListingFileStatus(org.apache.hadoop.fs.FileSystem fileSystem,
org.apache.hadoop.fs.FileStatus fileStatus,
boolean preserveAcls,
boolean preserveXAttrs,
boolean preserveRawXAttrs)
Converts a FileStatus to a CopyListingFileStatus. |
|
static EnumSet<DistCpOptions.FileAttribute> |
unpackAttributes(String attributes)
Unpacks preservation attribute string containing the first character of each preservation attribute back to a set of attributes to preserve |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DistCpUtils()
| Method Detail |
|---|
public static long getFileSize(org.apache.hadoop.fs.Path path,
org.apache.hadoop.conf.Configuration configuration)
throws IOException
path - The path of the file whose size is sought.configuration - Configuration, to retrieve the appropriate FileSystem.
IOException, - on failure.
IOException
public static <T> void publish(org.apache.hadoop.conf.Configuration configuration,
String label,
T value)
T - The type of the value.configuration - The Configuration to which the value must be written.label - The label for the value being published.value - The value being published.
public static int getInt(org.apache.hadoop.conf.Configuration configuration,
String label)
configuration - The Configuration in which the key is sought.label - The key being sought.
public static long getLong(org.apache.hadoop.conf.Configuration configuration,
String label)
configuration - The Configuration in which the key is sought.label - The key being sought.
public static Class<? extends org.apache.hadoop.mapreduce.InputFormat> getStrategy(org.apache.hadoop.conf.Configuration conf,
DistCpOptions options)
conf - - Configuration objectoptions - - Handle to input options
public static String getRelativePath(org.apache.hadoop.fs.Path sourceRootPath,
org.apache.hadoop.fs.Path childPath)
sourceRootPath - - Source root pathchildPath - - Path for which relative path is required
public static String packAttributes(EnumSet<DistCpOptions.FileAttribute> attributes)
attributes - - Attribute set to preserve
public static EnumSet<DistCpOptions.FileAttribute> unpackAttributes(String attributes)
attributes - - Attribute string
public static void preserve(org.apache.hadoop.fs.FileSystem targetFS,
org.apache.hadoop.fs.Path path,
CopyListingFileStatus srcFileStatus,
EnumSet<DistCpOptions.FileAttribute> attributes,
boolean preserveRawXattrs)
throws IOException
targetFS - - File systempath - - Path that needs to preserve original file statussrcFileStatus - - Original file statusattributes - - Attribute set that needs to be preservedpreserveRawXattrs - if true, raw.* xattrs should be preserved
IOException - - Exception if any (particularly relating to group/owner
change or any transient error)
public static List<org.apache.hadoop.fs.permission.AclEntry> getAcl(org.apache.hadoop.fs.FileSystem fileSystem,
org.apache.hadoop.fs.FileStatus fileStatus)
throws IOException
fileSystem - FileSystem containing the filefileStatus - FileStatus of file
IOException - if there is an I/O error
public static Map<String,byte[]> getXAttrs(org.apache.hadoop.fs.FileSystem fileSystem,
org.apache.hadoop.fs.Path path)
throws IOException
fileSystem - FileSystem containing the filepath - file path
IOException - if there is an I/O error
public static CopyListingFileStatus toCopyListingFileStatus(org.apache.hadoop.fs.FileSystem fileSystem,
org.apache.hadoop.fs.FileStatus fileStatus,
boolean preserveAcls,
boolean preserveXAttrs,
boolean preserveRawXAttrs)
throws IOException
fileSystem - FileSystem containing the filefileStatus - FileStatus of filepreserveAcls - boolean true if preserving ACLspreserveXAttrs - boolean true if preserving XAttrspreserveRawXAttrs - boolean true if preserving raw.* XAttrs
IOException - if there is an I/O error
public static org.apache.hadoop.fs.Path sortListing(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.Path sourceListing)
throws IOException
fs - - File Systemconf - - ConfigurationsourceListing - - Source listing file
IOException - - Any exception during sort.
public static void checkFileSystemAclSupport(org.apache.hadoop.fs.FileSystem fs)
throws CopyListing.AclsNotSupportedException
fs - FileSystem to check
CopyListing.AclsNotSupportedException - if fs does not support ACLs
public static void checkFileSystemXAttrSupport(org.apache.hadoop.fs.FileSystem fs)
throws CopyListing.XAttrsNotSupportedException
fs - FileSystem to check
CopyListing.XAttrsNotSupportedException - if fs does not support XAttrspublic static DecimalFormat getFormatter()
public static String getStringDescriptionFor(long nBytes)
public static boolean checksumsAreEqual(org.apache.hadoop.fs.FileSystem sourceFS,
org.apache.hadoop.fs.Path source,
org.apache.hadoop.fs.FileChecksum sourceChecksum,
org.apache.hadoop.fs.FileSystem targetFS,
org.apache.hadoop.fs.Path target)
throws IOException
sourceFS - FileSystem for the source path.source - The source path.sourceChecksum - The checksum of the source file. If it is null we
still need to retrieve it through sourceFS.targetFS - FileSystem for the target path.target - The target path.
IOException - if there's an exception while retrieving checksums.
public static boolean compareFs(org.apache.hadoop.fs.FileSystem srcFs,
org.apache.hadoop.fs.FileSystem destFs)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||