lib/druid.js
function getNodeData(client, id, callback) {
  var path = client.discoveryPath + '/' + id
    , preferSSL = client.options.preferSSL

  client.zk.getData(path, handleData)

  function handleData(err, jsonBuffer) {
    if (err) {
      return callback(new DruidError('Error getting node data', err))
    }

    debug('ZooKeeper data for path ' + path + ': ' + jsonBuffer)

    var data
      , proto
      , port

    try {
      data = JSON.parse(jsonBuffer.toString('utf8'))
    }
    catch (ex) {
      return callback(ex)
    }

    if (preferSSL && data.sslPort) {
      proto = 'https'
      port = data.sslPort
    }
    else {
      proto = 'http'
      port = data.port
    }

    data.path = path
    data.url = util.format('%s://%s:%s', proto, data.address, port)

    getDataSources(data, callback)
  }
}
function getNodeData(client, id, callback) {
  var path = client.discoveryPath + '/' + id
    , preferSSL = client.options.preferSSL

  client.zk.getData(path, handleData)

  function handleData(err, jsonBuffer) {
    if (err) {
      return callback(new DruidError('Error getting node data', err))
    }

    debug('ZooKeeper data for path ' + path + ': ' + jsonBuffer)

    var data
      , proto
      , port

    try {
      data = JSON.parse(jsonBuffer.toString('utf8'))
    }
    catch (ex) {
      return callback(ex)
    }

    if (preferSSL && data.sslPort) {
      proto = 'https'
      port = data.sslPort
    }
    else {
      proto = 'http'
      port = data.port
    }

    data.path = path
    data.url = util.format('%s://%s:%s', proto, data.address, port)

    getDataSources(data, callback)
  }
}
function getNodeData ( client , id , callback ) { var path = client . discoveryPath + '/' + id , preferSSL = client . options . preferSSL client . zk . getData ( path , handleData ) function handleData ( err , jsonBuffer ) { if ( err ) { return callback ( new DruidError ( 'Error getting node data' , err ) ) } debug ( 'ZooKeeper data for path ' + path + ': ' + jsonBuffer ) var data , proto , port try { data = JSON . parse ( jsonBuffer . toString ( 'utf8' ) ) } catch ( ex ) { return callback ( ex ) } if ( preferSSL && data . sslPort ) { proto = 'https' port = data . sslPort } else { proto = 'http' port = data . port } data . path = path data . url = util . format ( '%s://%s:%s' , proto , data . address , port ) getDataSources ( data , callback ) } }
Get Druid node data from ZooKeeper and list of data sources

@private
@param {Druid} client Client instance
@param {string} id Druid Node ID
@param {function} callback Accepts arguments: (err, nodeData)
Get Druid node data from ZooKeeper and list of data sources