MCPcopy
hub / github.com/darjun/go-daily-lib / Call

Method Call

jsonrpc/zookeeper/client/proxy.go:31–49  ·  view source on GitHub ↗
(method string, args interface{}, reply interface{})

Source from the content-addressed store, hash-verified

29}
30
31func (p *Proxy) Call(method string, args interface{}, reply interface{}) error {
32 var client *rpc.Client
33 var addr string
34 idx := rand.Int31n(int32(len(p.clients)))
35 var i int32
36 p.mutex.Lock()
37 for a, c := range p.clients {
38 if i == idx {
39 client = c
40 addr = a
41 break
42 }
43 i++
44 }
45 p.mutex.Unlock()
46
47 fmt.Println("use", addr)
48 return client.Call(method, args, reply)
49}
50
51func (p *Proxy) Connect() {
52 c, _, err := zk.Connect([]string{p.zookeeper}, time.Second) //*10)

Callers 15

mainFunction · 0.95
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected