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

Method existsCommand

pkg/utils/redis/sentinel.go:221–239  ·  view source on GitHub ↗
(client *Client, names []string)

Source from the content-addressed store, hash-verified

219}
220
221func (s *Sentinel) existsCommand(client *Client, names []string) (map[string]bool, error) {
222 go func() {
223 for _, name := range names {
224 client.Send("SENTINEL", "get-master-addr-by-name", name)
225 }
226 if len(names) != 0 {
227 client.Flush()
228 }
229 }()
230 exists := make(map[string]bool, len(names))
231 for _, name := range names {
232 r, err := client.Receive()
233 if err != nil {
234 return nil, errors.Trace(err)
235 }
236 exists[name] = (r != nil)
237 }
238 return exists, nil
239}
240
241func (s *Sentinel) slavesCommand(client *Client, names []string) (map[string][]map[string]string, error) {
242 exists, err := s.existsCommand(client, names)

Callers 2

slavesCommandMethod · 0.95
removeCommandMethod · 0.95

Calls 3

SendMethod · 0.80
ReceiveMethod · 0.80
FlushMethod · 0.45

Tested by

no test coverage detected