public class DirectoryCleaner extends Object
Modifier and Type | Field and Description |
---|---|
static int |
MAX_NUMBER_OF_FILES_FOR_DIR |
Constructor and Description |
---|
DirectoryCleaner(StormMetricsRegistry metricsRegistry) |
Modifier and Type | Method and Description |
---|---|
org.apache.storm.daemon.logviewer.utils.DeletionMeta |
deleteOldestWhileTooLarge(List<Path> dirs,
long quota,
boolean forPerDir,
Set<Path> activeDirs)
If totalSize of files exceeds the either the per-worker quota or global quota,
Logviewer deletes oldest inactive log files in a worker directory or in all worker dirs.
|
List<Path> |
getFilesForDir(Path dir)
Lists files in directory.
|
DirectoryStream<Path> |
getStreamForDirectory(Path dir)
Creates DirectoryStream for give directory.
|
public static final int MAX_NUMBER_OF_FILES_FOR_DIR
public DirectoryCleaner(StormMetricsRegistry metricsRegistry)
public DirectoryStream<Path> getStreamForDirectory(Path dir) throws IOException
dir
- File instance representing specific directoryIOException
public org.apache.storm.daemon.logviewer.utils.DeletionMeta deleteOldestWhileTooLarge(List<Path> dirs, long quota, boolean forPerDir, Set<Path> activeDirs) throws IOException
dirs
- the list of directories to be scanned for deletionquota
- the per-dir quota or the total quota for the all directoriesforPerDir
- if true, deletion happens for a single dir; otherwise, for all directories globallyactiveDirs
- only for global deletion, we want to skip the active logs in activeDirsIOException
public List<Path> getFilesForDir(Path dir) throws IOException
dir
- directory to get file listIOException
Copyright © 2023 The Apache Software Foundation. All rights reserved.