mafintosh / hyperdb

Distributed scalable database
MIT License
753 stars 75 forks source link

Persistent hyperdb in browser #96

Closed peacememories closed 6 years ago

peacememories commented 6 years ago

I've been trying to get a persistent hyperdb to work in my browser for the past 2 days. The problem is that hyperdb expects random-access-storage based storage as its backend, and the only existing implementation that works in the browser is random-access-memory, which is volatile. This would mean that everytime my browser tab is reloaded it will lose its content and when it connects to peers it will need to be reauthorized.

I've tried frankensteining together level-browserify and random-access-memory, but this is very error prone. Is there a backend for hyperdb that supports persistent browser storage? or maybe another way of preserving the key and replaying changes without breaking the database?

caiogondim commented 6 years ago

I myself never tried, but hope that helps https://github.com/substack/random-access-idb

joehand commented 6 years ago

I myself never tried, but hope that helps https://github.com/substack/random-access-idb

:+1: this works with hyperdrive, should work with hyperdb as well.

mafintosh commented 6 years ago

What @joehand said :) Feel free to re-open if you're having issues

eklem commented 5 years ago

Did you ever get this to work, @peacememories ?

peacememories commented 5 years ago

I can’t quite remember (I never did finish that project) but I think I had success with random-access-idb

joehand commented 5 years ago

@eklem you can try random-access-web as well: https://github.com/random-access-storage/random-access-web

eklem commented 5 years ago

Thanks @joehand!