Level / community

Discussion, support and common information for projects in the community.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add options to approximateSize & compactRange

vweevers opened this issue · comments

If you do:

const db = require('level')('db') // or similar
db.approximateSize('a', 'b', { valueEncoding: 'json' }, callback)

Then encoding-down correctly encodes the start (a) and end (b) arguments as JSON, but it also passes the options argument down to leveldown, which doesn't support that: it expects a callback at that index.

Add options to approximateSize() and compactRange() in:

  • leveldown
    • PR or commit: pending
    • Release: pending
  • rocksdb
    • PR or commit: pending
    • Release: pending
  • leveldown-hyper

Similarly, iterator.seek() and chained batch operations (Level/levelup#633) don't support encoding options. In general, all methods should start following the basic signature fn(..., options, callback).

Done in classic-level (not on npm yet), including for seek(). I will also add it to rocks-level, the yet-to-be-written replacement for rocksdb. These fixes will not be backported to leveldown or rocksdb.