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

Method InfoFull

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

Source from the content-addressed store, hash-verified

158}
159
160func (c *Client) InfoFull() (map[string]string, error) {
161 if info, err := c.Info(); err != nil {
162 return nil, errors.Trace(err)
163 } else {
164 host := info["master_host"]
165 port := info["master_port"]
166 if host != "" || port != "" {
167 info["master_addr"] = net.JoinHostPort(host, port)
168 }
169 r, err := c.Do("CONFIG", "GET", "maxmemory")
170 if err != nil {
171 return nil, errors.Trace(err)
172 }
173 p, err := redigo.Values(r, nil)
174 if err != nil || len(p) != 2 {
175 return nil, errors.Errorf("invalid response = %v", r)
176 }
177 v, err := redigo.Int(p[1], nil)
178 if err != nil {
179 return nil, errors.Errorf("invalid response = %v", r)
180 }
181 info["maxmemory"] = strconv.Itoa(v)
182 return info, nil
183 }
184}
185
186func (c *Client) SetMaster(master string) error {
187 host, port, err := net.SplitHostPort(master)

Callers 1

InfoServerMethod · 0.95

Calls 5

InfoMethod · 0.95
DoMethod · 0.95
ValuesMethod · 0.80
ErrorfMethod · 0.80
IntMethod · 0.45

Tested by

no test coverage detected