[Pkg-javascript-commits] [node-leveldown] 89/492: emit raw values in events

Andrew Kelley andrewrk-guest at moszumanska.debian.org
Sun Jul 6 17:13:47 UTC 2014


This is an automated email from the git hooks/post-receive script.

andrewrk-guest pushed a commit to annotated tag rocksdb-0.10.1
in repository node-leveldown.

commit 2e6bf80b99e008159daf359fceb9f9ffe0ae5a5c
Author: Raynos <raynos2 at gmail.com>
Date:   Fri Nov 23 20:17:45 2012 -0800

    emit raw values in events
---
 lib/levelup.js | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/lib/levelup.js b/lib/levelup.js
index 496dbdf..431cbaa 100644
--- a/lib/levelup.js
+++ b/lib/levelup.js
@@ -147,13 +147,13 @@ LevelUP.prototype = {
       }
     }
 
-  , put: function (key, value, options_, callback_) {
-      var callback, options, err
+  , put: function (key_, value_, options_, callback_) {
+      var callback, options, err, key, value
 
       if (!this.isOpen() && !this.isClosed()) {
         // limbo, defer the operation
         return this.once('ready', function () {
-          this.put(key, value, options_, callback_)
+          this.put(key_, value_, options_, callback_)
         })
       }
 
@@ -161,8 +161,8 @@ LevelUP.prototype = {
 
       if (this.isOpen()) {
         options  = getOptions(options_, this._options)
-        key      = toBuffer(key,   options.keyEncoding   || options.encoding)
-        value    = toBuffer(value, options.valueEncoding || options.encoding)
+        key      = toBuffer(key_,   options.keyEncoding   || options.encoding)
+        value    = toBuffer(value_, options.valueEncoding || options.encoding)
         this._db.put(key, value, options, function (err) {
           if (err) {
             err = new errors.WriteError(err)
@@ -170,7 +170,7 @@ LevelUP.prototype = {
               return callback(err)
             this.emit('error', err)
           } else {
-            this.emit('put', key, value)
+            this.emit('put', key_, value_)
             // Node 0.9 bug, do this in current tick and a copy() operation will core dump
             callback && process.nextTick(callback.bind(null, null, key, value))
           }
@@ -183,13 +183,13 @@ LevelUP.prototype = {
       }
     }
 
-  , del: function (key, options_, callback_) {
-      var callback, options, err
+  , del: function (key_, options_, callback_) {
+      var callback, options, err, key
 
       if (!this.isOpen() && !this.isClosed()) {
         // limbo, defer the operation
         return this.once('ready', function () {
-          this.del(key, options_, callback_)
+          this.del(key_, options_, callback_)
         })
       }
 
@@ -197,7 +197,7 @@ LevelUP.prototype = {
 
       if (this.isOpen()) {
         options  = getOptions(options_, this._options)
-        key      = toBuffer(key,   options.keyEncoding   || options.encoding)
+        key      = toBuffer(key_,   options.keyEncoding   || options.encoding)
         this._db.del(key, options, function (err) {
           if (err) {
             err = new errors.WriteError(err)
@@ -205,7 +205,7 @@ LevelUP.prototype = {
               return callback(err)
             this.emit('error', err)
           } else {
-            this.emit('del', key)
+            this.emit('del', key_)
             callback && callback(null, key)
           }
         }.bind(this))
@@ -217,12 +217,12 @@ LevelUP.prototype = {
       }
     }
 
-  , batch: function (arr, options_, callback_) {
-      var callback, options, keyEncoding, valueEncoding, err
+  , batch: function (arr_, options_, callback_) {
+      var callback, options, keyEncoding, valueEncoding, err, arr
 
       if (!this.isOpen() && !this.isClosed()) {
         return this.once('ready', function () {
-          this.batch(arr, options_, callback_)
+          this.batch(arr_, options_, callback_)
         })
       }
 
@@ -238,7 +238,7 @@ LevelUP.prototype = {
       options       = getOptions(options_, this._options)
       keyEncoding   = options.keyEncoding   || options.encoding
       valueEncoding = options.valueEncoding || options.encoding
-      arr           = arr.map(function (e) {
+      arr           = arr_.map(function (e) {
         if (e.type !== undefined && e.key !== undefined) {
           var o = {
               type  : e.type
@@ -257,8 +257,8 @@ LevelUP.prototype = {
             return callback(err)
           this.emit('error', err)
         } else {
-          this.emit('batch', arr)
-          callback && callback()
+          this.emit('batch', arr_)
+          callback && callback(null, arr)
         }
       }.bind(this))
     }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-leveldown.git



More information about the Pkg-javascript-commits mailing list