public class DefaultFileSystemClient extends Object implements FileSystemClient
FileSystemClient
based on Hadoop APIs. It takes a Hadoop Configuration
object to interact with the file system. The following optional configurations can
be set to customize the behavior of the client:
io.delta.kernel.logStore.<scheme>.impl
- The class name of the custom LogStore
implementation to use for operations on storage systems with the specified scheme
. For example, to use a custom LogStore
for S3 storage objects:
<property>
<name>io.delta.kernel.logStore.s3.impl</name>
<value>com.example.S3LogStore</value>
</property>
If not set, the default LogStore implementation for the scheme will be used.
delta.enableFastS3AListFrom
- Set to true
to enable fast listing
functionality when using a LogStore
created for S3 storage objects.
FileSystem
.Constructor and Description |
---|
DefaultFileSystemClient(org.apache.hadoop.conf.Configuration hadoopConf)
Create an instance of the default
FileSystemClient implementation. |
Modifier and Type | Method and Description |
---|---|
boolean |
delete(String path)
Delete the file at given path.
|
CloseableIterator<FileStatus> |
listFrom(String filePath)
List the paths in the same directory that are lexicographically greater or equal to (UTF-8
sorting) the given `path`.
|
boolean |
mkdirs(String path)
Create a directory at the given path including parent directories.
|
CloseableIterator<java.io.ByteArrayInputStream> |
readFiles(CloseableIterator<FileReadRequest> readRequests)
Return an iterator of byte streams one for each read request in
readRequests . |
String |
resolvePath(String path)
Resolve the given path to a fully qualified path.
|
public DefaultFileSystemClient(org.apache.hadoop.conf.Configuration hadoopConf)
FileSystemClient
implementation.hadoopConf
- Configuration to use. List of options to customize the behavior of the client
can be found in the class documentation.public CloseableIterator<FileStatus> listFrom(String filePath) throws java.io.IOException
FileSystemClient
listFrom
in interface FileSystemClient
filePath
- Fully qualified path to a filejava.io.FileNotFoundException
- if the file at the given path is not foundjava.io.IOException
- for any other IO error.public String resolvePath(String path) throws java.io.IOException
FileSystemClient
resolvePath
in interface FileSystemClient
path
- Input pathjava.io.FileNotFoundException
- If the given path doesn't exist.java.io.IOException
- for any other IO error.public CloseableIterator<java.io.ByteArrayInputStream> readFiles(CloseableIterator<FileReadRequest> readRequests)
FileSystemClient
readRequests
. The
returned streams are in the same order as the given FileReadRequest
s. It is the
responsibility of the caller to close each returned stream.readFiles
in interface FileSystemClient
readRequests
- Iterator of read requestsByteArrayInputStream
.public boolean mkdirs(String path) throws java.io.IOException
FileSystemClient
mkdirs
in interface FileSystemClient
path
- Full qualified path to create a directory at.java.io.IOException
- for any IO error.public boolean delete(String path) throws java.io.IOException
FileSystemClient
delete
in interface FileSystemClient
path
- the path to delete. If path is a directory throws an exception.java.io.IOException
- for any IO error.