code: func (r *EtcdRegistry) Units() ([]job.Unit, error) {
  	key := r.prefixed(jobPrefix)
  	opts := &etcd.GetOptions{
  		// We need Job Units to be sorted
  		Sort:      true,
  		Recursive: true,
  	}
  	res, err := r.kAPI.Get(context.Background(), key, opts)
  	if err != nil {
  		if isEtcdError(err, etcd.ErrorCodeKeyNotFound) {
  			err = nil
  		}
  		return nil, err
  	}
  
  	// Fetch all units by hash recursively to avoid sending N requests to Etcd.
  	hashToUnit, err := r.getAllUnitsHashMap()
  	if err != nil {
  		log.Errorf("failed fetching all Units from etcd: %v", err)
  		return nil, err
  	}
  	unitHashLookupFunc := func(hash unit.Hash) *unit.UnitFile {
  		stringHash := hash.String()
  		unit, ok := hashToUnit[stringHash]
  		if !ok {
  			log.Errorf("did not find Unit %v in list of all units", stringHash)
  			return nil
  		}
  		return unit
  	}
  
  	units := make([]job.Unit, 0)
  	for _, dir := range res.Node.Nodes {
  		u, err := r.dirToUnit(dir, unitHashLookupFunc)
  		if err != nil {
  			log.Errorf("Failed to parse Unit from etcd: %v", err)
  			continue
  		}
  		if u == nil {
  			continue
  		}
  
  		units = append(units, *u)
  	}
  
  	return units, nil
  }
docs: // Units lists all Units stored in the Registry, ordered by name. This includes both global and non-global units.