Data node notify the name node that it is alive
Return an array of block-oriented commands for the datanode to execute.
This will be either a transfer or a delete operation.
970057
public DatanodeCommand[] sendHeartbeat(DatanodeRegistration nodeReg,
                                       long capacity,
                                       long dfsUsed,
                                       long remaining,
                                       long namespaceUsed,
                                       int xmitsInProgress,
                                       int xceiverCount) throws IOException {
    verifyRequest(nodeReg);
    myMetrics.numHeartbeat.inc();
    return namesystem.handleHeartbeat(nodeReg, capacity, dfsUsed, remaining, namespaceUsed,
        xceiverCount, xmitsInProgress);
  }
439511
private void invalidateBlock(Block blk, DatanodeInfo dn, boolean ackRequired)
    throws IOException {
    NameNode.stateChangeLog.info("DIR* NameSystem.invalidateBlock: "
      + blk + " on "
      + dn.getName());
    DatanodeDescriptor node = getDatanode(dn);
    if (node == null) {
      throw new IOException("Cannot invalidate block " + blk +
        " because datanode " + dn.getName() +
        " does not exist.");
    }

    // Check how many copies we have of the block.  If we have at least one
    // copy on a live node, then we can delete it.
    int count = countNodes(blk).liveReplicas();
    if (count > 1) {
      // delete with ACK
      addToInvalidates(blk, dn, ackRequired);
      removeStoredBlock(blk, node);
      if (NameNode.stateChangeLog.isDebugEnabled()) {
        NameNode.stateChangeLog.debug("BLOCK* NameSystem.invalidateBlocks: "
          + blk + " on "
          + dn.getName() + " listed for deletion.");
      }
    } else {
      NameNode.stateChangeLog.info("BLOCK* NameSystem.invalidateBlocks: "
        + blk + " on "
        + dn.getName() + " is the only copy and was not deleted.");
    }
  }
595708
public DatanodeCommand[] sendHeartbeat(DatanodeRegistration registration,
                                       long capacity,
                                       long dfsUsed, long remaining,
                                       long namespaceUsed,
                                       int xmitsInProgress,
                                       int xceiverCount) throws IOException {
    throw new IOException("sendHeartbeat" + errMessage);
  }
700323
def on_security_data_node(self, node):
        
        sid = XmlHelper.get_child_value(node, 'security')
        farr = node.GetElement('fieldData')
        dmap = defaultdict(list)
        for i in range(farr.NumValues):
            pt = farr.GetValue(i)
            [dmap[f].append(XmlHelper.get_child_value(pt, f, allow_missing=1)) for f in ['date'] + self.fields]
        idx = dmap.pop('date')
        frame = DataFrame(dmap, columns=self.fields, index=idx)
        frame.index.name = 'date'
        self.response[sid] = frame
1053355
def node_properties
      result = {}
      api_nodes.each do |data|
        next if data['deactivated']
        # in '/v3/nodes' we must take 'name'
        name = data['certname']
        values = data.dup
        %w[deactivated certname].each { |key| values.delete(key) }
        result[name] = values
      end
      result
    end
724428
function processNode(node) {
            const entity = node.code.trim()
            if (!entity) {
                context.report({
                    node,
                    messageId: "missing",
                })
            }
        }
466286
def handle_available(node, snapshots)
      reconcile(node)

      # no-op if we already know about this node
      return if @master == node || (@master && @slaves.include?(node))
      logger.info("Handling available node: #{node}")

      if @master
        # master already exists, make a slave
        node.make_slave!(@master)
        @slaves << node
      else
        # no master exists, make this the new master
        promote_new_master(snapshots, node)
      end

      @unavailable.delete(node)
    end
739849
private void populateDatanodeMetrics(ArrayList<DatanodeDescriptor> live,
      ArrayList<DatanodeDescriptor> dead) {

    DatanodeStatus status = FSNamesystemDatanodeHelper.getDatanodeStats(fsNameSystem,
        live, dead);

    // populate metrics
    numLiveNodes.set(status.numLive);
    numLiveExcludedNodes.set(status.numLiveExcluded);
    numLiveDecommissioningInProgressNodes.set(status.numLiveDecommissioningInProgress);
    numLiveDecommissioned.set(status.numLiveDecommissioned);

    numDeadNodes.set(status.numDead);
    numDeadExcludedNodes.set(status.numDeadExcluded);
    numDeadDecommissioningNotCompletedNodes.set(status.numDeadDecommissioningNotCompleted);
    numDeadDecommissioned.set(status.numDeadDecommissioned);
  }
