Skip to main content

StorageHandler

Trait StorageHandler 

Source
pub trait StorageHandler: AsAny {
    // Required methods
    fn list_from(
        &self,
        path: &Url,
    ) -> DeltaResult<Box<dyn Iterator<Item = DeltaResult<FileMeta>>>>;
    fn read_files(
        &self,
        files: Vec<FileSlice>,
    ) -> DeltaResult<Box<dyn Iterator<Item = DeltaResult<Bytes>>>>;
    fn copy_atomic(&self, src: &Url, dest: &Url) -> DeltaResult<()>;
    fn put(&self, path: &Url, data: Bytes, overwrite: bool) -> DeltaResult<()>;
    fn head(&self, path: &Url) -> DeltaResult<FileMeta>;
}
Expand description

Provides file system related functionalities to Delta Kernel.

Delta Kernel uses this handler whenever it needs to access the underlying file system where the Delta table is present. Connector implementation of this trait can hide filesystem specific details from Delta Kernel.

Required Methods§

Source

fn list_from( &self, path: &Url, ) -> DeltaResult<Box<dyn Iterator<Item = DeltaResult<FileMeta>>>>

List the paths in the same directory that are lexicographically greater than (UTF-8 sorting) the given path. The result should also be sorted by the file name.

If the path is directory-like (ends with ‘/’), the result should contain all the files in the directory.

Source

fn read_files( &self, files: Vec<FileSlice>, ) -> DeltaResult<Box<dyn Iterator<Item = DeltaResult<Bytes>>>>

Read data specified by the start and end offset from the file.

Source

fn copy_atomic(&self, src: &Url, dest: &Url) -> DeltaResult<()>

Copy a file atomically from source to destination. If the destination file already exists, it must return Err(Error::FileAlreadyExists).

Source

fn put(&self, path: &Url, data: Bytes, overwrite: bool) -> DeltaResult<()>

Write data to the specified path.

If overwrite is false and the file already exists, this must return Err(Error::FileAlreadyExists).

Source

fn head(&self, path: &Url) -> DeltaResult<FileMeta>

Perform a HEAD request for the given file at a Url, returning the file metadata.

If the file does not exist, this must return an Err with Error::FileNotFound.

Implementors§