feat(storage): Specify benchmark integrity check. (#11465) · googleapis/google-cloud-go@da18845
@@ -66,6 +66,7 @@ type benchmarkOptions struct {
6666numSamples int
6767numWorkers int
6868api benchmarkAPI
69+integrity benchmarkIC
69707071objectSize int64
7172minObjectSize int64
@@ -130,6 +131,7 @@ func (b *benchmarkOptions) String() string {
130131131132stringifiedOpts := []string{
132133fmt.Sprintf("api:\t\t\t%s", b.api),
134+fmt.Sprintf("interity check:\t\t%d", b.integrity),
133135fmt.Sprintf("region:\t\t\t%s", b.region),
134136fmt.Sprintf("timeout:\t\t%s", b.timeout),
135137fmt.Sprintf("number of samples:\t%d", b.numSamples),
@@ -163,6 +165,7 @@ func parseFlags() {
163165flag.IntVar(&opts.numSamples, "samples", 8000, "number of samples to report")
164166flag.IntVar(&opts.numWorkers, "workers", 16, "number of concurrent workers")
165167flag.StringVar((*string)(&opts.api), "api", string(mixedAPIs), "api used to upload/download objects; JSON or XML values will use JSON to uplaod and XML to download")
168+flag.StringVar((*string)(&opts.integrity), "integrity", string(randomIC), "integrity check performed on uploads; crc32c, md5, none, or random (default) to randomly choose which to check on each upload")
166169167170objectRange := flag.String("object_size", fmt.Sprint(1024*kib), "object size in bytes")
168171@@ -329,6 +332,15 @@ const (
329332directPath benchmarkAPI = "DirectPath"
330333)
331334335+type benchmarkIC string
336+337+const (
338+crc32cIC benchmarkIC = "crc32c"
339+md5IC benchmarkIC = "md5"
340+noneIC benchmarkIC = "none"
341+randomIC benchmarkIC = "random"
342+)
343+332344func (api benchmarkAPI) validate() error {
333345switch api {
334346case jsonAPI, grpcAPI, xmlAPI, directPath, mixedAPIs: