Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tarantool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
tarantool
Commits
1f88a9f2
Commit
1f88a9f2
authored
11 years ago
by
Konstantin Osipov
Browse files
Options
Downloads
Plain Diff
Merge branch 'box-lua-speedup'
parents
9bacc157
64229a61
No related branches found
Branches containing commit
Tags
1.5.1
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/box/lua/box.lua
+39
-13
39 additions, 13 deletions
src/box/lua/box.lua
test/box/lua.result
+1
-1
1 addition, 1 deletion
test/box/lua.result
with
40 additions
and
14 deletions
src/box/lua/box.lua
+
39
−
13
View file @
1f88a9f2
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
test/box/lua.result
+
1
−
1
View file @
1f88a9f2
No preview for this file type
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment