webtessera/storage/indexeddb
Keeps a Tessera log in an IndexedDB database, so that a browser tab, worker or service worker can run a log of its own.
It has no Go counterpart: it is an addition of webtessera’s.
Its source is src/storage/indexeddb/index.ts.
Functions
newIndexedDBDriver- newIndexedDBDriver opens the IndexedDB database called cfg.name, creating it if it does not exist, and returns a storage driver that keeps the log in it. signal bounds the database connection's lifetime as newAppender's signal bounds the appender's background work: aborting it abandons opening or, once the database is open, closes the connection.
openIndexedDBObjectStore- openIndexedDBObjectStore opens the IndexedDB database called opts.name, creating it if it does not exist, and returns an ObjectStore backed by it.
Interfaces
IndexedDBDriver- IndexedDBDriver is the storage driver newIndexedDBDriver returns: the shared ObjectStoreDriver, plus the lock scope of the store it runs on.
IndexedDBDriverConfig- IndexedDBDriverConfig configures newIndexedDBDriver.
IndexedDBObjectStore- IndexedDBObjectStore is an ObjectStore kept in an IndexedDB database.
IndexedDBObjectStoreOptions- IndexedDBObjectStoreOptions configures openIndexedDBObjectStore.
Types
LockScope- LockScope says which contexts an IndexedDBObjectStore's locks exclude. "origin" means locks are taken through the Web Locks API and exclude every tab, window and worker of the origin, which is also everything that can open the same IndexedDB database. "realm" means the Web Locks API was unavailable and locks only exclude holders in the current JavaScript realm (the current tab or worker): two contexts that write the same log concurrently would then corrupt it, which is why a store only runs with this scope when opened with singleWriter: true.
Constants and variables
ErrClosed- ErrClosed is the cause of every error reported by an IndexedDBObjectStore whose database connection has been closed, whether by close, by another tab or worker upgrading or deleting the database, or by the browser.