func (n *Node) GetNode(args *structs.NodeSpecificRequest,
	reply *structs.SingleNodeResponse) error {
	if done, err := n.srv.forward("Node.GetNode", args, args, reply); done {
		return err
	}
	defer metrics.MeasureSince([]string{"nomad", "client", "get_node"}, time.Now())

	// Setup the blocking query
	opts := blockingOptions{
		queryOpts: &args.QueryOptions,
		queryMeta: &reply.QueryMeta,
		run: func(ws memdb.WatchSet, state *state.StateStore) error {
			// Verify the arguments
			if args.NodeID == "" {
				return fmt.Errorf("missing node ID")
			}

			// Look for the node
			out, err := state.NodeByID(ws, args.NodeID)
			if err != nil {
				return err
			}

			// Setup the output
			if out != nil {
				// Clear the secret ID
				reply.Node = out.Copy()
				reply.Node.SecretID = ""
				reply.Index = out.ModifyIndex
			} else {
				// Use the last index that affected the nodes table
				index, err := state.Index("nodes")
				if err != nil {
					return err
				}
				reply.Node = nil
				reply.Index = index
			}

			// Set the query response
			n.srv.setQueryMeta(&reply.QueryMeta)
			return nil
		}}
	return n.srv.blockingRPC(&opts)
}
// GetNode is used to request information about a specific node
GetNode is used to request information about a specific node
// GetNode is used to request information about a specific node
func (n *Node) GetNode(args *structs.NodeSpecificRequest,
	reply *structs.SingleNodeResponse) error {
	if done, err := n.srv.forward("Node.GetNode", args, args, reply); done {
		return err
	}
	defer metrics.MeasureSince([]string{"nomad", "client", "get_node"}, time.Now())
	opts := blockingOptions{
		queryOpts: &args.QueryOptions,
		queryMeta: &reply.QueryMeta,
		run: func(ws memdb.WatchSet, state *state.StateStore) error {
			if args.NodeID == "" {
				return fmt.Errorf("missing node ID")
			}
			out, err := state.NodeByID(ws, args.NodeID)
			if err != nil {
				return err
			}
			if out != nil {
				reply.Node = out.Copy()
				reply.Node.SecretID = ""
				reply.Index = out.ModifyIndex
			} else {
				index, err := state.Index("nodes")
				if err != nil {
					return err
				}
				reply.Node = nil
				reply.Index = index
			}
			n.srv.setQueryMeta(&reply.QueryMeta)
			return nil
		}}
	return n.srv.blockingRPC(&opts)
}
func ( n * Node ) GetNode ( args * structs . NodeSpecificRequest , reply * structs . SingleNodeResponse ) error { if done , err := n . srv . forward ( " " , args , args , reply ) ; done { return err } defer metrics . MeasureSince ( [ ] string { " " , " " , " " } , time . Now ( ) ) opts := blockingOptions { queryOpts : & args . QueryOptions , queryMeta : & reply . QueryMeta , run : func ( ws memdb . WatchSet , state * state . StateStore ) error { if args . NodeID == " " { return fmt . Errorf ( " " ) } out , err := state . NodeByID ( ws , args . NodeID ) if err != nil { return err } if out != nil { reply . Node = out . Copy ( ) reply . Node . SecretID = " " reply . Index = out . ModifyIndex } else { index , err := state . Index ( " " ) if err != nil { return err } reply . Node = nil reply . Index = index } n . srv . setQueryMeta ( & reply . QueryMeta ) return nil } } return n . srv . blockingRPC ( & opts ) }
GetNode is used to request information about a specific node
GetNode is used to request information about a specific node
// Setup the blocking query // Verify the arguments // Look for the node // Setup the output // Clear the secret ID // Use the last index that affected the nodes table // Set the query response