code: func (s *Discovery) watchOnce(stopCh <-chan struct{}, watchCh <-chan []*store.KVPair, discoveryCh chan discovery.Entries, errCh chan error) bool {
  	for {
  		select {
  		case pairs := <-watchCh:
  			if pairs == nil {
  				return true
  			}
  
  			logrus.WithField("discovery", s.backend).Debugf("Watch triggered with %d nodes", len(pairs))
  
  			// Convert `KVPair` into `discovery.Entry`.
  			addrs := make([]string, len(pairs))
  			for _, pair := range pairs {
  				addrs = append(addrs, string(pair.Value))
  			}
  
  			entries, err := discovery.CreateEntries(addrs)
  			if err != nil {
  				errCh <- err
  			} else {
  				discoveryCh <- entries
  			}
  		case <-stopCh:
  			// We were requested to stop watching.
  			return false
  		}
  	}
  }
docs: // Watch the store until either there's a store error or we receive a stop request.
  // Returns false if we shouldn't attempt watching the store anymore (stop request received).