Skip to content
This repository has been archived by the owner on Jan 22, 2019. It is now read-only.

Add PouchDB Support #32

Open
shrugs opened this issue Jul 21, 2018 · 0 comments · May be fixed by #55
Open

Add PouchDB Support #32

shrugs opened this issue Jul 21, 2018 · 0 comments · May be fixed by #55
Assignees

Comments

@shrugs
Copy link
Member

shrugs commented Jul 21, 2018

PouchDB is a cross-platform database. It's possible to build a database, dump it, and then load it into another PouchDB instance, which is how we'd like to support client-side snapshots (it also supports real-time sync, which is nice for reactive frontends!)

The logic for resuming from a snapshot is:

  1. Drop local databases (reset)
  2. Download the database dump
  3. Load this database dump.
  4. Find the blockHash of the most recent transaction recorded
  5. Restart all reducers from that latestBlockHash

or, when syncing

db.replicate.from(remote)

In this way, a client can download snapshots from trusted third parties (eventually we'll use a decentralized computation network to produce these indexes) and then resume following the index in real-time, locally, block-by-block talking directly to an Ethereum node.

The first step to supporting PouchDB snapshots is to add support to Gnarly's IPersistInterface for talking to PouchDB. By default PouchDB will use an indexeddb adaptor in browser and a leveldb adaptor on node, which is probably fine. If there are any inconsistencies, though, we can use the websql adaptor in browser and the pouchdb-adapter-node-websql adaptor in node (which ends up writing to disk via sqlite).

Use pouchdb-server to persist data serverside.

This was referenced Aug 12, 2018
@shrugs shrugs self-assigned this Aug 13, 2018
@shrugs shrugs linked a pull request Aug 21, 2018 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant