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

Interface consistency with random-access-memory #6

aral opened this Issue Feb 14, 2019 · 0 comments


None yet
1 participant
Copy link

aral commented Feb 14, 2019

Moving a project from using random-access-memory to random-access-idb should involve simply changing the require statement (the random-access-storage group states that the projects share the same interface).

Instead, currently you also have to instantiate the database with a name.


const storage = require('random-access-memory')
const db = hyperdb((filename) => storage(filename), …)


const _storage = require('random-access-idb')
const storage = _storage('my-lovely-database-name')
const db = hyperdb((filename) => storage(filename), …)

This confused me when going from random-access-memory to random-access-idb in my latest spike.

We should either:

  • Unify the interfaces. (I’m not sure there is a safe way to do that given that the database name is important)
  • Document the inconsistency.

I suggest we go with the latter. Not sure where’s best to document it. Here or in the hypercore/db/drive examples or the getting starts docs? (I’m assuming that starting with random-access-memory for prototyping and moving to *-idb and *-file is a common use case.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.