Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync local <> external database #195

Open
MentalGear opened this issue Dec 10, 2021 · 5 comments
Open

Sync local <> external database #195

MentalGear opened this issue Dec 10, 2021 · 5 comments

Comments

@MentalGear
Copy link

MentalGear commented Dec 10, 2021

First: Thank you for this amazing graph database. It's awesome that it is usable local as well as server-side, however, I have been wondering how to sync a local and a server-side levelgraph database?

For example, I would like to have an offline-first local/browser levelgraph db that syncs (auto-magically) when online with a levelgraph node.js backend.
Would this be possible with levelgraph, or through an integration with rxdb / pouchdb possible maybe ?

@finwo
Copy link
Member

finwo commented Dec 12, 2021

Levelgraph should work with any levelup-compatible storage interface that handles encoding as well, so it doesn't care if you use level-mem, level or something completely custom.

While I haven't tested it myself, it should be feasible to write a custom leveldown adapter for indexedDb (or whatever you fancy) which saves created/updated timestamps, allowing you to sync the underlying storage with a remote machine.

Is there a specific use-case you might need such functionality for over pouchdb?

@MentalGear
Copy link
Author

Thanks for your reply @finwo. Regarding use-case: I would like to use levelgrah in an offline-first electron app for project management. At the beginning, I want to save data locally only but would like to keep open the possibility (and lay the groundwork) for server-side sync for collaborative features.

@finwo
Copy link
Member

finwo commented Dec 18, 2021

For an offline-first electron app, I'd probably go with PouchDB (which in turn runs on top of leveldb as well).

If you really want to use levelgraph for that purpose, you could look into the level/awesome#shared-access list, which should provide common level interfaces compatible with levelgraph.

Levelgraph itself does not support replication in any way, as that is not part of the scope of the library (triple storage and queries).

@MentalGear
Copy link
Author

MentalGear commented Dec 19, 2021 via email

@namaljayathunga
Copy link

@MentalGear Did you find a solution for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants