Group based PeerPicker
- Dominant language
- Go
- Stars
- 13.3k
- Forks
- 1.4k
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
This is a question. The newGroup function is private
func newGroup(name string, cacheBytes int64, getter Getter, peers PeerPicker) *Group
That means I can't pass my own PeerPicker when creating a group. As such, the default HttpPool's PeerPicker is used. Why is this restriction?
I may not understand groupchache correctly. If so correct me. My understanding is the default PeerPicker is portPicker in HttpPool. It uses consistenthash.Map to hash a string into groupcache peers, whether or not a particular peer has created a particular group or not. Suppose I have three processes running groupcache: p1, p2, and p3. And I have two groups: g1, g2. Assume we have the following peer to group mapping:
p1: g1, g2
p2: g2, g3
p3: g1, g3
If in p2 if I call
g2 := groupcache.NewGroup("g2", 10<<20, g2Getter)
g2.Get(ctx, "foo", groupcache.StringSink(&s))
and if "foo" is hashed to p3 where there is no group "g2" will that result in "foo" never cached?
I am adding peer/group auto discover with zookeeper, where grouphook will add itself to zk. Then a group based PeerPicker can be written to only hash the key to those peers that have the group. However, since newGroup with user defined picker is private, I can't find a way to set my own group based PeerPicker.
Thanks,
-John
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.