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

Method SlotsInfo

pkg/utils/redis/client.go:249–267  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

247}
248
249func (c *Client) SlotsInfo() (map[int]int, error) {
250 if reply, err := c.Do("SLOTSINFO"); err != nil {
251 return nil, errors.Trace(err)
252 } else {
253 infos, err := redigo.Values(reply, nil)
254 if err != nil {
255 return nil, errors.Trace(err)
256 }
257 slots := make(map[int]int)
258 for i, info := range infos {
259 p, err := redigo.Ints(info, nil)
260 if err != nil || len(p) != 2 {
261 return nil, errors.Errorf("invalid response[%d] = %v", i, info)
262 }
263 slots[p[0]] = p[1]
264 }
265 return slots, nil
266 }
267}
268
269func (c *Client) Role() (string, error) {
270 if reply, err := c.Do("ROLE"); err != nil {

Callers 1

GroupAddServerMethod · 0.95

Calls 4

DoMethod · 0.95
ValuesMethod · 0.80
IntsMethod · 0.80
ErrorfMethod · 0.80

Tested by

no test coverage detected