Interface FileSystemClient


@Evolving public interface FileSystemClient
Provides file system related functionalities to Delta Kernel. Delta Kernel uses this client whenever it needs to access the underlying file system where the Delta table is present. Connector implementation of this interface can hide filesystem specific details from Delta Kernel.
Since:
3.0.0
  • Method Details

    • listFrom

      CloseableIterator<FileStatus> listFrom(String filePath) throws IOException
      List the paths in the same directory that are lexicographically greater or equal to (UTF-8 sorting) the given `path`. The result should also be sorted by the file name.
      Parameters:
      filePath - Fully qualified path to a file
      Returns:
      Closeable iterator of files. It is the responsibility of the caller to close the iterator.
      Throws:
      FileNotFoundException - if the file at the given path is not found
      IOException - for any other IO error.
    • resolvePath

      String resolvePath(String path) throws IOException
      Resolve the given path to a fully qualified path.
      Parameters:
      path - Input path
      Returns:
      Fully qualified path.
      Throws:
      FileNotFoundException - If the given path doesn't exist.
      IOException - for any other IO error.
    • readFiles

      Return an iterator of byte streams one for each read request in readRequests. The returned streams are in the same order as the given FileReadRequests. It is the responsibility of the caller to close each returned stream.
      Parameters:
      readRequests - Iterator of read requests
      Returns:
      Data for each request as one ByteArrayInputStream.
      Throws:
      IOException
    • mkdirs

      boolean mkdirs(String path) throws IOException
      Create a directory at the given path including parent directories. This mimicks the behavior of `mkdir -p` in Unix.
      Parameters:
      path - Full qualified path to create a directory at.
      Returns:
      true if the directory was created successfully, false otherwise.
      Throws:
      IOException - for any IO error.
    • delete

      boolean delete(String path) throws IOException
      Delete the file at given path.
      Parameters:
      path - the path to delete. If path is a directory throws an exception.
      Returns:
      true if delete is successful else false.
      Throws:
      IOException - for any IO error.
    • getFileStatus

      FileStatus getFileStatus(String path) throws IOException
      Get the metadata of the file at the given path.
      Parameters:
      path - Fully qualified path to the file.
      Returns:
      Metadata of the file.
      Throws:
      IOException - for any IO error.
    • copyFileAtomically

      void copyFileAtomically(String srcPath, String destPath, boolean overwrite) throws IOException
      Atomically copy a file from source path to destination path. The copy operation should be atomic to ensure that the destination file is either fully copied or not present at all.
      Parameters:
      srcPath - Fully qualified path to the source file to copy
      destPath - Fully qualified path to the destination where the file will be copied
      overwrite - If true, overwrite the destination file if it already exists. If false, throw an exception if the destination exists.
      Throws:
      FileAlreadyExistsException - if the destination file already exists and overwrite is false.
      FileNotFoundException - if the source file does not exist
      IOException - for any other IO error