521125
function(node){
    if (!node) this.expect('atblock');
    node = new nodes.Atblock;
    this.state.push('atblock');
    node.block = this.block(node, false);
    this.state.pop();
    return node;
  }
996356
def setCurrentNode(self, node):
        
        self.blockSignals(True)
        self.clearSelection()
        if node:
            node.setSelected(True)
        self.blockSignals(False)
824190
boolean add(DatanodeDescriptor node) {
    hostmapLock.writeLock().lock();
    try {
      if (node==null || contains(node)) {
        return false;
      }
      
      String host = node.getHost();
      DatanodeDescriptor[] nodes = map.get(host);
      DatanodeDescriptor[] newNodes;
      if (nodes==null) {
        newNodes = new DatanodeDescriptor[1];
        newNodes[0]=node;
      } else { // rare case: more than one datanode on the host
        newNodes = new DatanodeDescriptor[nodes.length+1];
        System.arraycopy(nodes, 0, newNodes, 0, nodes.length);
        newNodes[nodes.length] = node;
      }
      map.put(host, newNodes);
      return true;
    } finally {
      hostmapLock.writeLock().unlock();
    }
  }
361816
boolean remove(DatanodeDescriptor node) {
    if (node==null) {
      return false;
    }
      
    String host = node.getHost();
    hostmapLock.writeLock().lock();
    try {

      DatanodeDescriptor[] nodes = map.get(host);
      if (nodes==null) {
        return false;
      }
      if (nodes.length==1) {
        if (nodes[0]==node) {
          map.remove(host);
          return true;
        } else {
          return false;
        }
      }
      //rare case
      int i=0;
      for(; i<nodes.length; i++) {
        if (nodes[i]==node) {
          break;
        }
      }
      if (i==nodes.length) {
        return false;
      } else {
        DatanodeDescriptor[] newNodes;
        newNodes = new DatanodeDescriptor[nodes.length-1];
        System.arraycopy(nodes, 0, newNodes, 0, i);
        System.arraycopy(nodes, i+1, newNodes, i, nodes.length-i-1);
        map.put(host, newNodes);
        return true;
      }
    } finally {
      hostmapLock.writeLock().unlock();
    }
  }
949637
public void removeDatanode(DatanodeID nodeID)
    throws IOException {
    writeLock();
    try {
      DatanodeDescriptor nodeInfo = getDatanode(nodeID);
      if (nodeInfo != null) {
        removeDatanode(nodeInfo);
      } else {
        NameNode.stateChangeLog.warn("BLOCK* NameSystem.removeDatanode: "
          + nodeID.getName() + " does not exist");
      }
    } finally {
      writeUnlock();
    }
  }
404604
static private DatanodeInfo bestNode(DatanodeInfo nodes[],
                               ConcurrentHashMap<DatanodeInfo, Long> deadNodes,
                               Collection<DatanodeInfo> unfavoredNodes,
                               Collection<DatanodeInfo> ignoredNodes)
                                throws IOException {
    InjectionHandler.processEventIO(InjectionEvent.DFSCLIENT_BEFORE_BEST_NODE,
        nodes, deadNodes);
    
    if (nodes != null) {
      // First try to find a node which is not included in favored ndoe list
      for (int i = 0; i < nodes.length; i++) {
        if (!deadNodes.containsKey(nodes[i])
            && (unfavoredNodes == null || !unfavoredNodes.contains(nodes[i]))
            && (ignoredNodes == null || !ignoredNodes.contains(nodes[i]))) {
            return nodes[i];
        }
      }

      // All live nodes are un-favored. Ignore the unfavor setting
      for (int i = 0; i < nodes.length; i++) {
        if (!deadNodes.containsKey(nodes[i])
            && (ignoredNodes == null || !ignoredNodes.contains(nodes[i]))) {
            return nodes[i];
        }
      }
    }
    return null;
  }
868719
def generate_node_command(node_command, command, send_command, description)
      node_command.desc description
      node_command.command command do |generated_command|
        generated_command.action do |global_options,options,args|
          environment = get_environment(options)
          info _('cli.current_environment')%{environment: environment}
          Bebox::NodeWizard.new.send(send_command, project_root, environment)
        end
      end
    end
1266216
def nodes_callback(self, data):
        
        for node_id, tags, coords in data:
            # Discard the coords because they go into add_coords
            self.nodes[node_id] = tags
315669
function getData(node, name) {
    var id = node[exp], store = id && data[id]
    if (name === undefined) return store || setData(node)
    else {
      if (store) {
        if (name in store) return store[name]
        var camelName = camelize(name)
        if (camelName in store) return store[camelName]
      }
      return dataAttr.call($(node), name)
    }
  }