diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..d5ca99c072f19da18d683d2bab5ca96b42c1d7b8 Binary files /dev/null and b/.DS_Store differ diff --git a/common/extension/tps_limit.go b/common/extension/tps_limit.go index e789d5b1065add49fcf255a6c4fe3dab808e6d08..7d5cb8e9f6465a7a6aab98fa2ed484c4715c31c3 100644 --- a/common/extension/tps_limit.go +++ b/common/extension/tps_limit.go @@ -18,20 +18,20 @@ package extension import ( - "github.com/apache/dubbo-go/filter/impl/tps/intf" + "github.com/apache/dubbo-go/filter/impl/tps" ) var ( - tpsLimitStrategy = make(map[string]func(rate int, interval int) intf.TpsLimitStrategy) - tpsLimiter = make(map[string]func() intf.TpsLimiter) - tpsRejectedExecutionHandler = make(map[string]func() intf.RejectedExecutionHandler) + tpsLimitStrategy = make(map[string]func(rate int, interval int) tps.TpsLimitStrategy) + tpsLimiter = make(map[string]func() tps.TpsLimiter) + tpsRejectedExecutionHandler = make(map[string]func() tps.RejectedExecutionHandler) ) -func SetTpsLimiter(name string, creator func() intf.TpsLimiter) { +func SetTpsLimiter(name string, creator func() tps.TpsLimiter) { tpsLimiter[name] = creator } -func GetTpsLimiter(name string) intf.TpsLimiter { +func GetTpsLimiter(name string) tps.TpsLimiter { creator, ok := tpsLimiter[name] if !ok { panic("TpsLimiter for " + name + " is not existing, make sure you have import the package " + @@ -40,11 +40,11 @@ func GetTpsLimiter(name string) intf.TpsLimiter { return creator() } -func SetTpsLimitStrategy(name string, creator func(rate int, interval int) intf.TpsLimitStrategy) { +func SetTpsLimitStrategy(name string, creator func(rate int, interval int) tps.TpsLimitStrategy) { tpsLimitStrategy[name] = creator } -func GetTpsLimitStrategyCreator(name string) func(rate int, interval int) intf.TpsLimitStrategy { +func GetTpsLimitStrategyCreator(name string) func(rate int, interval int) tps.TpsLimitStrategy { creator, ok := tpsLimitStrategy[name] if !ok { panic("TpsLimitStrategy for " + name + " is not existing, make sure you have import the package " + @@ -53,11 +53,11 @@ func GetTpsLimitStrategyCreator(name string) func(rate int, interval int) intf.T return creator } -func SetTpsRejectedExecutionHandler(name string, creator func() intf.RejectedExecutionHandler) { +func SetTpsRejectedExecutionHandler(name string, creator func() tps.RejectedExecutionHandler) { tpsRejectedExecutionHandler[name] = creator } -func GetTpsRejectedExecutionHandler(name string) intf.RejectedExecutionHandler { +func GetTpsRejectedExecutionHandler(name string) tps.RejectedExecutionHandler { creator, ok := tpsRejectedExecutionHandler[name] if !ok { panic("TpsRejectedExecutionHandler for " + name + " is not existing, make sure you have import the package " + diff --git a/filter/impl/tps/rejected_execution_handler_mock.go b/filter/impl/tps/impl/rejected_execution_handler_mock.go similarity index 99% rename from filter/impl/tps/rejected_execution_handler_mock.go rename to filter/impl/tps/impl/rejected_execution_handler_mock.go index 55b01f022f8264e70d1b298db7d4d2465fcd6704..2f7869d61ea2cf4cf8e490dd004ab086b9492132 100644 --- a/filter/impl/tps/rejected_execution_handler_mock.go +++ b/filter/impl/tps/impl/rejected_execution_handler_mock.go @@ -18,7 +18,7 @@ // Source: rejected_execution_handler.go // Package filter is a generated GoMock package. -package tps +package impl import ( common "github.com/apache/dubbo-go/common" diff --git a/filter/impl/tps/rejected_execution_handler_only_log.go b/filter/impl/tps/impl/rejected_execution_handler_only_log.go similarity index 94% rename from filter/impl/tps/rejected_execution_handler_only_log.go rename to filter/impl/tps/impl/rejected_execution_handler_only_log.go index 596160f07c3f749097c07dbfd5514492c8f105a2..62d2fc81cbcf0a220613ecaef9a100abbe1dff76 100644 --- a/filter/impl/tps/rejected_execution_handler_only_log.go +++ b/filter/impl/tps/impl/rejected_execution_handler_only_log.go @@ -15,7 +15,7 @@ * limitations under the License. */ -package tps +package impl import ( "sync" @@ -26,7 +26,7 @@ import ( "github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/extension" "github.com/apache/dubbo-go/common/logger" - "github.com/apache/dubbo-go/filter/impl/tps/intf" + "github.com/apache/dubbo-go/filter/impl/tps" "github.com/apache/dubbo-go/protocol" ) @@ -61,7 +61,7 @@ func (handler *OnlyLogRejectedExecutionHandler) RejectedExecution(url common.URL return &protocol.RPCResult{} } -func GetOnlyLogRejectedExecutionHandler() intf.RejectedExecutionHandler { +func GetOnlyLogRejectedExecutionHandler() tps.RejectedExecutionHandler { onlyLogHandlerOnce.Do(func() { onlyLogHandlerInstance = &OnlyLogRejectedExecutionHandler{} }) diff --git a/filter/impl/tps/rejected_execution_handler_only_log_test.go b/filter/impl/tps/impl/rejected_execution_handler_only_log_test.go similarity index 98% rename from filter/impl/tps/rejected_execution_handler_only_log_test.go rename to filter/impl/tps/impl/rejected_execution_handler_only_log_test.go index beff7e3f2c6295d72c1e8bd6be55e3351f2d912f..da54d8a106338dd4f21f9b01e66b031e3c311e01 100644 --- a/filter/impl/tps/rejected_execution_handler_only_log_test.go +++ b/filter/impl/tps/impl/rejected_execution_handler_only_log_test.go @@ -15,7 +15,7 @@ * limitations under the License. */ -package tps +package impl import ( "net/url" diff --git a/filter/impl/tps/tps_limit_fix_window_strategy.go b/filter/impl/tps/impl/tps_limit_fix_window_strategy.go similarity index 96% rename from filter/impl/tps/tps_limit_fix_window_strategy.go rename to filter/impl/tps/impl/tps_limit_fix_window_strategy.go index 7e4032c684876034be95347e156dc0496e5db1dc..7290619d5551ebe29209e7cfa717bd66442ca2df 100644 --- a/filter/impl/tps/tps_limit_fix_window_strategy.go +++ b/filter/impl/tps/impl/tps_limit_fix_window_strategy.go @@ -15,7 +15,7 @@ * limitations under the License. */ -package tps +package impl import ( "sync/atomic" @@ -24,7 +24,7 @@ import ( import ( "github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/extension" - "github.com/apache/dubbo-go/filter/impl/tps/intf" + "github.com/apache/dubbo-go/filter/impl/tps" ) const ( @@ -75,7 +75,7 @@ func (impl *FixedWindowTpsLimitStrategyImpl) IsAllowable() bool { return atomic.AddInt32(&impl.count, 1) <= impl.rate } -func NewFixedWindowTpsLimitStrategyImpl(rate int, interval int) intf.TpsLimitStrategy { +func NewFixedWindowTpsLimitStrategyImpl(rate int, interval int) tps.TpsLimitStrategy { return &FixedWindowTpsLimitStrategyImpl{ rate: int32(rate), interval: int64(interval * 1000), // convert to ns diff --git a/filter/impl/tps/tps_limit_fix_window_strategy_test.go b/filter/impl/tps/impl/tps_limit_fix_window_strategy_test.go similarity index 99% rename from filter/impl/tps/tps_limit_fix_window_strategy_test.go rename to filter/impl/tps/impl/tps_limit_fix_window_strategy_test.go index 8848a05dde5a079f2e8be07a5ce80a756b4b13fe..55d0b14b75e69b44cf9ebe3a615e1a05c60d4b41 100644 --- a/filter/impl/tps/tps_limit_fix_window_strategy_test.go +++ b/filter/impl/tps/impl/tps_limit_fix_window_strategy_test.go @@ -15,7 +15,7 @@ * limitations under the License. */ -package tps +package impl import ( "testing" diff --git a/filter/impl/tps/tps_limit_sliding_window_strategy.go b/filter/impl/tps/impl/tps_limit_sliding_window_strategy.go similarity index 96% rename from filter/impl/tps/tps_limit_sliding_window_strategy.go rename to filter/impl/tps/impl/tps_limit_sliding_window_strategy.go index 3a8db5ab3752bc3fbf22cd16a5810e6d69b37a27..de98eb7528f541ed57b04309e2c9c74b8310cc64 100644 --- a/filter/impl/tps/tps_limit_sliding_window_strategy.go +++ b/filter/impl/tps/impl/tps_limit_sliding_window_strategy.go @@ -15,7 +15,7 @@ * limitations under the License. */ -package tps +package impl import ( "container/list" @@ -25,7 +25,7 @@ import ( import ( "github.com/apache/dubbo-go/common/extension" - "github.com/apache/dubbo-go/filter/impl/tps/intf" + "github.com/apache/dubbo-go/filter/impl/tps" ) func init() { @@ -80,7 +80,7 @@ func (impl *SlidingWindowTpsLimitStrategyImpl) IsAllowable() bool { return false } -func NewSlidingWindowTpsLimitStrategyImpl(rate int, interval int) intf.TpsLimitStrategy { +func NewSlidingWindowTpsLimitStrategyImpl(rate int, interval int) tps.TpsLimitStrategy { return &SlidingWindowTpsLimitStrategyImpl{ rate: rate, interval: int64(interval * 1000), diff --git a/filter/impl/tps/tps_limit_sliding_window_strategy_test.go b/filter/impl/tps/impl/tps_limit_sliding_window_strategy_test.go similarity index 99% rename from filter/impl/tps/tps_limit_sliding_window_strategy_test.go rename to filter/impl/tps/impl/tps_limit_sliding_window_strategy_test.go index 1bca13d401efe57585d405514d82fcb801ff3aa8..1d0187fa201741a32f109abe51ce63b5568e4cc4 100644 --- a/filter/impl/tps/tps_limit_sliding_window_strategy_test.go +++ b/filter/impl/tps/impl/tps_limit_sliding_window_strategy_test.go @@ -15,7 +15,7 @@ * limitations under the License. */ -package tps +package impl import ( "testing" diff --git a/filter/impl/tps/tps_limit_strategy_mock.go b/filter/impl/tps/impl/tps_limit_strategy_mock.go similarity index 99% rename from filter/impl/tps/tps_limit_strategy_mock.go rename to filter/impl/tps/impl/tps_limit_strategy_mock.go index 72c658fb9a5d48b6080900a4645d318dfd2b0c21..a653fb287a2d89d8c6151889ca14b4b7b4832505 100644 --- a/filter/impl/tps/tps_limit_strategy_mock.go +++ b/filter/impl/tps/impl/tps_limit_strategy_mock.go @@ -18,7 +18,7 @@ // Source: tps_limit_strategy.go // Package filter is a generated GoMock package. -package tps +package impl import ( gomock "github.com/golang/mock/gomock" diff --git a/filter/impl/tps/tps_limit_thread_safe_fix_window_strategy.go b/filter/impl/tps/impl/tps_limit_thread_safe_fix_window_strategy.go similarity index 95% rename from filter/impl/tps/tps_limit_thread_safe_fix_window_strategy.go rename to filter/impl/tps/impl/tps_limit_thread_safe_fix_window_strategy.go index 3541252dbefce3729acc04415b1336dfc702ddfb..5f43e8c3bf6c1db268282a0fb5d9ecc55fb357df 100644 --- a/filter/impl/tps/tps_limit_thread_safe_fix_window_strategy.go +++ b/filter/impl/tps/impl/tps_limit_thread_safe_fix_window_strategy.go @@ -15,7 +15,7 @@ * limitations under the License. */ -package tps +package impl import ( "sync" @@ -23,7 +23,7 @@ import ( import ( "github.com/apache/dubbo-go/common/extension" - "github.com/apache/dubbo-go/filter/impl/tps/intf" + "github.com/apache/dubbo-go/filter/impl/tps" ) func init() { @@ -56,7 +56,7 @@ func (impl *ThreadSafeFixedWindowTpsLimitStrategyImpl) IsAllowable() bool { return impl.fixedWindow.IsAllowable() } -func NewThreadSafeFixedWindowTpsLimitStrategyImpl(rate int, interval int) intf.TpsLimitStrategy { +func NewThreadSafeFixedWindowTpsLimitStrategyImpl(rate int, interval int) tps.TpsLimitStrategy { fixedWindowStrategy := NewFixedWindowTpsLimitStrategyImpl(rate, interval).(*FixedWindowTpsLimitStrategyImpl) return &ThreadSafeFixedWindowTpsLimitStrategyImpl{ fixedWindow: fixedWindowStrategy, diff --git a/filter/impl/tps/tps_limit_thread_safe_fix_window_strategy_test.go b/filter/impl/tps/impl/tps_limit_thread_safe_fix_window_strategy_test.go similarity index 99% rename from filter/impl/tps/tps_limit_thread_safe_fix_window_strategy_test.go rename to filter/impl/tps/impl/tps_limit_thread_safe_fix_window_strategy_test.go index 72cd4800de17e512d1b2429a95687315329322ad..fea93dfa3b8ef49034e952619f617bf87e4be879 100644 --- a/filter/impl/tps/tps_limit_thread_safe_fix_window_strategy_test.go +++ b/filter/impl/tps/impl/tps_limit_thread_safe_fix_window_strategy_test.go @@ -15,7 +15,7 @@ * limitations under the License. */ -package tps +package impl import ( "testing" diff --git a/filter/impl/tps/tps_limiter_method_service.go b/filter/impl/tps/impl/tps_limiter_method_service.go similarity index 96% rename from filter/impl/tps/tps_limiter_method_service.go rename to filter/impl/tps/impl/tps_limiter_method_service.go index 01d9f6564a25ad08d188519e75a477a312ec0a31..3faf0d6e672315bb83e951be45a7f93c4ac508ef 100644 --- a/filter/impl/tps/tps_limiter_method_service.go +++ b/filter/impl/tps/impl/tps_limiter_method_service.go @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package tps +package impl import ( "fmt" @@ -30,7 +30,7 @@ import ( "github.com/apache/dubbo-go/common" "github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/extension" - "github.com/apache/dubbo-go/filter/impl/tps/intf" + "github.com/apache/dubbo-go/filter/impl/tps" "github.com/apache/dubbo-go/protocol" ) @@ -127,7 +127,7 @@ func (limiter MethodServiceTpsLimiterImpl) IsAllowable(url common.URL, invocatio limitState, found := limiter.tpsState.Load(limitTarget) if found { - return limitState.(intf.TpsLimitStrategy).IsAllowable() + return limitState.(tps.TpsLimitStrategy).IsAllowable() } limitRate := getLimitConfig(methodLimitRateConfig, url, invocation, @@ -149,7 +149,7 @@ func (limiter MethodServiceTpsLimiterImpl) IsAllowable(url common.URL, invocatio url.GetParam(constant.TPS_LIMIT_STRATEGY_KEY, constant.DEFAULT_KEY)) limitStateCreator := extension.GetTpsLimitStrategyCreator(limitStrategyConfig) limitState, _ = limiter.tpsState.LoadOrStore(limitTarget, limitStateCreator(int(limitRate), int(limitInterval))) - return limitState.(intf.TpsLimitStrategy).IsAllowable() + return limitState.(tps.TpsLimitStrategy).IsAllowable() } func getLimitConfig(methodLevelConfig string, @@ -178,7 +178,7 @@ func getLimitConfig(methodLevelConfig string, var methodServiceTpsLimiterInstance *MethodServiceTpsLimiterImpl var methodServiceTpsLimiterOnce sync.Once -func GetMethodServiceTpsLimiter() intf.TpsLimiter { +func GetMethodServiceTpsLimiter() tps.TpsLimiter { methodServiceTpsLimiterOnce.Do(func() { methodServiceTpsLimiterInstance = &MethodServiceTpsLimiterImpl{ tpsState: concurrent.NewMap(), diff --git a/filter/impl/tps/tps_limiter_method_service_test.go b/filter/impl/tps/impl/tps_limiter_method_service_test.go similarity index 96% rename from filter/impl/tps/tps_limiter_method_service_test.go rename to filter/impl/tps/impl/tps_limiter_method_service_test.go index 8a6fa8398dae9aaa3a7c58422d669b8ab16c55e1..006e9463871061488f696366d251c54fb8cefef5 100644 --- a/filter/impl/tps/tps_limiter_method_service_test.go +++ b/filter/impl/tps/impl/tps_limiter_method_service_test.go @@ -15,7 +15,7 @@ * limitations under the License. */ -package tps +package impl import ( "net/url" @@ -30,7 +30,7 @@ import ( "github.com/apache/dubbo-go/common" "github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/extension" - "github.com/apache/dubbo-go/filter/impl/tps/intf" + "github.com/apache/dubbo-go/filter/impl/tps" "github.com/apache/dubbo-go/protocol/invocation" ) @@ -48,7 +48,7 @@ func TestMethodServiceTpsLimiterImpl_IsAllowable_Only_Service_Level(t *testing.T mockStrategyImpl := NewMockTpsLimitStrategy(ctrl) mockStrategyImpl.EXPECT().IsAllowable().Return(true).Times(1) - extension.SetTpsLimitStrategy(constant.DEFAULT_KEY, func(rate int, interval int) intf.TpsLimitStrategy { + extension.SetTpsLimitStrategy(constant.DEFAULT_KEY, func(rate int, interval int) tps.TpsLimitStrategy { assert.Equal(t, 20, rate) assert.Equal(t, 60000, interval) return mockStrategyImpl @@ -95,7 +95,7 @@ func TestMethodServiceTpsLimiterImpl_IsAllowable_Method_Level_Override(t *testin mockStrategyImpl := NewMockTpsLimitStrategy(ctrl) mockStrategyImpl.EXPECT().IsAllowable().Return(true).Times(1) - extension.SetTpsLimitStrategy(constant.DEFAULT_KEY, func(rate int, interval int) intf.TpsLimitStrategy { + extension.SetTpsLimitStrategy(constant.DEFAULT_KEY, func(rate int, interval int) tps.TpsLimitStrategy { assert.Equal(t, 40, rate) assert.Equal(t, 7000, interval) return mockStrategyImpl @@ -123,7 +123,7 @@ func TestMethodServiceTpsLimiterImpl_IsAllowable_Both_Method_And_Service(t *test mockStrategyImpl := NewMockTpsLimitStrategy(ctrl) mockStrategyImpl.EXPECT().IsAllowable().Return(true).Times(1) - extension.SetTpsLimitStrategy(constant.DEFAULT_KEY, func(rate int, interval int) intf.TpsLimitStrategy { + extension.SetTpsLimitStrategy(constant.DEFAULT_KEY, func(rate int, interval int) tps.TpsLimitStrategy { assert.Equal(t, 40, rate) assert.Equal(t, 3000, interval) return mockStrategyImpl diff --git a/filter/impl/tps/tps_limiter_mock.go b/filter/impl/tps/impl/tps_limiter_mock.go similarity index 99% rename from filter/impl/tps/tps_limiter_mock.go rename to filter/impl/tps/impl/tps_limiter_mock.go index a247bf14daf947628cb793c913f701769e0ad4ef..ff2f984e13a8617aefdbef0137ed8feca1bfd4ba 100644 --- a/filter/impl/tps/tps_limiter_mock.go +++ b/filter/impl/tps/impl/tps_limiter_mock.go @@ -18,7 +18,7 @@ // Source: tps_limiter.go // Package filter is a generated GoMock package. -package tps +package impl import ( common "github.com/apache/dubbo-go/common" diff --git a/filter/impl/tps/intf/rejected_execution_handler.go b/filter/impl/tps/rejected_execution_handler.go similarity index 99% rename from filter/impl/tps/intf/rejected_execution_handler.go rename to filter/impl/tps/rejected_execution_handler.go index 1e0c0938f8e8fb19ae3d1086688a08cbdb896a98..827908974e5bd4f9679d0c4c66c70a8259887d5c 100644 --- a/filter/impl/tps/intf/rejected_execution_handler.go +++ b/filter/impl/tps/rejected_execution_handler.go @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package intf +package tps import ( "github.com/apache/dubbo-go/common" diff --git a/filter/impl/tps/intf/tps_limit_strategy.go b/filter/impl/tps/tps_limit_strategy.go similarity index 99% rename from filter/impl/tps/intf/tps_limit_strategy.go rename to filter/impl/tps/tps_limit_strategy.go index ed52daebf66b3aef29e75d39eaa8c10e146e8319..d1af85b464ca3cbb500100b895cdc0badff24898 100644 --- a/filter/impl/tps/intf/tps_limit_strategy.go +++ b/filter/impl/tps/tps_limit_strategy.go @@ -15,7 +15,7 @@ * limitations under the License. */ -package intf +package tps /* * please register your implementation by invoking SetTpsLimitStrategy diff --git a/filter/impl/tps/intf/tps_limiter.go b/filter/impl/tps/tps_limiter.go similarity index 98% rename from filter/impl/tps/intf/tps_limiter.go rename to filter/impl/tps/tps_limiter.go index d3935c11dec74cc7f4975569280d0825e84a9b6c..0622a957a8ba14fdebb52ff44ecf72da17703163 100644 --- a/filter/impl/tps/intf/tps_limiter.go +++ b/filter/impl/tps/tps_limiter.go @@ -15,7 +15,7 @@ * limitations under the License. */ -package intf +package tps import ( "github.com/apache/dubbo-go/common" diff --git a/filter/impl/tps_limit_filter.go b/filter/impl/tps_limit_filter.go index 11f969e86597dc086c0d6b63d40aa0995e451e6b..1e3222c0e86f5e8c108420e91a0816067ed8443e 100644 --- a/filter/impl/tps_limit_filter.go +++ b/filter/impl/tps_limit_filter.go @@ -21,7 +21,7 @@ import ( "github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/extension" "github.com/apache/dubbo-go/filter" - _ "github.com/apache/dubbo-go/filter/impl/tps" + _ "github.com/apache/dubbo-go/filter/impl/tps/impl" "github.com/apache/dubbo-go/protocol" ) diff --git a/filter/impl/tps_limit_filter_test.go b/filter/impl/tps_limit_filter_test.go index 18a72ba9e97ca8c423965929c28b317982a7143d..5f5557b07e386e93c641f9d81e3dd9fa1253c41c 100644 --- a/filter/impl/tps_limit_filter_test.go +++ b/filter/impl/tps_limit_filter_test.go @@ -32,7 +32,7 @@ import ( "github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/extension" "github.com/apache/dubbo-go/filter/impl/tps" - "github.com/apache/dubbo-go/filter/impl/tps/intf" + "github.com/apache/dubbo-go/filter/impl/tps/impl" "github.com/apache/dubbo-go/protocol" "github.com/apache/dubbo-go/protocol/invocation" ) @@ -54,9 +54,9 @@ func TestTpsLimitFilter_Invoke_With_No_TpsLimiter(t *testing.T) { func TestGenericFilter_Invoke_With_Default_TpsLimiter(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() - mockLimiter := tps.NewMockTpsLimiter(ctrl) + mockLimiter := impl.NewMockTpsLimiter(ctrl) mockLimiter.EXPECT().IsAllowable(gomock.Any(), gomock.Any()).Return(true).Times(1) - extension.SetTpsLimiter(constant.DEFAULT_KEY, func() intf.TpsLimiter { + extension.SetTpsLimiter(constant.DEFAULT_KEY, func() tps.TpsLimiter { return mockLimiter }) @@ -75,17 +75,17 @@ func TestGenericFilter_Invoke_With_Default_TpsLimiter(t *testing.T) { func TestGenericFilter_Invoke_With_Default_TpsLimiter_Not_Allow(t *testing.T) { ctrl := gomock.NewController(t) defer ctrl.Finish() - mockLimiter := tps.NewMockTpsLimiter(ctrl) + mockLimiter := impl.NewMockTpsLimiter(ctrl) mockLimiter.EXPECT().IsAllowable(gomock.Any(), gomock.Any()).Return(false).Times(1) - extension.SetTpsLimiter(constant.DEFAULT_KEY, func() intf.TpsLimiter { + extension.SetTpsLimiter(constant.DEFAULT_KEY, func() tps.TpsLimiter { return mockLimiter }) mockResult := &protocol.RPCResult{} - mockRejectedHandler := tps.NewMockRejectedExecutionHandler(ctrl) + mockRejectedHandler := impl.NewMockRejectedExecutionHandler(ctrl) mockRejectedHandler.EXPECT().RejectedExecution(gomock.Any(), gomock.Any()).Return(mockResult).Times(1) - extension.SetTpsRejectedExecutionHandler(constant.DEFAULT_KEY, func() intf.RejectedExecutionHandler { + extension.SetTpsRejectedExecutionHandler(constant.DEFAULT_KEY, func() tps.RejectedExecutionHandler { return mockRejectedHandler })