mirror of
https://github.com/mailgun/groupcache.git
synced 2024-07-01 02:19:12 +00:00
Compare commits
2 Commits
07fc01e392
...
e6ae355724
Author | SHA1 | Date | |
---|---|---|---|
|
e6ae355724 | ||
|
45c03a7a9b |
14
http.go
14
http.go
|
@ -76,14 +76,22 @@ type HTTPPoolOptions struct {
|
||||||
Context func(*http.Request) context.Context
|
Context func(*http.Request) context.Context
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewHTTPPoolWithWorkspace initializes an HTTP pool of peers, and registers itself as a PeerPicker.
|
||||||
|
// For convenience, it also registers itself as an http.Handler with http.DefaultServeMux.
|
||||||
|
// The self argument should be a valid base URL that points to the current server,
|
||||||
|
// for example "http://example.net:8000".
|
||||||
|
func NewHTTPPoolWithWorkspace(ws *workspace, self string) *HTTPPool {
|
||||||
|
p := NewHTTPPoolOptsWithWorkspace(ws, self, nil)
|
||||||
|
http.Handle(p.opts.BasePath, p)
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
|
||||||
// NewHTTPPool initializes an HTTP pool of peers, and registers itself as a PeerPicker.
|
// NewHTTPPool initializes an HTTP pool of peers, and registers itself as a PeerPicker.
|
||||||
// For convenience, it also registers itself as an http.Handler with http.DefaultServeMux.
|
// For convenience, it also registers itself as an http.Handler with http.DefaultServeMux.
|
||||||
// The self argument should be a valid base URL that points to the current server,
|
// The self argument should be a valid base URL that points to the current server,
|
||||||
// for example "http://example.net:8000".
|
// for example "http://example.net:8000".
|
||||||
func NewHTTPPool(self string) *HTTPPool {
|
func NewHTTPPool(self string) *HTTPPool {
|
||||||
p := NewHTTPPoolOpts(self, nil)
|
return NewHTTPPoolWithWorkspace(DefaultWorkspace, self)
|
||||||
http.Handle(p.opts.BasePath, p)
|
|
||||||
return p
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewHTTPPoolOptsWithWorkspace initializes an HTTP pool of peers with the given options.
|
// NewHTTPPoolOptsWithWorkspace initializes an HTTP pool of peers with the given options.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user