Skip to content
Snippets Groups Projects
Commit 1f88a9f2 authored by Konstantin Osipov's avatar Konstantin Osipov
Browse files

Merge branch 'box-lua-speedup'

parents 9bacc157 64229a61
No related branches found
Tags 1.5.1
No related merge requests found
......@@ -8,16 +8,22 @@ box.flags = { BOX_RETURN_TUPLE = 0x01, BOX_ADD = 0x02, BOX_REPLACE = 0x04 }
--
--
function box.select_limit(space, index, offset, limit, ...)
return box.net.self:select_limit(tonumber(space), tonumber(index),
tonumber(offset), tonumber(limit), ...)
local key_part_count = select('#', ...)
return box.process(17,
box.pack('iiiiiV',
tonumber(space),
tonumber(index),
tonumber(offset),
tonumber(limit),
1, -- key count
key_part_count, ...))
end
--
--
--
function box.select(space, index, ...)
return box.net.self:select(tonumber(space), tonumber(index), ...)
return box.select_limit(space, index, 0, 4294967295, ...)
end
--
......@@ -26,8 +32,7 @@ end
-- starts from the key.
--
function box.select_range(sno, ino, limit, ...)
return box.net.self:select_range(tonumber(sno), tonumber(ino),
tonumber(limit), ...)
return box.net.self:select_range(sno, ino, limit, ...)
end
--
......@@ -36,8 +41,7 @@ end
-- starts from the key.
--
function box.select_reverse_range(sno, ino, limit, ...)
return box.net.self:select_reverse_range(tonumber(sno), tonumber(ino),
tonumber(limit), ...)
return box.net.self:select_reverse_range(sno, ino, limit, ...)
end
--
......@@ -45,25 +49,47 @@ end
-- index is always 0. It doesn't accept compound keys
--
function box.delete(space, ...)
return box.net.self:delete(tonumber(space), ...)
local key_part_count = select('#', ...)
return box.process(21,
box.pack('iiV',
tonumber(space),
box.flags.BOX_RETURN_TUPLE, -- flags
key_part_count, ...))
end
-- insert or replace a tuple
function box.replace(space, ...)
return box.net.self:replace(tonumber(space), ...)
local field_count = select('#', ...)
return box.process(13,
box.pack('iiV',
tonumber(space),
box.flags.BOX_RETURN_TUPLE, -- flags
field_count, ...))
end
-- insert a tuple (produces an error if the tuple already exists)
function box.insert(space, ...)
return box.net.self:insert(tonumber(space), ...)
local field_count = select('#', ...)
return box.process(13,
box.pack('iiV',
tonumber(space),
bit.bor(box.flags.BOX_RETURN_TUPLE,
box.flags.BOX_ADD), -- flags
field_count, ...))
end
--
function box.update(space, key, format, ...)
return box.net.self:update(tonumber(space), key, format, ...)
local op_count = select('#', ...)/2
return box.process(19,
box.pack('iiVi'..format,
tonumber(space),
box.flags.BOX_RETURN_TUPLE,
1, key,
op_count,
...))
end
function box.dostring(s, ...)
local chunk, message = loadstring(s)
if chunk == nil then
......
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment