Level-Multiply
Make your LevelUP get()
, put()
and del()
accept multiples keys & values.
Augment the standard implementations to take multiple keys and values and do the correct thing with them:
var levelup = levelMultiply =
Hey! Don't molest my original methods!
OK, perhaps this causes problems for you because you're using JSON keys, so an operation like: get([ 'foo', 'bar' ]...)
is a legitimate call because it could be converted to a key of '["foo","bar"]'
. In this case, Level-Multiply is going to get in your way and intercept those calls. Or perhaps you just don't like monkey patching; fair enough.
Atomicity
Both put()
and del()
operations are converted directly to batch()
operations so your entries will be put or deleted atomically. As we don't (quite) yet have snapshots exposed through LevelUP/LevelDOWN there are no equivalent consistency guarantees about get()
. While they will be queued asynchronously and will likely happen sequentially, or close to sequentially ... but they may not. If this kind of consistency is important to you then file an issue on LevelUP or LevelDOWN and moan about having snapshots implemented; once they are available, a multi-get()
operation can operate on a consistent point-in-time view of the database.
Licence
Level-Multiply is Copyright (c) 2013 Rod Vagg @rvagg and licensed under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.