From 2066723e714e1cc52b6a7991d0bfd3749b3a6203 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Tue, 26 Sep 2017 20:05:07 +0800 Subject: [PATCH] implement GroupPolicy of GroupPolicyHandler --- engine_group_policy.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engine_group_policy.go b/engine_group_policy.go index 5ac89f71..e79f7d52 100644 --- a/engine_group_policy.go +++ b/engine_group_policy.go @@ -18,6 +18,11 @@ type GroupPolicy interface { // GroupPolicyHandler should be used when a function is a GroupPolicy 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 type RandomPolicy struct { r *rand.Rand