code: func (s *Store) ChecksInStateByNodeMeta(ws memdb.WatchSet, state string, filters map[string]string) (uint64, structs.HealthChecks, error) {
  	tx := s.db.Txn(false)
  	defer tx.Abort()
  
  	// Get the table index.
  	idx := maxIndexTxn(tx, "nodes", "checks")
  
  	// Query all checks if HealthAny is passed, otherwise use the index.
  	var iter memdb.ResultIterator
  	var err error
  	if state == api.HealthAny {
  		iter, err = tx.Get("checks", "status")
  		if err != nil {
  			return 0, nil, fmt.Errorf("failed check lookup: %s", err)
  		}
  	} else {
  		iter, err = tx.Get("checks", "status", state)
  		if err != nil {
  			return 0, nil, fmt.Errorf("failed check lookup: %s", err)
  		}
  	}
  	ws.Add(iter.WatchCh())
  
  	return s.parseChecksByNodeMeta(tx, ws, idx, iter, filters)
  }
docs: // ChecksInStateByNodeMeta is used to query the state store for all checks
  // which are in the provided state, filtered by the given node metadata values.