...
|
...
|
@@ -33,12 +33,12 @@ const creator = (server, path, value, iscover) => new Promise((resolve, reject) |
|
|
client.once('connected', function () {
|
|
|
_exists(client, path).then(stat => {
|
|
|
if (stat && iscover) {
|
|
|
client.setData(path, new Buffer(val.toString()), function(err, data, stat) {
|
|
|
client.setData(path, new Buffer(value.toString()), function(err, data, stat) {
|
|
|
if (err) {
|
|
|
console.log('update path %s data error');
|
|
|
resolve(false);
|
|
|
} else {
|
|
|
console.log('path %s data change to', path, val);
|
|
|
console.log('path %s data change to', path, value);
|
|
|
resolve(true);
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -92,7 +92,7 @@ const getter = (server, path) => new Promise((resolve, reject) => { |
|
|
client.connect();
|
|
|
});
|
|
|
|
|
|
const setter = (server, path, val) => new Promise((resolve, reject) => {
|
|
|
const setter = (server, path, value) => new Promise((resolve, reject) => {
|
|
|
const client = zookeeper.createClient(server);
|
|
|
|
|
|
client.once('connected', function () {
|
...
|
...
|
@@ -103,7 +103,7 @@ const setter = (server, path, val) => new Promise((resolve, reject) => { |
|
|
console.log('update path %s data error');
|
|
|
resolve(false);
|
|
|
} else {
|
|
|
console.log('path %s data change to', path, val);
|
|
|
console.log('path %s data change to', path, value);
|
|
|
resolve(true);
|
|
|
}
|
|
|
|
...
|
...
|
|