-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an implementation of kvdb on top of IndexedDB #182
Comments
I think the main problem is that From https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStoreSync:
|
Oh, I see. Maybe a better approach is simply to keep the database in memory (like The use case is a light client whose database is probably very small. I imagine that the light client will somehow warp-sync in the future, and storing the database is mostly an optimization. |
While trying to make this work, I've encountered a bunch of issues: Some problems of localStorage:
IndexDB API is not ready yet
I'm not sure what is the expected size of of the substrate light client db, but we could implement it with localStorage first and migrate to IndexDB later (I imagine having an in-memory hashmap in both cases, reading the whole db into the memory on startup and writing async in case of indexdb). wasm-bindgen limitations
This means that kvdb EDIT: the wasm-bindgen limitations are only relevant if we want to expose the |
Add an implementation of the
kvdb
traits on top of the Web IndexedDB API: https://developer.mozilla.org/fr/docs/Web/API/API_IndexedDBThe bindings to IndexedDB are already present in the
web_sys
crate (https://docs.rs/web-sys/0.3.24/web_sys/struct.IdbFactory.html?search=Idb), and we should use this crate to access IndexedDB.The use-case for this is running Substrate (or parity-ethereum?) from within a browser.
I'm personally not very familiar with neither
kvdb
nor IndexedDB, so there might or might not be problems that I can't think of.The text was updated successfully, but these errors were encountered: