Closed Bug 1554316 Opened 5 years ago Closed 2 months ago

Consider allowing consumers to close kvstore

Categories

(Core :: SQLite and Embedded Database Bindings, enhancement, P3)

enhancement

Tracking

()

RESOLVED DUPLICATE of bug 1909409

People

(Reporter: nanj, Unassigned)

Details

In certain cases, it'll be desirable for the kvstore consumers to explicitly close the store and its underlying rkv environment.

Note that all the rkv environments are managed by a global manager, we'd like to consider following cases:

  • Since kvstore::KeyValueDatabase is a tuple of (rkv, store), and there could be multiple stores opened on the same rkv environment. The closing can only be performed when all the stores on that rkv have already been closed.
  • Some kind of protection is required to prevent consumers from using the closed store. Rust lifetime checker would help to enforce that at the compile time, so perhaps some magic in the kvstore.jsm?
Priority: -- → P3
Severity: normal → S3

Oh hi, this was added in bug 1909409 for the new SQLite backend! 🎉

  • Skv's nsIKeyValueDatabase has an async close() method that can close an individual database, and also close the underlying SQLite connection once all its key-value databases have been closed.
  • The coordinator prevents consumers from using the closed stores.
  • Finally, there's a shutdown blocker that prevents new database operations from starting, waits for any outstanding ones to finish, and then closes the underlying connection.
Status: NEW → RESOLVED
Closed: 2 months ago
Duplicate of bug: 1909409
Resolution: --- → DUPLICATE
Product: Toolkit → Core
You need to log in before you can comment on or make changes to this bug.