Package io.datarouter.filesystem.raw
Class PathService
java.lang.Object
io.datarouter.filesystem.raw.PathService
@Singleton public class PathService extends Object
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPathService.CheckedPathService -
Constructor Summary
Constructors Constructor Description PathService() -
Method Summary
Modifier and Type Method Description voiddelete(Path fullPath)List<Path>listChildren(Path fullPath, Set<String> excludingFilenames, int limit, boolean sorted)static StringpathToString(Path path)io.datarouter.scanner.Scanner<List<Path>>scanDescendantsPaged(Path fullPath, boolean includeDirectories, boolean sorted)Recursively scan directories, optionally sorting them in String ordering, since the filesystem may return them in any order, which is often the order that sub-directories were added to a parent.Longsize(Path path)
-
Constructor Details
-
PathService
public PathService()
-
-
Method Details
-
pathToString
-
listChildren
-
scanDescendantsPaged
public io.datarouter.scanner.Scanner<List<Path>> scanDescendantsPaged(Path fullPath, boolean includeDirectories, boolean sorted)Recursively scan directories, optionally sorting them in String ordering, since the filesystem may return them in any order, which is often the order that sub-directories were added to a parent. This allows us to mimic the "list" operation provided by S3 or GCS.- Parameters:
fullPath- Path from the root of the filesystem or relative to the execution point.includeDirectories- False for results similar to an object store like S3 or GCSsorted- If true, sort each sub-directory before recursing, so that full paths match String sorting.- Returns:
- Lists of Paths grouped by leaf directory, with the leaf directory as the first Path in each List. In the case of a directory with mixed sub-directories and files, group consecutive files into the same List. The number of Lists tries to approximate the number of filesystem operations, but it's probably over-counting by returning each directory as a singleton list.
-
size
-
delete
-