StorageBackend::get_into is the main way to read a file. Currently, it simply reads the entire file from the storage backend, and copies it to the Writer. But that's inefficient for sparse files. It would be better if it understood sparse files, and could synthesize zeros as needed. This would require:
- Adding an
lseek method to the trait
- Implementing the
lseek method for the FS backend
- Within
get_into, iterating through the file using lseek with SEEK_HOLE and SEEK_DATA
- Copying data from the storage backend for every data region
- Synthesizing zeros for every hole region
Alternatively, this change could be made entirely within the FS backend by returning a custom object that implements tokio::io::AsyncRead but is hole-aware, and synthesizes zeros as needed.