@LimitedPrivate({"HDFS","MapReduce"})
@Unstable
public class LocalDirAllocator
extends java.lang.Object
| Modifier and Type | Field | Description |
|---|---|---|
static int |
SIZE_UNKNOWN |
Used when size of file to be allocated is unknown.
|
| Constructor | Description |
|---|---|
LocalDirAllocator(java.lang.String contextCfgItemName) |
Create an allocator object.
|
LocalDirAllocator(java.lang.String contextCfgItemName,
DiskValidator diskValidator) |
| Modifier and Type | Method | Description |
|---|---|---|
java.io.File |
createTmpFileForWrite(java.lang.String pathStr,
long size,
Configuration conf) |
Creates a temporary file in the local FS.
|
java.lang.Iterable<Path> |
getAllLocalPathsToRead(java.lang.String pathStr,
Configuration conf) |
Get all of the paths that currently exist in the working directories.
|
Path |
getLocalPathForWrite(java.lang.String pathStr,
long size,
Configuration conf) |
Get a path from the local FS.
|
Path |
getLocalPathForWrite(java.lang.String pathStr,
long size,
Configuration conf,
boolean checkWrite) |
Get a path from the local FS.
|
Path |
getLocalPathForWrite(java.lang.String pathStr,
Configuration conf) |
Get a path from the local FS.
|
Path |
getLocalPathToRead(java.lang.String pathStr,
Configuration conf) |
Get a path from the local FS for reading.
|
boolean |
ifExists(java.lang.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(java.lang.String contextCfgItemName) |
Method to check whether a context is valid.
|
static void |
removeContext(java.lang.String contextCfgItemName) |
Deprecated.
|
public static final int SIZE_UNKNOWN
public LocalDirAllocator(java.lang.String contextCfgItemName)
contextCfgItemName - contextCfgItemName.public LocalDirAllocator(java.lang.String contextCfgItemName,
DiskValidator diskValidator)
public Path getLocalPathForWrite(java.lang.String pathStr, Configuration conf) throws java.io.IOException
pathStr - the requested path (this will be created on the first
available disk)conf - the Configuration objectjava.io.IOException - raised on errors performing I/O.public Path getLocalPathForWrite(java.lang.String pathStr, long size, Configuration conf) throws java.io.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 objectjava.io.IOException - raised on errors performing I/O.public Path getLocalPathForWrite(java.lang.String pathStr, long size, Configuration conf, boolean checkWrite) throws java.io.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 writablejava.io.IOException - raised on errors performing I/O.public Path getLocalPathToRead(java.lang.String pathStr, Configuration conf) throws java.io.IOException
pathStr - the requested file (this will be searched)conf - the Configuration objectjava.io.IOException - raised on errors performing I/O.public java.lang.Iterable<Path> getAllLocalPathsToRead(java.lang.String pathStr, Configuration conf) throws java.io.IOException
pathStr - the path underneath the rootsconf - the configuration to look up the roots injava.io.IOException - raised on errors performing I/O.public java.io.File createTmpFileForWrite(java.lang.String pathStr,
long size,
Configuration conf)
throws java.io.IOException
pathStr - prefix for the temporary filesize - the size of the file that is going to be writtenconf - the Configuration objectjava.io.IOException - raised on errors performing I/O.public static boolean isContextValid(java.lang.String contextCfgItemName)
contextCfgItemName - contextCfgItemName.@Deprecated
@LimitedPrivate("MapReduce")
public static void removeContext(java.lang.String contextCfgItemName)
contextCfgItemName - contextCfgItemName.public boolean ifExists(java.lang.String pathStr,
Configuration conf)
pathStr - the requested file (this will be searched)conf - the Configuration objectCopyright © 2008–2025 Apache Software Foundation. All rights reserved.