code: func (h *hasherStore) Wait(ctx context.Context) error {
  	defer close(h.quitC)
  	var nrStoredChunks uint64 // number of stored chunks
  	var done bool
  	doneC := h.doneC
  	for {
  		select {
  		// if context is done earlier, just return with the error
  		case <-ctx.Done():
  			return ctx.Err()
  		// doneC is closed if all chunks have been submitted, from then we just wait until all of them are also stored
  		case <-doneC:
  			done = true
  			doneC = nil
  		// a chunk has been stored, if err is nil, then successfully, so increase the stored chunk counter
  		case err := <-h.errC:
  			if err != nil {
  				return err
  			}
  			nrStoredChunks++
  		}
  		// if all the chunks have been submitted and all of them are stored, then we can return
  		if done {
  			if nrStoredChunks >= atomic.LoadUint64(&h.nrChunks) {
  				return nil
  			}
  		}
  	}
  }
docs: // Wait returns when
  //    1) the Close() function has been called and
  //    2) all the chunks which has been Put has been stored