Class LocalCacheDirectoryManager
java.lang.Object
org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.LocalCacheDirectoryManager
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.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddecrementFileCountForPath(String relPath) This method will reduce the file count for the directory represented by path.static org.apache.hadoop.fs.PathgetCacheDirectoryRoot(org.apache.hadoop.fs.Path path) Given a path to a directory within a local cache tree return the root of the cache directory.This method will return relative path from the first available vacant directory.voidincrementFileCountForPath(String relPath) Increment the file count for a relative directory within the cache
-
Field Details
-
DIRECTORIES_PER_LEVEL
public static final int DIRECTORIES_PER_LEVEL- See Also:
-
-
Constructor Details
-
LocalCacheDirectoryManager
public LocalCacheDirectoryManager(org.apache.hadoop.conf.Configuration conf)
-
-
Method Details
-
getRelativePathForLocalization
This method will return relative path from the first available vacant directory.- Returns:
Stringrelative path for localization
-
decrementFileCountForPath
This method will reduce the file count for the directory represented by path. The root directory of this Local cache directory manager is represented by an empty string. -
incrementFileCountForPath
Increment the file count for a relative directory within the cache- Parameters:
relPath- the relative path
-
getCacheDirectoryRoot
public 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.- Parameters:
path- the directory within a cache directory- Returns:
- the local cache directory root or null if not found
-