-
So I was trying to use the indexedDB backend in a document and at the same time in a Service worker, but it seems it can't be done without issues. I had issues after renaming files, also after creating them, no issues when reading already existing files though (I guess those are always pulled from the indexedDB).
Any plans to support using multiple contexts at the same time?
Any workaround that can be done at the moment to be able to use it this way?
I only need to use fs.promises.readFile() from the service worker, maybe there is a way to just force reloading the file system state before reading to sync the state with the file system saved on the indexedDB?
Beta Was this translation helpful? Give feedback.
All reactions
Hey @davidsm10,
it sounds like you want to use a backend with the same underlying data source in multiple threads.
Currently the only backend with support for this is SingleBuffer.
Multithreading with the same underlying data source is a very difficult problem. Perhaps if the ECMAScript structs proposal is accepted some official support could be added but until then I don't see multithreaded IndexedDB being a thing.
The Port backend is probably what you want, which can be combined with resolveRemoteMount for use across threads.
Replies: 2 comments
-
Hey @davidsm10,
it sounds like you want to use a backend with the same underlying data source in multiple threads.
Currently the only backend with support for this is SingleBuffer.
Multithreading with the same underlying data source is a very difficult problem. Perhaps if the ECMAScript structs proposal is accepted some official support could be added but until then I don't see multithreaded IndexedDB being a thing.
The Port backend is probably what you want, which can be combined with resolveRemoteMount for use across threads.
Beta Was this translation helpful? Give feedback.
All reactions
-
Ok, thanks, I will try the Port backend.
Beta Was this translation helpful? Give feedback.