// FetchLightningNode attempts to look up a target node by its identity public
// key. channeldb.ErrGraphNodeNotFound is returned if the node doesn't exist
// within the graph.
//
// NOTE: This method is part of the ChannelGraphSource interface.
502978
func (r *ChannelRouter) FetchLightningNode(node route.Vertex) (*channeldb.LightningNode, error) {
	pubKey, err := btcec.ParsePubKey(node[:], btcec.S256())
	if err != nil {
		return nil, fmt.Errorf("unable to parse raw public key: %v", err)
	}
	return r.cfg.Graph.FetchLightningNode(pubKey)
}
516925
func (p Path) GetNode(ctx context.Context, config libkbfs.Config) (libkbfs.Node, data.EntryInfo, error) {
	if p.PathType != TLFPathType {
		entryInfo := data.EntryInfo{
			Type: data.Dir,
		}
		return nil, entryInfo, nil
	}

	tlfHandle, err := ParseTlfHandle(
		ctx, config.KBPKI(), config.MDOps(), config, p.TLFName, p.TLFType)
	if err != nil {
		return nil, data.EntryInfo{}, err
	}

	node, entryInfo, err := config.KBFSOps().GetOrCreateRootNode(ctx, tlfHandle, data.MasterBranch)
	if err != nil {
		return nil, data.EntryInfo{}, err
	}

	for _, component := range p.TLFComponents {
		lookupNode, lookupEntryInfo, lookupErr := config.KBFSOps().Lookup(ctx, node, component)
		if lookupErr != nil {
			return nil, data.EntryInfo{}, lookupErr
		}
		node = lookupNode
		entryInfo = lookupEntryInfo
	}

	return node, entryInfo, nil
}
823608
func (l *lNode) lookup(e *Entry) (interface{}, bool) {
	found, ok := l.Find(func(sn interface{}) bool {
		return bytes.Equal(e.Key, sn.(*sNode).Key)
	})
	if !ok {
		return nil, false
	}
	return found.(*sNode).Value, true
}
1368381
func (api *CoreAPI) ResolveNode(ctx context.Context, p coreiface.Path) (ipld.Node, error) {
	rp, err := api.ResolvePath(ctx, p)
	if err != nil {
		return nil, err
	}

	node, err := api.dag.Get(ctx, rp.Cid())
	if err != nil {
		return nil, err
	}
	return node, nil
}
1109931
func GetnCompressedTexImage(target uint32, lod int32, bufSize int32, pixels unsafe.Pointer) {
	C.glowGetnCompressedTexImage(gpGetnCompressedTexImage, (C.GLenum)(target), (C.GLint)(lod), (C.GLsizei)(bufSize), pixels)
}
754561
func (remote *RemoteDebugger) RequestNode(nodeID int) error {
	_, err := remote.SendRequest("DOM.requestChildNodes", Params{
		"nodeId": nodeID,
	})

	return err
}
489035
func (woc *wfOperationCtx) markNodeError(nodeName string, err error) *wfv1.NodeStatus {
	return woc.markNodePhase(nodeName, wfv1.NodeError, err.Error())
}
675865
func (nh *nodeHighlighter) findScope(search text.Region, node *parser.Node) *parser.Node {
	idx := sort.Search(len(node.Children), func(i int) bool {
		return node.Children[i].Range.A >= search.A || node.Children[i].Range.Covers(search)
	})
	for idx < len(node.Children) {
		c := node.Children[idx]
		if c.Range.A > search.B {
			break
		}
		if c.Range.Covers(search) {
			if node.Name != "" && node != nh.lastScopeNode {
				if nh.lastScopeBuf.Len() > 0 {
					nh.lastScopeBuf.WriteByte(' ')
				}
				nh.lastScopeBuf.WriteString(node.Name)
			}
			return nh.findScope(search, node.Children[idx])
		}
		idx++
	}
	if node != nh.lastScopeNode && node.Range.Covers(search) && node.Name != "" {
		if nh.lastScopeBuf.Len() > 0 {
			nh.lastScopeBuf.WriteByte(' ')
		}
		nh.lastScopeBuf.WriteString(node.Name)
		return node
	}
	return nil
}
990116
func (b *BloomTrieIndexerBackend) fetchMissingNodes(ctx context.Context, section uint64, root common.Hash) error {
	indexCh := make(chan uint, types.BloomBitLength)
	type res struct {
		nodes *NodeSet
		err   error
	}
	resCh := make(chan res, types.BloomBitLength)
	for i := 0; i < 20; i++ {
		go func() {
			for bitIndex := range indexCh {
				r := &BloomRequest{BloomTrieRoot: root, BloomTrieNum: section - 1, BitIdx: bitIndex, SectionIndexList: []uint64{section - 1}, Config: b.odr.IndexerConfig()}
				for {
					if err := b.odr.Retrieve(ctx, r); err == ErrNoPeers {
						// if there are no peers to serve, retry later
						select {
						case <-ctx.Done():
							resCh <- res{nil, ctx.Err()}
							return
						case <-time.After(time.Second * 10):
							// stay in the loop and try again
						}
					} else {
						resCh <- res{r.Proofs, err}
						break
					}
				}
			}
		}()
	}

	for i := uint(0); i < types.BloomBitLength; i++ {
		indexCh <- i
	}
	close(indexCh)
	batch := b.trieTable.NewBatch()
	for i := uint(0); i < types.BloomBitLength; i++ {
		res := <-resCh
		if res.err != nil {
			return res.err
		}
		res.nodes.Store(batch)
	}
	return batch.Write()
}
139029
func (db *DB) FetchAllLinkNodes() ([]*LinkNode, error) {
	var linkNodes []*LinkNode
	err := db.View(func(tx *bbolt.Tx) error {
		nodes, err := db.fetchAllLinkNodes(tx)
		if err != nil {
			return err
		}

		linkNodes = nodes
		return nil
	})
	if err != nil {
		return nil, err
	}

	return linkNodes, nil
}
219214
func (p *PullRequestReview) GetNodeID() string {
	if p == nil || p.NodeID == nil {
		return ""
	}
	return *p.NodeID
}
854000
func GetNode(tx ReadTx, id string) *api.Node {
	n := tx.get(tableNode, id)
	if n == nil {
		return nil
	}
	return n.(*api.Node)
}
154764
func (f *lightFetcher) checkKnownNode(p *peer, n *fetcherTreeNode) bool {
	if n.known {
		return true
	}
	td := f.chain.GetTd(n.hash, n.number)
	if td == nil {
		return false
	}
	header := f.chain.GetHeader(n.hash, n.number)
	// check the availability of both header and td because reads are not protected by chain db mutex
	// Note: returning false is always safe here
	if header == nil {
		return false
	}

	fp := f.peers[p]
	if fp == nil {
		p.Log().Debug("Unknown peer to check known nodes")
		return false
	}
	if !f.checkAnnouncedHeaders(fp, []*types.Header{header}, []*big.Int{td}) {
		p.Log().Debug("Inconsistent announcement")
		go f.pm.removePeer(p.id)
	}
	if fp.confirmedTd != nil {
		f.updateMaxConfirmedTd(fp.confirmedTd)
	}
	return n.known
}
688707
func (nh *nodeHighlighter) updateScope(point int) {
	if nh.rootNode == nil {
		return
	}

	search := text.Region{A: point, B: point + 1}
	if nh.lastScopeNode != nil && nh.lastScopeNode.Range.Covers(search) {
		if len(nh.lastScopeNode.Children) != 0 {
			if no := nh.findScope(search, nh.lastScopeNode); no != nh.lastScopeNode && no != nil {
				nh.lastScopeNode = no
				nh.lastScopeName = nh.lastScopeBuf.String()
			}
		}
		return
	}
	nh.lastScopeNode = nil
	nh.lastScopeBuf.Reset()
	nh.lastScopeNode = nh.findScope(search, nh.rootNode)
	nh.lastScopeName = nh.lastScopeBuf.String()
}
891822
func (tc *TeleportClient) getTargetNodes(ctx context.Context, proxy *ProxyClient) ([]string, error) {
	var (
		err    error
		nodes  []services.Server
		retval = make([]string, 0)
	)
	if tc.Labels != nil && len(tc.Labels) > 0 {
		nodes, err = proxy.FindServersByLabels(ctx, tc.Namespace, tc.Labels)
		if err != nil {
			return nil, trace.Wrap(err)
		}
		for i := 0; i < len(nodes); i++ {
			retval = append(retval, nodes[i].GetAddr())
		}
	}
	if len(nodes) == 0 {
		retval = append(retval, net.JoinHostPort(tc.Host, strconv.Itoa(tc.HostPort)))
	}
	return retval, nil
}
485853
func (r Network_Backbone) GetGraphImage() (resp []byte, err error) {
	err = r.Session.DoRequest("SoftLayer_Network_Backbone", "getGraphImage", nil, &r.Options, &resp)
	return
}
732431
func (t *UDPv4) findnode(toid enode.ID, toaddr *net.UDPAddr, target encPubkey) ([]*node, error) {
	// If we haven't seen a ping from the destination node for a while, it won't remember
	// our endpoint proof and reject findnode. Solicit a ping first.
	if time.Since(t.db.LastPingReceived(toid, toaddr.IP)) > bondExpiration {
		<-t.sendPing(toid, toaddr, nil)
		// Wait for them to ping back and process our pong.
		time.Sleep(respTimeout)
	}

	// Add a matcher for 'neighbours' replies to the pending reply queue. The matcher is
	// active until enough nodes have been received.
	nodes := make([]*node, 0, bucketSize)
	nreceived := 0
	errc := t.pending(toid, toaddr.IP, p_neighborsV4, func(r interface{}) (matched bool, requestDone bool) {
		reply := r.(*neighborsV4)
		for _, rn := range reply.Nodes {
			nreceived++
			n, err := t.nodeFromRPC(toaddr, rn)
			if err != nil {
				t.log.Trace("Invalid neighbor node received", "ip", rn.IP, "addr", toaddr, "err", err)
				continue
			}
			nodes = append(nodes, n)
		}
		return true, nreceived >= bucketSize
	})
	t.send(toaddr, toid, p_findnodeV4, &findnodeV4{
		Target:     target,
		Expiration: uint64(time.Now().Add(expiration).Unix()),
	})
	return nodes, <-errc
}