lib/zookeeper.js
function updatePersistentPath(client, path, data, callback) {
  debug('updatePersistentPath: "%s" "%s"', path, data);

  data = ensureBuffer(data);

  client.setData(path, data, function (err) {
    if (err) {
      if (err.code !== NO_NODE)
        return callback(err);

      createParentPath(client, path, function(err) {
        if (err) return callback(err);

        client.create(path, data, function(err) {
          if (err) {
            if (err.code !== NODE_EXISTS)
              return callback(err);
            client.setData(path, data, callback);
          } else
            callback(null);
        });
      });
    } else
      callback(null);
  });
}
function updatePersistentPath(client, path, data, callback) {
  debug('updatePersistentPath: "%s" "%s"', path, data);

  data = ensureBuffer(data);

  client.setData(path, data, function (err) {
    if (err) {
      if (err.code !== NO_NODE)
        return callback(err);

      createParentPath(client, path, function(err) {
        if (err) return callback(err);

        client.create(path, data, function(err) {
          if (err) {
            if (err.code !== NODE_EXISTS)
              return callback(err);
            client.setData(path, data, callback);
          } else
            callback(null);
        });
      });
    } else
      callback(null);
  });
}
function updatePersistentPath ( client , path , data , callback ) { debug ( 'updatePersistentPath: "%s" "%s"' , path , data ) ; data = ensureBuffer ( data ) ; client . setData ( path , data , function ( err ) { if ( err ) { if ( err . code !== NO_NODE ) return callback ( err ) ; createParentPath ( client , path , function ( err ) { if ( err ) return callback ( err ) ; client . create ( path , data , function ( err ) { if ( err ) { if ( err . code !== NODE_EXISTS ) return callback ( err ) ; client . setData ( path , data , callback ) ; } else callback ( null ) ; } ) ; } ) ; } else callback ( null ) ; } ) ; }
Update the value of a persistent node with the given path and data.
create parrent directory if necessary. Never return NO_NODE error.
@param {ZkClient} client
@param {String} path
@param {String|Buffer} data
@param {Function} callback
Update the value of a persistent node with the given path and data . create parrent directory if necessary . Never return NO_NODE error .