idb-keyval

This commit is contained in:
Manav Rathi
2024-06-27 14:36:43 +05:30
parent 0def478b0d
commit f0b3c4a30a
5 changed files with 19 additions and 2 deletions

View File

@@ -22,7 +22,6 @@
"fast-srp-hap": "^2.0.4",
"ffmpeg-wasm": "file:./thirdparty/ffmpeg-wasm",
"hdbscan": "0.0.1-alpha.5",
"idb": "^8",
"leaflet": "^1.9.4",
"leaflet-defaulticon-compatibility": "^0.1.1",
"localforage": "^1.9.0",

View File

@@ -172,7 +172,9 @@ For more details, see [translations.md](translations.md).
layer on top of Web Workers to make them more easier to use.
- [idb](https://github.com/jakearchibald/idb) provides a promise API over the
browser-native IndexedDB APIs.
browser-native IndexedDB APIs, and is used as our primary tabular database.
[idb-keyval](https://github.com/jakearchibald/idb-keyval) is its sibling
library that we use for ad-hoc key value storage.
> For more details about IDB and its role, see [storage.md](storage.md).

View File

@@ -28,6 +28,8 @@ IndexedDB is a transactional NoSQL store provided by browsers. It has quite
large storage limits, and data is stored per origin (and remains persistent
across tab restarts).
Unlike local storage, IndexedDB is also accessible from Web Workers.
Older code used the LocalForage library for storing things in Indexed DB. This
library falls back to localStorage in case Indexed DB storage is not available.
@@ -39,6 +41,13 @@ For more details, see:
- https://web.dev/articles/indexeddb
- https://github.com/jakearchibald/idb
## IndexedDB KV
We earlier used local storage for ad-hoc key value storage, but local storage is
not accessible from web workers which we use quite a bit. So now we use _idb_'s
sibling libary, idb-keyval, for storing key value pairs that need to be accessed
from both the main thread and web workers.
## OPFS
OPFS is used for caching entire files when we're running under Electron (the Web

View File

@@ -7,6 +7,8 @@
"@/utils": "*",
"@ente/shared": "*",
"formik": "^2.4",
"idb": "^8",
"idb-keyval": "^6",
"zod": "^3"
},
"devDependencies": {}

View File

@@ -2922,6 +2922,11 @@ i18next@^23.10:
dependencies:
"@babel/runtime" "^7.23.2"
idb-keyval@^6:
version "6.2.1"
resolved "https://registry.yarnpkg.com/idb-keyval/-/idb-keyval-6.2.1.tgz#94516d625346d16f56f3b33855da11bfded2db33"
integrity sha512-8Sb3veuYCyrZL+VBt9LJfZjLUPWVvqn8tG28VqYNFCo43KHcKuq+b4EiXGeuaLAQWL2YmyDgMp2aSpH9JHsEQg==
idb@^8:
version "8.0.0"
resolved "https://registry.yarnpkg.com/idb/-/idb-8.0.0.tgz#33d7ed894ed36e23bcb542fb701ad579bfaad41f"