Skv (short for "SQLite Key-Value Store") is a project to modernize Firefox's key-value storage stack for front-end and platform consumers. Its source code lives in the Firefox source tree, as an "in-tree" Rust crate.
This repo is a space for prototyping, testing, and benchmarking ideas that aren't quite ready to land in Firefox yet, with the goal of upstreaming them eventually.
Our goal is to take what we've learned from working on sync and storage in Firefox, and use that experience to create a storage library that feels accessible to other Firefox engineers.
Provide a CRUD interface for persisting key-value pairs. Think localStorage
on the web, DataStore
on Android, or NSUbiquitousKeyValueStore
on iOS; but for Firefox features implemented in C++ and privileged JavaScript.
Use SQLite, with best practices that we've learned from using it in Firefox and Application Services.
Hide database connection management, maintenance, and underlying schema migrations from front-end and platform consumers.
Back up database contents periodically, and detect and recover from on-disk database file corruption.
Allow multiple processes to access a database. This would be useful for sharing state between the Firefox main process and non-content child processes.
Shipping Skv as a standalone Rust crate. This would be interesting to explore for our out-of-tree consumers, and could also be useful for sharing state directly between the front-end, Android Components, and GeckoView in Firefox for Android.
Syncing key-value databases. This could help us burn down our "sync more things" list.
Building an object store, in the style of IndexedDB or Core Data.
Building a syncable, state-of-the-art knowledge store for Firefox. If you're curious about prior art in this area, Richard Newman's "Project Mentat" series and summary are great reading!
Replacing the existing cross-platform syncable data stores in Firefox. Saved passwords, addresses, and credit cards are existing key-value-shaped data that Firefox syncs between desktop and mobile. It's not a goal to replace the persistent storage for these features with Skv.
Storing large (> 100 KB) data blobs. Most Firefox features that need persistence want to store user content, settings, and small binary blobs. It may be more efficient to store larger blobs directly on the filesystem.