janl opened a new issue, #9163:
URL: https://github.com/apache/pouchdb/issues/9163
## Introduction
Running `npm i` creates a large number of warning about out of date
dependencies. Many of these come from the LevelDB ecosystem, that CouchDB uses
for Node.js persistence.
I have tried to update our dependencies to latest LevelDB releases, but I
found two major issues:
1. We are relying on an older version of the ecosystem. It has undergone a
major rewrite and we’d have to adapt to the new system in many many places.
2. The new ecosystem is also barely maintained. We have open issues about
`npm i` failing on ARM systems because of a Python build incompatibility.
I do not think going forward, the LevelDB is a good choice for Node.js
persistence for PouchDB.
## The Future
Instead, Node.js and other server-side JS runtimes have adopted SQLite as a
standard part of their distributions.
And PouchDB used to have a WebSQL adapter (that is compatible with SQLite).
I have done a proof of concept to have PouchDB run on Node.js with its
built-in SQLite module and it works fine, thanks to all the existing code we
have from the WebSQL days.
This would also open us to support the other runtimes if we wanted to, and
it makes it easier to bundle PouchDB with native-wrapped mobile web apps that
want to use SQLite for better persistence (WebKit/Safari evacuate all local
data after 7 days).
## The Path
To make sure we do not let folks that still rely on LevelDB, we should
support a forward migration path. This is what this could look like:
1. Release a PouchDB version that adds SQLite support to node builds and
keeps LevelDB support as is.
- People using LevelDB can use this version to do a one-time migration via
replication to SQLite
2. The next major version of PouchDB after that will remove the LevelDB
ecosystem and make PouchDB more lean and lighter of deprecated or abandoned
dependencies.
I am happy to provide my proof of concept as a starting point for this
transition to the project.
## Consequences
The LevelDB abstraction is very useful and supports multiple backends, not
just LevelDB. The project would lose this additional flexibility, but given
where the JS ecosystem is going, I think this is the right call to make today.
One of these abstractions is an in-memory adapter for PouchDB which is used
in testing of PouchDB and its plugins a lot. The replacement SQLite adapter
should allow for SQLite in-memory databases to achieve the same.
## Discussion
What do you think?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]