code: func readAvailable(ch <-chan *tq.Transfer, cap int) []*tq.Transfer {
  	ts := make([]*tq.Transfer, 0, cap)
  
  	for {
  		select {
  		case t, ok := <-ch:
  			if !ok {
  				return ts
  			}
  			ts = append(ts, t)
  		default:
  			if len(ts) > 0 {
  				return ts
  			}
  
  			t, ok := <-ch
  			if !ok {
  				return ts
  			}
  			return append(ts, t)
  		}
  	}
  }
docs: // readAvailable satisfies the accumulation semantics for the
  // 'list_available_blobs' command. It accumulates items until:
  //
  // 1. Reading from the channel of available items blocks, or ...
  // 2. There is one item available, or ...
  // 3. The 'tq.TransferQueue' is completed.