Skip to content

Commit

Permalink
Fix inconsistency with index argument name and types
Browse files Browse the repository at this point in the history
  • Loading branch information
ligurio committed Jul 15, 2021
1 parent 9df8498 commit 98ec296
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
20 changes: 10 additions & 10 deletions crud/borders.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ local borders = {}
local STAT_FUNC_NAME = '_crud.get_border_on_storage'


local function get_border_on_storage(border_name, space_name, index_id, field_names)
dev_checks('string', 'string', 'number', '?table')
local function get_border_on_storage(border_name, space_name, index_name, field_names)
dev_checks('string', 'string', 'string|number', '?table')

assert(border_name == 'min' or border_name == 'max')

Expand All @@ -26,9 +26,9 @@ local function get_border_on_storage(border_name, space_name, index_id, field_na
return nil, BorderError:new("Space %q doesn't exist", space_name)
end

local index = space.index[index_id]
local index = space.index[index_name]
if index == nil then
return nil, BorderError:new("Index %q of space doesn't exist", index_id, space_name)
return nil, BorderError:new("Index %q of space doesn't exist", index_name, space_name)
end

local function get_index_border(index)
Expand Down Expand Up @@ -164,7 +164,7 @@ end
-- A space name
--
-- @param ?string index_name
-- An index name (by default, primary index is used)
-- An index name as well as numerical id (by default, primary index is used)
--
-- @tparam ?number opts.timeout
-- Function call timeout
Expand All @@ -175,8 +175,8 @@ end
-- @return[1] result
-- @treturn[2] nil
-- @treturn[2] table Error description
function borders.min(space_name, index_id, opts)
return get_border('min', space_name, index_id, opts)
function borders.min(space_name, index_name, opts)
return get_border('min', space_name, index_name, opts)
end

--- Find the maximum value in the specified index
Expand All @@ -187,7 +187,7 @@ end
-- A space name
--
-- @param ?string index_name
-- An index name (by default, primary index is used)
-- An index name as well as numerical id (by default, primary index is used)
--
-- @tparam ?number opts.timeout
-- Function call timeout
Expand All @@ -198,8 +198,8 @@ end
-- @return[1] result
-- @treturn[2] nil
-- @treturn[2] table Error description
function borders.max(space_name, index_id, opts)
return get_border('max', space_name, index_id, opts)
function borders.max(space_name, index_name, opts)
return get_border('max', space_name, index_name, opts)
end

return borders
8 changes: 4 additions & 4 deletions crud/select.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ function checkers.vshard_call_mode(p)
return p == 'write' or p == 'read'
end

local function select_on_storage(space_name, index_id, conditions, opts)
dev_checks('string', 'number', '?table', {
local function select_on_storage(space_name, index_name, conditions, opts)
dev_checks('string', 'string|number', '?table', {
scan_value = 'table',
after_tuple = '?table',
tarantool_iter = 'number',
Expand All @@ -50,9 +50,9 @@ local function select_on_storage(space_name, index_id, conditions, opts)
return nil, SelectError:new("Space %q doesn't exist", space_name)
end

local index = space.index[index_id]
local index = space.index[index_name]
if index == nil then
return nil, SelectError:new("Index with ID %s doesn't exist", index_id)
return nil, SelectError:new("Index with ID %s doesn't exist", index_name)
end

local filter_func, err = select_filters.gen_func(space, conditions, {
Expand Down

0 comments on commit 98ec296

Please sign in to comment.