MCPcopy Index your code
hub / github.com/golang/groupcache / Set

Method Set

http.go:119–128  ·  view source on GitHub ↗

Set updates the pool's list of peers. Each peer value should be a valid base URL, for example "http://example.net:8000".

(peers ...string)

Source from the content-addressed store, hash-verified

117// Each peer value should be a valid base URL,
118// for example "http://example.net:8000".
119func (p *HTTPPool) Set(peers ...string) {
120 p.mu.Lock()
121 defer p.mu.Unlock()
122 p.peers = consistenthash.New(p.opts.Replicas, p.opts.HashFn)
123 p.peers.Add(peers...)
124 p.httpGetters = make(map[string]*httpGetter, len(peers))
125 for _, peer := range peers {
126 p.httpGetters[peer] = &httpGetter{transport: p.Transport, baseURL: peer + p.opts.BasePath}
127 }
128}
129
130func (p *HTTPPool) PickPeer(key string) (ProtoGetter, bool) {
131 p.mu.Lock()

Callers 3

TestHTTPPoolFunction · 0.95
beChildForTestHTTPPoolFunction · 0.95
ServeHTTPMethod · 0.80

Calls 2

NewFunction · 0.92
AddMethod · 0.45

Tested by 2

TestHTTPPoolFunction · 0.76
beChildForTestHTTPPoolFunction · 0.76