You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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
The text was updated successfully, but these errors were encountered:
I think the assumption is that all peers in the pool expose the same groups. Groups differ eventually in the application's perspective, only by the fetcher function.
So if you have different groups in the same program instance, all instances of the program should expose the same groups. And if these are not instances of the same program, you should have separate pools anyway (this is what I do, BTW).
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
The text was updated successfully, but these errors were encountered: