implement GroupPolicy of GroupPolicyHandler

This commit is contained in:
Lunny Xiao 2017-09-26 20:05:07 +08:00
parent 8f73a779a8
commit 2066723e71
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
1 changed files with 5 additions and 0 deletions

View File

@ -18,6 +18,11 @@ type GroupPolicy interface {
// GroupPolicyHandler should be used when a function is a GroupPolicy // GroupPolicyHandler should be used when a function is a GroupPolicy
type GroupPolicyHandler func(*EngineGroup) *Engine type GroupPolicyHandler func(*EngineGroup) *Engine
// Slave implements the chosen of slaves
func (h GroupPolicyHandler) Slave(eg *EngineGroup) *Engine {
return h(eg)
}
// RandomPolicy implmentes randomly chose the slave of slaves // RandomPolicy implmentes randomly chose the slave of slaves
type RandomPolicy struct { type RandomPolicy struct {
r *rand.Rand r *rand.Rand