Class PathService

java.lang.Object
io.datarouter.filesystem.raw.PathService

@Singleton
public class PathService
extends java.lang.Object
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static class  PathService.CheckedPathService  
  • Constructor Summary

    Constructors 
    Constructor Description
    PathService()  
  • Method Summary

    Modifier and Type Method Description
    void delete​(java.nio.file.Path fullPath)  
    java.util.List<java.nio.file.Path> listChildren​(java.nio.file.Path fullPath, java.util.Set<java.lang.String> excludingFilenames, int limit, boolean sorted)  
    static java.lang.String pathToString​(java.nio.file.Path path)  
    io.datarouter.scanner.Scanner<java.util.List<java.nio.file.Path>> scanDescendantsPaged​(java.nio.file.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.
    java.lang.Long size​(java.nio.file.Path path)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • pathToString

      public static java.lang.String pathToString​(java.nio.file.Path path)
    • listChildren

      public java.util.List<java.nio.file.Path> listChildren​(java.nio.file.Path fullPath, java.util.Set<java.lang.String> excludingFilenames, int limit, boolean sorted)
    • scanDescendantsPaged

      public io.datarouter.scanner.Scanner<java.util.List<java.nio.file.Path>> scanDescendantsPaged​(java.nio.file.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 GCS
      sorted - 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

      public java.lang.Long size​(java.nio.file.Path path)
    • delete

      public void delete​(java.nio.file.Path fullPath)