|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.hadoop.fs.HardLink
public class HardLink
Class for creating hardlinks. Supports Unix/Linux, WinXP/2003/Vista via Cygwin, and Mac OS X. The HardLink class was formerly a static inner class of FSUtil, and the methods provided were blatantly non-thread-safe. To enable volume-parallel Update snapshots, we now provide static threadsafe methods that allocate new buffer string arrays upon each call. We also provide an API to hardlink all files in a directory with a single command, which is up to 128 times more efficient - and minimizes the impact of the extra buffer creations.
Nested Class Summary | |
---|---|
static class |
HardLink.LinkStats
HardLink statistics counters and methods. |
static class |
HardLink.OSType
|
Field Summary | |
---|---|
HardLink.LinkStats |
linkStats
|
static HardLink.OSType |
osType
|
Constructor Summary | |
---|---|
HardLink()
|
Method Summary | |
---|---|
static void |
createHardLink(File file,
File linkName)
Creates a hardlink |
static void |
createHardLinkMult(File parentDir,
String[] fileBaseNames,
File linkDir)
Creates hardlinks from multiple existing files within one parent directory, into one target directory. |
protected static int |
createHardLinkMult(File parentDir,
String[] fileBaseNames,
File linkDir,
int maxLength)
|
static int |
getLinkCount(File fileName)
Retrieves the number of links to the specified file. |
protected static int |
getLinkMultArgLength(File fileDir,
String[] fileBaseNames,
File linkDir)
Calculate the nominal length of all contributors to the total commandstring length, including fixed overhead of the OS-dependent command. |
protected static int |
getMaxAllowedCmdArgLength()
Return this private value for use by unit tests. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static HardLink.OSType osType
public final HardLink.LinkStats linkStats
Constructor Detail |
---|
public HardLink()
Method Detail |
---|
protected static int getLinkMultArgLength(File fileDir, String[] fileBaseNames, File linkDir) throws IOException
fileDir
- - source directory, parent of fileBaseNamesfileBaseNames
- - array of path-less file names, relative
to the source directorylinkDir
- - target directory where the hardlinks will be put
IOException
protected static int getMaxAllowedCmdArgLength()
public static void createHardLink(File file, File linkName) throws IOException
file
- - existing source filelinkName
- - desired target link file
IOException
public static void createHardLinkMult(File parentDir, String[] fileBaseNames, File linkDir) throws IOException
parentDir
- - directory containing source filesfileBaseNames
- - list of path-less file names, as returned by
parentDir.list()linkDir
- - where the hardlinks should be put. It must already exist.
If the list of files is too long (overflows maxAllowedCmdArgLength),
we will automatically split it into multiple invocations of the
underlying method.
IOException
protected static int createHardLinkMult(File parentDir, String[] fileBaseNames, File linkDir, int maxLength) throws IOException
IOException
public static int getLinkCount(File fileName) throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |