(d map[string]interface{})
| 132 | } |
| 133 | |
| 134 | func (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 | |
| 166 | func (t *cmdProxy) handleResetStats(d map[string]interface{}) { |
| 167 | c := t.newProxyClient(true) |
no test coverage detected