Skip to content

Commit dc3d4f0

Browse files
committed
router: use explicit args in API calls
Currently, internal router API functions use varargs to pass arguments. This differs from the storage API implementation, where arguments are explicit. This patch replaces varargs with explicit arguments in the router_api_call_safe, router_api_call_unsafe and router_make_api functions. Motivation: - Consistency between router and storage internal APIs - Using explicit arguments instead of varargs is more friendly to the JIT compiler Part of #266 NO_DOC=refactoring NO_TEST=refactoring
1 parent 1d6c197 commit dc3d4f0

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

vshard/router/init.lua

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1661,15 +1661,16 @@ end
16611661
-- Public API protection
16621662
--------------------------------------------------------------------------------
16631663

1664-
local function router_api_call_safe(func, router, ...)
1665-
return func(router, ...)
1664+
local function router_api_call_safe(func, router, arg1, arg2, arg3, arg4, arg5)
1665+
return func(router, arg1, arg2, arg3, arg4, arg5)
16661666
end
16671667

16681668
--
16691669
-- Unsafe proxy is loaded with protections. But it is used rarely and only in
16701670
-- the beginning of instance's lifetime.
16711671
--
1672-
local function router_api_call_unsafe(func, router, ...)
1672+
local function router_api_call_unsafe(func, router, arg1, arg2,
1673+
arg3, arg4, arg5)
16731674
-- Router can be started on instance with unconfigured box.cfg.
16741675
if not router.is_configured then
16751676
local msg = 'router is not configured'
@@ -1680,12 +1681,12 @@ local function router_api_call_unsafe(func, router, ...)
16801681
return error(lerror.vshard(lerror.code.ROUTER_IS_DISABLED, msg))
16811682
end
16821683
router.api_call_cache = router_api_call_safe
1683-
return func(router, ...)
1684+
return func(router, arg1, arg2, arg3, arg4, arg5)
16841685
end
16851686

16861687
local function router_make_api(func)
1687-
return function(router, ...)
1688-
return router.api_call_cache(func, router, ...)
1688+
return function(router, arg1, arg2, arg3, arg4, arg5)
1689+
return router.api_call_cache(func, router, arg1, arg2, arg3, arg4, arg5)
16891690
end
16901691
end
16911692

0 commit comments

Comments
 (0)