(connect-idb-store db-name & {:as params})Connect to a IndexedDB backed KV store with the given db name.
This implementation stores all values as js/Blobs in an IndexedDB object store instance. The object store itself is nameless, and there is no use of versioning, indexing, or cursors.
This data is stored as if indexedDB was a filesystem. Since we do not have file-descriptors to write with, strategy is to build a blob from components (js/Blobs have a nice api explicitly for this) and flush the blob to indexeddb storage on -sync-store calls (which doesnt concern consumers)
all store ops are asynchronous only
the database object must be 'unref'ed by calling db.close() before database instances can be deleted. You can do this easily by calling store.close() object method, which is unique to this impl. If you fail to maintain access to db and core.async gets into a weird state due to an unhandled error, you will be unable to delete the database until the vm is restarted
As of November 2023 firefox does not support IDBFactory.databases() so expect list-dbs, db-exists?, & PBackingStore/-store-exists? to all throw. You must work around this by keeping track of each db name you intend to delete https://developer.mozilla.org/en-US/docs/Web/API/IDBFactory/databases#browser_compatibility
konserve.core/bget locked-cb arg is given a webstream that is not queued
to the value offset in the same way that the filestore implementations are.
See: https://developer.mozilla.org/en-US/docs/Web/API/Blob/stream
konserve.indexeddb/read-web-stream will accept the argument to the
locked-cb and return a promise-chan receiving err|bytes at the cost of
allocating a larger array for the chunks to be copied intoConnect to a IndexedDB backed KV store with the given db name.
This implementation stores all values as js/Blobs in an IndexedDB
object store instance. The object store itself is nameless, and there
is no use of versioning, indexing, or cursors.
This data is stored as if indexedDB was a filesystem. Since we do not have
file-descriptors to write with, strategy is to build a blob from components
(js/Blobs have a nice api explicitly for this) and flush the blob to
indexeddb storage on -sync-store calls (which doesnt concern consumers)
+ all store ops are asynchronous only
+ the database object must be 'unref'ed by calling db.close() before database
instances can be deleted. You can do this easily by calling store.close()
object method, which is unique to this impl. If you fail to maintain access to
db and core.async gets into a weird state due to an unhandled error, you
will be unable to delete the database until the vm is restarted
+ As of November 2023 firefox does not support IDBFactory.databases() so
expect list-dbs, db-exists?, & PBackingStore/-store-exists? to all throw. You
must work around this by keeping track of each db name you intend to delete
https://developer.mozilla.org/en-US/docs/Web/API/IDBFactory/databases#browser_compatibility
+ `konserve.core/bget` locked-cb arg is given a webstream that is *not* queued
to the value offset in the same way that the filestore implementations are.
See: https://developer.mozilla.org/en-US/docs/Web/API/Blob/stream
- consumers must discard the amount of bytes found in the :offset key of
the locked-cb arg map. These bytes are meta data for konserve and not
part of the value you are retrieving
- `konserve.indexeddb/read-web-stream` will accept the argument to the
locked-cb and return a promise-chan receiving err|bytes at the cost of
allocating a larger array for the chunks to be copied into(multi-delete-blobs db store-keys)Execute multiple delete operations in a single IndexedDB transaction. All operations either succeed or all fail (atomic). Returns a map of store-keys to boolean indicating if the blob existed.
Execute multiple delete operations in a single IndexedDB transaction. All operations either succeed or all fail (atomic). Returns a map of store-keys to boolean indicating if the blob existed.
(multi-read-blobs db store-keys)Execute multiple read operations in a single IndexedDB transaction. Returns a sparse map of {store-key -> BackingBlob} for found keys only. Missing keys are excluded from the result map.
Execute multiple read operations in a single IndexedDB transaction.
Returns a sparse map of {store-key -> BackingBlob} for found keys only.
Missing keys are excluded from the result map.(multi-write-blobs db store-key-values)Execute multiple write operations in a single IndexedDB transaction. All operations either succeed or all fail (atomic).
Execute multiple write operations in a single IndexedDB transaction. All operations either succeed or all fail (atomic).
(read-web-stream {:keys [input-stream offset]})Accepts the bget locked callback arg and returns a promise-chan containing
a concatenated byte array with the first offset bytes dropped
(k/bget store :key read-web-stream)
Accepts the bget locked callback arg and returns a promise-chan containing a concatenated byte array with the first offset bytes dropped `(k/bget store :key read-web-stream)`
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |