zookeeper-hd
Advanced tools
Comparing version 0.3.1 to 0.3.2
@@ -142,2 +142,6 @@ // This file has been generated from coffee source files | ||
FakeZookeeper.prototype.connect = function(cb) { | ||
return cb(); | ||
}; | ||
FakeZookeeper.prototype._stat = function(node) { | ||
@@ -144,0 +148,0 @@ return { |
// This file has been generated from coffee source files | ||
var PlusClient, SimpleClient, async, _; | ||
var PlusClient, SimpleClient, async, path, _; | ||
@@ -11,2 +11,4 @@ SimpleClient = require('./SimpleClient'); | ||
path = require('path'); | ||
module.exports = PlusClient = (function() { | ||
@@ -22,2 +24,3 @@ function PlusClient(options) { | ||
PlusClient.prototype.create = function(zkPath, value, options, onReady) { | ||
var _this = this; | ||
if (!onReady) { | ||
@@ -33,5 +36,17 @@ onReady = options; | ||
options = _.defaults(options, { | ||
flags: null | ||
flags: null, | ||
createPathIfNotExists: false | ||
}); | ||
return this.client.create(zkPath, value, options.flags, onReady); | ||
return async.waterfall([ | ||
function(asyncReady) { | ||
if (!options.createPathIfNotExists) { | ||
return asyncReady(); | ||
} | ||
return _this.createPathIfNotExists(path.dirname(zkPath), options, asyncReady); | ||
}, function(asyncReady) { | ||
return _this.client.create(zkPath, value, options.flags, asyncReady); | ||
} | ||
], function(err, path) { | ||
return onReady(err, path); | ||
}); | ||
}; | ||
@@ -165,2 +180,3 @@ | ||
PlusClient.prototype.set = function(zkPath, value, version, options, onReady) { | ||
var _this = this; | ||
if (!onReady) { | ||
@@ -170,3 +186,17 @@ onReady = options; | ||
} | ||
return this.client.set(zkPath, value, version, onReady); | ||
options = _.defaults(options, { | ||
createPathIfNotExists: false | ||
}); | ||
return async.waterfall([ | ||
function(asyncReady) { | ||
if (!options.createPathIfNotExists) { | ||
return asyncReady(); | ||
} | ||
return _this.createPathIfNotExists(zkPath, options, asyncReady); | ||
}, function(asyncReady) { | ||
return _this.client.set(zkPath, value, version, asyncReady); | ||
} | ||
], function(err, stat) { | ||
return onReady(err, stat); | ||
}); | ||
}; | ||
@@ -173,0 +203,0 @@ |
@@ -19,2 +19,5 @@ // This file has been generated from coffee source files | ||
} | ||
if (arguments.length <= 3) { | ||
return onData(null, data1); | ||
} | ||
return onData(null, data1, data2); | ||
@@ -21,0 +24,0 @@ }; |
@@ -21,3 +21,3 @@ // This file has been generated from coffee source files | ||
}); | ||
mockery.registerAllowables(['../../src/lib/PlusClient', 'async', 'underscore']); | ||
mockery.registerAllowables(['../../src/lib/PlusClient', 'async', 'underscore', 'path']); | ||
mockery.registerMock('./SimpleClient', SimpleClientStub); | ||
@@ -24,0 +24,0 @@ return PlusClient = require('../../src/lib/PlusClient'); |
{ | ||
"name": "zookeeper-hd", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "Higher level (normalized) zookeeper client", | ||
@@ -5,0 +5,0 @@ "author": "Hans Donner", |
@@ -59,2 +59,5 @@ zookeeper-hd | ||
See [coffeescript | js]/test/integration/FakePlusClient for an example where only the original zookeeper | ||
module is changed (using mockery), and the PlusClient is used to perform zookeeper actions | ||
Various | ||
@@ -61,0 +64,0 @@ ------- |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
242857
53
2025
73