Open jalcine opened 2 years ago
Thanks for reaching out! Random access would indeed be a neat capability to have for a more complete feature set.
Ideally we should be catching random access on implementations that don't support it at compile time. On the other hand this might make ergonomics more complex, and make filesystems with "mixed" support more awkward to handle.
Another option might to hide seekability behind a feature, though that might also not be ideal from an ergonomics and discoverability perspective.
For now I think this looks like a good MVP. One thing that would be pretty neat is to have a basic test coverage of the update_file()
function, to ensure that implementations behave in a predicatable way.
Would you be willing to create a pull request?
I agree re: the ergonomics of things. I think I can experiment with extension-style traits to allow a conventional VfsPath "upgrade" to one that is seekable if the underlying VfsPath implements and able to support it.
That I can! I've opened it at @manuel-woelker/rust-vfs/pull/36
(Originally published at: https://jacky.wtf/2022/7/ZIUy)
I'm working on a union crate for this one and rusqlite that allows it to be used as the underlying storage. I have a branch that implements “random access”, which is vital for the SQLite implementation. I can see this being implemented in a way that would be optional for file systems that didn't support such an operation.
What are some things that are missing or could break here that'd prevent this from being made mainline? I could also see this being implemented as a trait for underlying
VfsPath
file systems that also implement a means of producing random access files, so it'd fail at compile time.(Originally published at: https://jacky.wtf/2022/7/lGgU)