public class LocalCacheDirectoryManager extends Object
LocalCacheDirectoryManager
is used for managing hierarchical
directories for local cache. It will allow to restrict the number of files in
a directory to
YarnConfiguration.NM_LOCAL_CACHE_MAX_FILES_PER_DIRECTORY
which
includes 36 sub-directories (named from 0 to 9 and a to z). Root directory is
represented by an empty string. It internally maintains a vacant directory
queue. As soon as the file count for the directory reaches its limit; new
files will not be created in it until at least one file is deleted from it.
New sub directories are not created unless a
getRelativePathForLocalization()
request
is made and nonFullDirectories are empty.
Note : this structure only returns relative localization path but doesn't
create one on disk.Modifier and Type | Field and Description |
---|---|
static int |
DIRECTORIES_PER_LEVEL |
Constructor and Description |
---|
LocalCacheDirectoryManager(org.apache.hadoop.conf.Configuration conf) |
Modifier and Type | Method and Description |
---|---|
void |
decrementFileCountForPath(String relPath)
This method will reduce the file count for the directory represented by
path.
|
static org.apache.hadoop.fs.Path |
getCacheDirectoryRoot(org.apache.hadoop.fs.Path path)
Given a path to a directory within a local cache tree return the
root of the cache directory.
|
String |
getRelativePathForLocalization()
This method will return relative path from the first available vacant
directory.
|
void |
incrementFileCountForPath(String relPath)
Increment the file count for a relative directory within the cache
|
public static final int DIRECTORIES_PER_LEVEL
public LocalCacheDirectoryManager(org.apache.hadoop.conf.Configuration conf)
public String getRelativePathForLocalization()
String
relative path for localizationpublic void decrementFileCountForPath(String relPath)
public void incrementFileCountForPath(String relPath)
relPath
- the relative pathpublic static org.apache.hadoop.fs.Path getCacheDirectoryRoot(org.apache.hadoop.fs.Path path)
path
- the directory within a cache directoryCopyright © 2008–2023 Apache Software Foundation. All rights reserved.