mirror of
https://github.com/mailgun/groupcache.git
synced 2024-11-16 14:10:04 +00:00
Workspace-aware HTTPPool.
This commit is contained in:
parent
45c03a7a9b
commit
46898854d9
5
http.go
5
http.go
@ -40,6 +40,8 @@ const defaultReplicas = 50
|
|||||||
|
|
||||||
// HTTPPool implements PeerPicker for a pool of HTTP peers.
|
// HTTPPool implements PeerPicker for a pool of HTTP peers.
|
||||||
type HTTPPool struct {
|
type HTTPPool struct {
|
||||||
|
ws *workspace
|
||||||
|
|
||||||
// this peer's base URL, e.g. "https://example.net:8000"
|
// this peer's base URL, e.g. "https://example.net:8000"
|
||||||
self string
|
self string
|
||||||
|
|
||||||
@ -104,6 +106,7 @@ func NewHTTPPoolOptsWithWorkspace(ws *workspace, self string, o *HTTPPoolOptions
|
|||||||
ws.httpPoolMade = true
|
ws.httpPoolMade = true
|
||||||
|
|
||||||
p := &HTTPPool{
|
p := &HTTPPool{
|
||||||
|
ws: ws,
|
||||||
self: self,
|
self: self,
|
||||||
httpGetters: make(map[string]*httpGetter),
|
httpGetters: make(map[string]*httpGetter),
|
||||||
}
|
}
|
||||||
@ -186,7 +189,7 @@ func (p *HTTPPool) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
key := parts[1]
|
key := parts[1]
|
||||||
|
|
||||||
// Fetch the value for this group/key.
|
// Fetch the value for this group/key.
|
||||||
group := GetGroup(groupName)
|
group := GetGroupWithWorkspace(p.ws, groupName)
|
||||||
if group == nil {
|
if group == nil {
|
||||||
http.Error(w, "no such group: "+groupName, http.StatusNotFound)
|
http.Error(w, "no such group: "+groupName, http.StatusNotFound)
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user