public class LocalDirAllocator extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
SIZE_UNKNOWN
Used when size of file to be allocated is unknown.
|
| 构造器和说明 |
|---|
LocalDirAllocator(String contextCfgItemName)
Create an allocator object
|
| 限定符和类型 | 方法和说明 |
|---|---|
File |
createTmpFileForWrite(String pathStr,
long size,
Configuration conf)
Creates a temporary file in the local FS.
|
Iterable<Path> |
getAllLocalPathsToRead(String pathStr,
Configuration conf)
Get all of the paths that currently exist in the working directories.
|
Path |
getLocalPathForWrite(String pathStr,
Configuration conf)
Get a path from the local FS.
|
Path |
getLocalPathForWrite(String pathStr,
long size,
Configuration conf)
Get a path from the local FS.
|
Path |
getLocalPathForWrite(String pathStr,
long size,
Configuration conf,
boolean checkWrite)
Get a path from the local FS.
|
Path |
getLocalPathToRead(String pathStr,
Configuration conf)
Get a path from the local FS for reading.
|
boolean |
ifExists(String pathStr,
Configuration conf)
We search through all the configured dirs for the file's existence
and return true when we find
|
static boolean |
isContextValid(String contextCfgItemName)
Method to check whether a context is valid
|
public static final int SIZE_UNKNOWN
public LocalDirAllocator(String contextCfgItemName)
contextCfgItemName - public Path getLocalPathForWrite(String pathStr, Configuration conf) throws IOException
pathStr - the requested path (this will be created on the first
available disk)conf - the Configuration objectIOExceptionpublic Path getLocalPathForWrite(String pathStr, long size, Configuration conf) throws IOException
pathStr - the requested path (this will be created on the first
available disk)size - the size of the file that is going to be writtenconf - the Configuration objectIOExceptionpublic Path getLocalPathForWrite(String pathStr, long size, Configuration conf, boolean checkWrite) throws IOException
pathStr - the requested path (this will be created on the first
available disk)size - the size of the file that is going to be writtenconf - the Configuration objectcheckWrite - ensure that the path is writableIOExceptionpublic Path getLocalPathToRead(String pathStr, Configuration conf) throws IOException
pathStr - the requested file (this will be searched)conf - the Configuration objectIOExceptionpublic Iterable<Path> getAllLocalPathsToRead(String pathStr, Configuration conf) throws IOException
pathStr - the path underneath the rootsconf - the configuration to look up the roots inIOExceptionpublic File createTmpFileForWrite(String pathStr, long size, Configuration conf) throws IOException
pathStr - prefix for the temporary filesize - the size of the file that is going to be writtenconf - the Configuration objectIOExceptionpublic static boolean isContextValid(String contextCfgItemName)
contextCfgItemName - public boolean ifExists(String pathStr, Configuration conf)
pathStr - the requested file (this will be searched)conf - the Configuration objectIOExceptionCopyright © 2009 The Apache Software Foundation