Upgrade to latest Level modules#15
Conversation
| abstract.AbstractLevelDOWN.call(this, path) | ||
| function Multilevel (opts) { | ||
| if (!(this instanceof Multilevel)) return new Multilevel(opts) | ||
| abstract.AbstractLevelDOWN.call(this) |
There was a problem hiding this comment.
abstract-leveldown no longer needs a location (aka path here).
|
|
||
| util.inherits(Multilevel, abstract.AbstractLevelDOWN) | ||
|
|
||
| Multilevel.prototype.type = 'multileveldown' |
There was a problem hiding this comment.
This is for compatibility with reachdown, which I also intend to start using in subleveldown, level-test and more.
|
|
||
| Multilevel.prototype.forward = function (down) { | ||
| this._db = down | ||
| this._db = reachdown(down, matchdown, false) |
There was a problem hiding this comment.
This peels off levelup, deferred-leveldown and encoding-down.
|
|
||
| Multilevel.prototype._serializeValue = function (value) { | ||
| return Buffer.isBuffer(value) ? value : Buffer.from(String(value)) | ||
| } |
There was a problem hiding this comment.
This ensures we're only working with buffers internally.
| id: 0, | ||
| key: key, | ||
| valueEncoding: opts.valueEncoding || (opts.asBuffer === false ? 'utf-8' : 'binary'), | ||
| valueAsBuffer: opts.asBuffer, |
There was a problem hiding this comment.
We no longer have access to key/ValueEncoding options here, but we don't need it. We only have to care about returning a buffer or string (which at a higher level, is dictated by encoding-down and the user's choice of encoding).
|
|
||
| function ready () { | ||
| var down = db.db | ||
| var down = reachdown(db, matchdown, false) |
There was a problem hiding this comment.
This peels off levelup, deferred-leveldown and encoding-down.
| } | ||
|
|
||
| this._iterator = down.iterator(req.options) | ||
| this._iterator = down.iterator(cleanRangeOptions(req.options)) |
There was a problem hiding this comment.
Because null and undefined are valid range options in latest abstract-leveldown, we must strip them from the options object.
|
@vweevers Any chance of seeing this and Do you think we should do a proper fork? |
|
We can move these modules to Level if @mafintosh is cool with that. |
|
Would be really nice, I'm currently stuck on Node 8 because I'm using |
|
I’m very cool with that! |
|
Thanks @mafintosh! Do we need @substack for moving |
Semver-major. Goes hand-in-hand with a
level-partyPR which I'll open shortly. Achieves the following:memdown, which now internally stores keys+values as Buffers, making it more reliable as aleveldownreplacementdbthat isn'tlevel(may or may not havelevelup,encoding-down,deferred-leveldownlayers, and may have additional layers)level-partyneeds on themultileveldownclient, so thatlevel-partydoesn't have to reach down (e.g.db.db)subleveldownonlevel-partysubleveldownonmultileveldownclient (i.e. for client-side sublevels)multileveldownserver onsubleveldown(i.e. to expose only a sublevel to client)