Ejemplo n.º 1
0
func incr(c *table.Context, done chan *table.Call, zop bool,
	rowKey, colKey []byte, score int64) {
	var err error
	var value []byte
	if zop {
		if done == nil {
			value, score, err = c.ZIncr(0, rowKey, colKey, score, 0)
		} else {
			_, err = c.GoZIncr(0, rowKey, colKey, score, 0, done)
		}
	} else {
		if done == nil {
			value, score, err = c.Incr(0, rowKey, colKey, score, 0)
		} else {
			_, err = c.GoIncr(0, rowKey, colKey, score, 0, done)
		}
	}
	if err != nil {
		fmt.Printf("Incr failed: %s\n", err)
		os.Exit(1)
	}

	if *verbose != 0 && done == nil {
		fmt.Printf("rowKey: %2s, colKey: %s, value: %s, score:%d\n",
			string(rowKey), string(colKey), string(value), score)
	}
}