Esempio n. 1
0
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)
		}
	}
}
Esempio n. 2
0
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()
	}
}
Esempio n. 3
0
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()
	}
}