MCPcopy
hub / github.com/CodisLabs/codis / player

Method player

extern/deprecated/redis-test/test_mset.go:45–90  ·  view source on GitHub ↗
(gid int, tg *TestGroup, tags *ZeroTags)

Source from the content-addressed store, hash-verified

43}
44
45func (tc *TestMsetTestCase) player(gid int, tg *TestGroup, tags *ZeroTags) {
46 tg.PlayerWait()
47 defer tg.PlayerDone()
48 c := NewConn(tc.proxy)
49 defer c.Close()
50 us := UnitSlice(make([]*Unit, tc.nkeys))
51 for i := 0; i < len(us); i++ {
52 key := fmt.Sprintf("test_mset_%d_%d_tag{%s}", gid, i, tags.Get(i))
53 us[i] = NewUnit(key)
54 }
55 for _, u := range us {
56 u.Del(c, false)
57 ops.Incr()
58 }
59 for k := 0; k < tc.round; k++ {
60 for _, u := range us {
61 u.Incr(c)
62 }
63 const step = 16
64 for i := 0; i < len(us); i++ {
65 r := &Rand{time.Now().UnixNano()}
66 for j := 0; j < step; j++ {
67 u := us[uint(r.Next())%uint(len(us))]
68 u.Incr(c)
69 }
70 t := make([]*Unit, step)
71 for j := 0; j < step; j++ {
72 u := us[uint(r.Next())%uint(len(us))]
73 t[j] = u
74 }
75 vals := make([]interface{}, step)
76 for j, k := 0, int(r.Next()); j < step; j++ {
77 vals[j] = k
78 }
79 UnitSlice(t).Mset(c, vals...)
80 for _, u := range t {
81 u.Incr(c)
82 }
83 ops.Incr()
84 }
85 }
86 for _, u := range us {
87 u.Del(c, false)
88 ops.Incr()
89 }
90}

Callers 1

mainMethod · 0.95

Calls 11

CloseMethod · 0.95
NextMethod · 0.95
UnitSliceTypeAlias · 0.85
NewUnitFunction · 0.85
PlayerWaitMethod · 0.80
PlayerDoneMethod · 0.80
MsetMethod · 0.80
NewConnFunction · 0.70
GetMethod · 0.45
DelMethod · 0.45
IncrMethod · 0.45

Tested by

no test coverage detected