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

Adding ability to remove all keys #49

Closed ryan-summers closed 1 week ago

ryan-summers commented 3 months ago

Fixes https://github.com/tweedegolf/sequential-storage/issues/47 by adding a remove_all_items() function to map to erase all of the saved keys using an overwrite mechanism. This prevents needing to erase device flash, which could take a long time.

The benefit of this approach is that flash erasure counts are minimized, as you need to loop through all of flash before anything ever needs to be erased.

I haven't tested this on hardware yet, so leaving it as a draft.

ryan-summers commented 1 month ago

It turns out our platform is not capable of remove_item calls, so I cannot test this, but it seems that we could still add this if desired.

diondokter commented 1 month ago

I think it's a nice API to have. So let's leave the PR open for now until I have time to pick it up.

Thanks for the work so far!