Liking cljdoc? Tell your friends :D

konserve.indexeddb


connect-idb-storecljs

(connect-idb-store db-name & {:as params})

Connect to a IndexedDB backed KV store with the given db name. Optional serializer, read-handlers, write-handlers.

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 2022 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

  • PBackingBlob/-read-binary returns a webstream that is not queued to the value offset in the same way that the filestore implementations are. Consumers must discard the amount of bytes found in the :offset key of the locked-cb arg map. See: https://developer.mozilla.org/en-US/docs/Web/API/Blob/stream

Connect to a IndexedDB backed KV store with the given db name.
Optional serializer, read-handlers, write-handlers.

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 2022 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

+ PBackingBlob/-read-binary returns a webstream that is *not* queued to the
value offset in the same way that the filestore implementations are. Consumers
must discard the amount of bytes found in the :offset key of the locked-cb
arg map. See: https://developer.mozilla.org/en-US/docs/Web/API/Blob/stream
sourceraw docstring

db-exists?cljs

(db-exists? db-name)
source

delete-idbcljs

(delete-idb db-name)
source

flush-blobcljs

(flush-blob {:keys [db key buf header metadata value] :as bb})
source

list-dbscljs

(list-dbs)
source

open-backing-blobcljs

(open-backing-blob db key)
source

read-blobcljs

(read-blob db key)
source

write-blobcljs

(write-blob db key blob)
source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close