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

Replace old memdb with level-mem #57

Merged
merged 1 commit into from
Sep 16, 2019
Merged

Conversation

vweevers
Copy link
Contributor

This gives you:

  • Continued compatibility with subleveldown. That it still worked on memdb was luck.
  • Continued maintenance
  • Latest streams (readable-stream)
  • New features: db.clear(), db.iterator(), promise support, iterator.seek()
  • Various fixes in the handling of binary keys (though y'all are not using that atm)
  • Latest memdown internally stores data as buffers, which makes it fully compatible with leveldown (mixing strings and buffers is OK now). There could be a perf boost here because values can skip a Buffer.from(string) step but that's negated by a new conversion cost on keys (buf.toString()).
  • I also added a buffer: true property to the custom JSON encoding used here. Not really needed because it defaults to true in most places, but it signals to underlying stores that data should be fetched as a buffer rather than a string, which avoids a conversion cost.

Caveats:

  • Minimum node version is 6.
  • null and undefined keys and values are rejected
  • Conversely, null and undefined range options are now valid ({ gt: null } is not the same as {}).

@hackergrrl hackergrrl merged commit f1518cd into cabal-club:master Sep 16, 2019
@hackergrrl
Copy link
Member

hackergrrl commented Sep 16, 2019 via email

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

Successfully merging this pull request may close these issues.

2 participants