MCPcopy Index your code
hub / github.com/CodisLabs/codis / handleFillSlots

Method handleFillSlots

cmd/admin/proxy.go:134–164  ·  view source on GitHub ↗
(d map[string]interface{})

Source from the content-addressed store, hash-verified

132}
133
134func (t *cmdProxy) handleFillSlots(d map[string]interface{}) {
135 c := t.newProxyClient(true)
136
137 b, err := ioutil.ReadFile(utils.ArgumentMust(d, "--fillslots"))
138 if err != nil {
139 log.PanicErrorf(err, "load slots from file failed")
140 }
141
142 var slots []*models.Slot
143 if err := json.Unmarshal(b, &slots); err != nil {
144 log.PanicErrorf(err, "decode slots from json failed")
145 }
146
147 for _, m := range slots {
148 if m.Id < 0 || m.Id >= models.MaxSlotNum {
149 log.Panicf("invalid slot id = %d", m.Id)
150 }
151 }
152
153 if d["--locked"].(bool) {
154 for _, m := range slots {
155 m.Locked = true
156 }
157 }
158
159 log.Debugf("call rpc fillslots to proxy %s", t.addr)
160 if err := c.FillSlots(slots...); err != nil {
161 log.PanicErrorf(err, "call rpc fillslots to proxy %s failed", t.addr)
162 }
163 log.Debugf("call rpc fillslots OK")
164}
165
166func (t *cmdProxy) handleResetStats(d map[string]interface{}) {
167 c := t.newProxyClient(true)

Callers 1

MainMethod · 0.95

Calls 5

newProxyClientMethod · 0.95
PanicErrorfMethod · 0.80
PanicfMethod · 0.80
DebugfMethod · 0.80
FillSlotsMethod · 0.45

Tested by

no test coverage detected