func doPutForWatch(ctx context.Context, client v3.KV, requests <-chan v3.Op) { for op := range requests { _, err := client.Do(ctx, op) if err != nil { fmt.Fprintf(os.Stderr, "failed to Put for watch benchmark: %v\n", err) os.Exit(1) } } }
func doPut(ctx context.Context, client v3.KV, requests <-chan v3.Op) { defer wg.Done() for op := range requests { st := time.Now() _, err := client.Do(ctx, op) var errStr string if err != nil { errStr = err.Error() } results <- result{errStr: errStr, duration: time.Since(st)} bar.Increment() } }
func doRange(client v3.KV, requests <-chan v3.Op) { defer wg.Done() for op := range requests { st := time.Now() _, err := client.Do(context.Background(), op) var errStr string if err != nil { errStr = err.Error() } results <- result{errStr: errStr, duration: time.Since(st), happened: time.Now()} bar.Increment() } }