func makeReads(
	ctx context.Context,
	o *gcs.Object,
	bucket gcs.Bucket,
	results chan<- result,
	stop <-chan struct{}) (err error) {
	// Is the object large enough?
	if o.Size < *fSize {
		err = fmt.Errorf(
			"Object of size %d not large enough for read size %d",
			o.Size,
			*fSize)

		return
	}

	for {
		// Stop?
		select {
		case <-stop:
			return
		default:
		}

		// Make a read.
		var r result
		r, err = readOnce(ctx, o, bucket)
		if err != nil {
			err = fmt.Errorf("readOnce %v", err)
			return
		}

		log.Printf(
			"Read %d bytes in %v (first byte latency %v)",
			r.BytesRead,
			r.FullBodyDuration,
			r.FirstByteLatency)

		// Write out the result.
		select {
		case <-ctx.Done():
			err = ctx.Err()
			return

		case results <- r:
		}
	}
}
// Make random reads within the given object, writing results to the supplied
// channel. Stop when the stop channel is closed.
Make random reads within the given object, writing results to the supplied
channel. Stop when the stop channel is closed.
// Make random reads within the given object writing results to the supplied // channel . Stop when the stop channel is closed .
func makeReads(
	ctx context.Context,
	o *gcs.Object,
	bucket gcs.Bucket,
	results chan<- result,
	stop <-chan struct{}) (err error) {
	if o.Size < *fSize {
		err = fmt.Errorf(
			"Object of size %d not large enough for read size %d",
			o.Size,
			*fSize)
		return
	}
	for {
		select {
		case <-stop:
			return
		default:
		}
		var r result
		r, err = readOnce(ctx, o, bucket)
		if err != nil {
			err = fmt.Errorf("readOnce %v", err)
			return
		}
		log.Printf(
			"Read %d bytes in %v (first byte latency %v)",
			r.BytesRead,
			r.FullBodyDuration,
			r.FirstByteLatency)
		select {
		case <-ctx.Done():
			err = ctx.Err()
			return
		case results <- r:
		}
	}
}
func makeReads ( ctx context . Context , o * gcs . Object , bucket gcs . Bucket , results chan <- result , stop <- chan struct { } ) ( err error ) { if o . Size < * fSize { err = fmt . Errorf ( " " , o . Size , * fSize ) return } for { select { case <- stop : return default : } var r result r , err = readOnce ( ctx , o , bucket ) if err != nil { err = fmt . Errorf ( " " , err ) return } log . Printf ( " " , r . BytesRead , r . FullBodyDuration , r . FirstByteLatency ) select { case <- ctx . Done ( ) : err = ctx . Err ( ) return case results <- r : } } }
Make random reads within the given object, writing results to the supplied
channel.
Make random reads within the given object writing results to the supplied channel .
// Is the object large enough? // Stop? // Make a read. // Write out the result.