code: func (s *Store) ChecksInState(ws memdb.WatchSet, state string) (uint64, structs.HealthChecks, error) {
  	tx := s.db.Txn(false)
  	defer tx.Abort()
  
  	// Get the table index.
  	idx := maxIndexTxn(tx, "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")
  	} 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())
  
  	var results structs.HealthChecks
  	for check := iter.Next(); check != nil; check = iter.Next() {
  		results = append(results, check.(*structs.HealthCheck))
  	}
  	return idx, results, nil
  }
docs: // ChecksInState is used to query the state store for all checks
  // which are in the provided state.