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

Function NewHTTPPoolOpts

http.go:91–114  ·  view source on GitHub ↗

NewHTTPPoolOpts initializes an HTTP pool of peers with the given options. Unlike NewHTTPPool, this function does not register the created pool as an HTTP handler. The returned *HTTPPool implements http.Handler and must be registered using http.Handle.

(self string, o *HTTPPoolOptions)

Source from the content-addressed store, hash-verified

89// Unlike NewHTTPPool, this function does not register the created pool as an HTTP handler.
90// The returned *HTTPPool implements http.Handler and must be registered using http.Handle.
91func NewHTTPPoolOpts(self string, o *HTTPPoolOptions) *HTTPPool {
92 if httpPoolMade {
93 panic("groupcache: NewHTTPPool must be called only once")
94 }
95 httpPoolMade = true
96
97 p := &HTTPPool{
98 self: self,
99 httpGetters: make(map[string]*httpGetter),
100 }
101 if o != nil {
102 p.opts = *o
103 }
104 if p.opts.BasePath == "" {
105 p.opts.BasePath = defaultBasePath
106 }
107 if p.opts.Replicas == 0 {
108 p.opts.Replicas = defaultReplicas
109 }
110 p.peers = consistenthash.New(p.opts.Replicas, p.opts.HashFn)
111
112 RegisterPeerPicker(func() PeerPicker { return p })
113 return p
114}
115
116// Set updates the pool's list of peers.
117// Each peer value should be a valid base URL,

Callers 1

NewHTTPPoolFunction · 0.85

Calls 2

NewFunction · 0.92
RegisterPeerPickerFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…