// NodeInfo returns information about the node
545003
func (n *Node) NodeInfo() *p2p.NodeInfo {
	// avoid a panic if the node is not started yet
	if n.Node == nil {
		return nil
	}
	info := n.Node.NodeInfo()
	info.Name = n.Config.Name
	return info
}
1198078
func (n *Node) NodeID() string {
	n.RLock()
	defer n.RUnlock()
	return n.nodeID
}
1338196
func (s *Server) nodeInRing(hostname string, addrs []string) bool {
	a := strings.Join(addrs, "|")
	r, _ := s.r.Nodes().Filter([]string{fmt.Sprintf("meta~=%s.*", hostname)})
	if len(r) != 0 {
		return true
	}
	r, _ = s.r.Nodes().Filter([]string{fmt.Sprintf("address~=%s", a)})
	if len(r) != 0 {
		return true
	}
	return false
}
515195
func (s *CatAllocationService) NodeID(nodes ...string) *CatAllocationService {
	s.nodes = nodes
	return s
}
124921
func (c *client) NodeList() ([]*Node, error) {
	var out []*Node
	uri := fmt.Sprintf(pathNodes, c.addr)
	err := c.get(uri, &out)
	return out, err
}
1300410
func (m *Internal) NodeInfo(args *structs.NodeSpecificRequest,
	reply *structs.IndexedNodeDump) error {
	if done, err := m.srv.forward("Internal.NodeInfo", args, args, reply); done {
		return err
	}

	return m.srv.blockingQuery(
		&args.QueryOptions,
		&reply.QueryMeta,
		func(ws memdb.WatchSet, state *state.Store) error {
			index, dump, err := state.NodeInfo(ws, args.Node)
			if err != nil {
				return err
			}

			reply.Index, reply.Dump = index, dump
			return m.srv.filterACL(args.Token, reply)
		})
}
89248
func (m *Metrics) SendNodeInfo(node *types.Node) {
	log.Debugf("[Metrics] Update %s memory capacity gauge", node.Name)
	nodename := utils.CleanStatsdMetrics(node.Name)
	memory := float64(node.MemCap)

	if m.MemoryCapacity != nil {
		m.MemoryCapacity.WithLabelValues(nodename).Set(memory)
	}

	for cpuid, value := range node.CPU {
		val := float64(value)
		key := fmt.Sprintf(cpuMap, nodename, cpuid)
		if m.CPUMap != nil {
			m.CPUMap.WithLabelValues(nodename, cpuid).Set(val)
		}
		if m.StatsdAddr == "" {
			continue
		}
		if err := m.gauge(key, val); err != nil {
			log.Errorf("[SendNodeInfo] Error occurred while sending data to statsd: %v", err)
		}
	}

	if m.StatsdAddr == "" {
		return
	}
	key := fmt.Sprintf(memStats, nodename)
	if err := m.gauge(key, memory); err != nil {
		log.Errorf("[SendNodeInfo] Error occurred while sending data to statsd: %v", err)
	}
}
556731
func (nd *Node) requestInfo(timeout time.Duration, name ...string) (map[string]string, error) {
	nd.tendConnLock.Lock()
	defer nd.tendConnLock.Unlock()

	if err := nd.initTendConn(timeout); err != nil {
		return nil, err
	}

	response, err := RequestInfo(nd.tendConn, name...)
	if err != nil {
		nd.tendConn.Close()
		return nil, err
	}
	return response, nil
}
858174
func (_m *DFS) TagInfo(tenantID string, tagName string) (*dfs.SnapshotInfo, error) {
	ret := _m.Called(tenantID, tagName)

	var r0 *dfs.SnapshotInfo
	if rf, ok := ret.Get(0).(func(string, string) *dfs.SnapshotInfo); ok {
		r0 = rf(tenantID, tagName)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(*dfs.SnapshotInfo)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(string, string) error); ok {
		r1 = rf(tenantID, tagName)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
850352
func (sn *SimNode) NodeInfo() *p2p.NodeInfo {
	server := sn.Server()
	if server == nil {
		return &p2p.NodeInfo{
			ID:    sn.ID.String(),
			Enode: sn.Node().String(),
		}
	}
	return server.NodeInfo()
}
225188
func (api *PublicAdminAPI) NodeInfo() (*p2p.NodeInfo, error) {
	server := api.node.Server()
	if server == nil {
		return nil, ErrNodeStopped
	}
	return server.NodeInfo(), nil
}
169269
func NodeList() (infos []*model.NodeListInfo, err error) {
	err = mgr.Do(func(ctx context.Context, cli *client.Client) (err error) {
		var nodes []swarm.Node
		nodes, err = cli.NodeList(ctx, types.NodeListOptions{})
		if err == nil {
			sort.Slice(nodes, func(i, j int) bool {
				return nodes[i].Description.Hostname < nodes[j].Description.Hostname
			})
			infos = make([]*model.NodeListInfo, len(nodes))
			for i, n := range nodes {
				infos[i] = model.NewNodeListInfo(n)
			}
		}
		return
	})
	return
}
699416
func (n *NodeInfo) Node() *v1.Node {
	if n == nil {
		return nil
	}
	return n.node
}
905779
func NewNodeInfo(client *http.Client, role string, options ...Option) (NodeInfo, error) {
	if client == nil {
		return nil, ErrNodeInfo{"Client paramter cannot be empty"}
	}

	validRole := func() bool {
		for _, validRole := range []string{dcos.RoleMaster, dcos.RoleAgent, dcos.RoleAgentPublic} {
			if role == validRole {
				return true
			}
		}
		return false
	}

	if !validRole() {
		return nil, ErrNodeInfo{
			fmt.Sprintf("Role paramter is invalid or empty. Got %s", role),
		}
	}

	// setup dcosInfo with default parameters.
	d := &dcosInfo{
		client:            client,
		role:              role,
		cache:             true,
		detectIPLocation:  dcos.GetFileDetectIPLocation(),
		detectIPTimeout:   defaultExecTimeout,
		dnsRecordLeader:   dcos.DNSRecordLeader,
		mesosStateURL:     defaultStateURL.String(),
		clusterIDLocation: defaultClusterIDLocation,
	}

	// update parameters with a caller input.
	for _, opt := range options {
		if opt != nil {
			if err := opt(d); err != nil {
				return nil, err
			}
		}
	}

	return d, nil
}
671582
func (pm *ProtocolManager) NodeInfo() *NodeInfo {
	currentBlock := pm.blockchain.CurrentBlock()
	return &NodeInfo{
		Network:    pm.networkID,
		Difficulty: pm.blockchain.GetTd(currentBlock.Hash(), currentBlock.NumberU64()),
		Genesis:    pm.blockchain.Genesis().Hash(),
		Config:     pm.blockchain.Config(),
		Head:       currentBlock.Hash(),
	}
}
647479
func (nd *Node) RequestInfo(policy *InfoPolicy, name ...string) (map[string]string, error) {
	return nd.requestInfo(policy.Timeout, name...)
}
803692
func (n *NodeService) InfoWithContext(ctx context.Context) (*NodeInfo, *http.Response, error) {
	resource, _ := url.Parse(nodeInfoResourcePath)

	req, err := n.client.NewRequest(ctx, http.MethodGet, resource, nil)

	if err != nil {
		return nil, nil, err
	}

	nodeInfo := new(NodeInfo)

	res, err := n.client.Do(req, nodeInfo)

	if err != nil {
		return nil, res, err
	}

	return nodeInfo, res, nil
}