func loadBlobsFromPacks(repo *repository.Repository) (packs map[backend.ID][]pack.Blob) {
	done := make(chan struct{})
	defer close(done)

	f := func(job worker.Job, done <-chan struct{}) (interface{}, error) {
		return repo.ListPack(job.Data.(backend.ID))
	}

	jobCh := make(chan worker.Job)
	resCh := make(chan worker.Job)
	wp := worker.New(rebuildIndexWorkers, f, jobCh, resCh)

	go func() {
		for id := range repo.List(backend.Data, done) {
			jobCh <- worker.Job{Data: id}
		}
		close(jobCh)
	}()

	packs = make(map[backend.ID][]pack.Blob)
	for job := range resCh {
		id := job.Data.(backend.ID)

		if job.Error != nil {
			fmt.Fprintf(os.Stderr, "error for pack %v: %v\n", id, job.Error)
			continue
		}

		entries := job.Result.([]pack.Blob)
		packs[id] = entries
	}

	wp.Wait()

	return packs
}