tweedegolf / sequential-storage

A crate for storing data in flash memory with minimal need for erasing pages
Apache License 2.0
87 stars 8 forks source link

Idea: filesystem-like API on top of sequential-storage #54

Open diondokter opened 2 months ago

diondokter commented 2 months ago

I think a nice filesystem api could be built on top of the existing map.

It would have APIs for creating and deleting files. A file would then have APIs for for reading, writing and seeking. It would be challenging to create, but it should be possible.

Obviously it wouldn't really be compatible with anything. But it'd save on using e.g. littlefs2.

If you've got interest in this or have ideas, then make sure to post here!

paulyoung commented 2 months ago

I don’t know much about this project but I saw your post on Mastodon and thought you might be interested in the approach I took in https://github.com/codebase-labs/icfs

  • icfs provides implementations of std::io::{Read, Write, Seek} backed by stable memory to enable the use of existing Rust code that requires implementations of these traits.
  • icfs-fatfs uses icfs to leverage the fatfs crate in providing a FAT file system. All this currently does is implement a fatfs::TimeProvider backed by ic_cdk::api::time()

Basically, by only implementing a few traits I was able to leverage some existing crates that had already done most of the work.

I provided a Unix-style API and had plans to work on one similar to std::fs so that it felt familiar.

Perhaps if https://github.com/rust-lang/libs-team/issues/293 got some traction, that would be a nice approach.