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

Method convertSlotsV1

cmd/admin/admin.go:199–222  ·  view source on GitHub ↗
(slots map[int]*models.SlotMapping, v interface{})

Source from the content-addressed store, hash-verified

197}
198
199func (t *cmdAdmin) convertSlotsV1(slots map[int]*models.SlotMapping, v interface{}) {
200 m := v.(map[string]interface{})
201
202 var sid = int(m["id"].(float64))
203 var gid = int(m["group_id"].(float64))
204 var status = m["state"].(map[string]interface{})["status"].(string)
205
206 log.Debugf("found slot-%04d status = %s", sid, status)
207
208 switch status {
209 case "online":
210 case "offline":
211 return
212 default:
213 log.Panicf("invalid slot status")
214 }
215
216 if slots[sid] != nil {
217 log.Panicf("slot-%04d already exists", sid)
218 }
219 slots[sid] = &models.SlotMapping{
220 Id: sid, GroupId: gid,
221 }
222}
223
224func (t *cmdAdmin) convertGroupV1(group map[int]*models.Group, v interface{}) {
225 m := v.(map[string]interface{})

Callers 1

handleConfigConvertMethod · 0.95

Calls 2

DebugfMethod · 0.80
PanicfMethod · 0.80

Tested by

no test coverage detected