Idea via @SourceR85 in #9167 (comment)
OPFS Link
Things to consider:
- How can we ensure transactionality between two different data stores?
- IndexedDB transactions auto-commit on the end of the runloop, so we cannot do asynchronous tasks inside an IndexedDB transaction
- OPFS has a synchronous file access API, but that is only available in a worker for not-blocking-the-main-thread reasons
- A possible solution could write the attachments first and then start the IndexedDB transaction, but if the transaction fails, we might leave unreferenced attachments in OPFS that do not show up in IndexedDB. For that we would need a cleanup task that is not too expensive, so we can run it during compaction