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
a2966b17
Commit
a2966b17
authored
13 years ago
by
Dmitry Simonenko
Browse files
Options
Downloads
Patches
Plain Diff
index-iter-prev: lua index prev and select_reverse_range functions added
parent
153fef4f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mod/box/box.lua
+22
-0
22 additions, 0 deletions
mod/box/box.lua
with
22 additions
and
0 deletions
mod/box/box.lua
+
22
−
0
View file @
a2966b17
...
@@ -40,6 +40,15 @@ function box.select_range(sno, ino, limit, ...)
...
@@ -40,6 +40,15 @@ function box.select_range(sno, ino, limit, ...)
return
box
.
space
[
tonumber
(
sno
)].
index
[
tonumber
(
ino
)]:
select_range
(
tonumber
(
limit
),
...
)
return
box
.
space
[
tonumber
(
sno
)].
index
[
tonumber
(
ino
)]:
select_range
(
tonumber
(
limit
),
...
)
end
end
--
-- Select a range of tuples in a given namespace via a given
-- index in reverse order. If key is NULL, starts from the end, otherwise
-- starts from the key.
--
function
box
.
select_reverse_range
(
sno
,
ino
,
limit
,
...
)
return
box
.
space
[
tonumber
(
sno
)].
index
[
tonumber
(
ino
)]:
select_reverse_range
(
tonumber
(
limit
),
...
)
end
--
--
-- delete can be done only by the primary key, whose
-- delete can be done only by the primary key, whose
-- index is always 0. It doesn't accept compound keys
-- index is always 0. It doesn't accept compound keys
...
@@ -116,6 +125,16 @@ function box.on_reload_configuration()
...
@@ -116,6 +125,16 @@ function box.on_reload_configuration()
end
end
return
unpack
(
range
)
return
unpack
(
range
)
end
end
index_mt
.
select_reverse_range
=
function
(
index
,
limit
,
...
)
local
range
=
{}
for
k
,
v
in
index
.
idx
.
prev
,
index
.
idx
,
...
do
if
#
range
>=
limit
then
break
end
table.insert
(
range
,
v
)
end
return
unpack
(
range
)
end
--
--
local
space_mt
=
{}
local
space_mt
=
{}
space_mt
.
len
=
function
(
space
)
return
space
.
index
[
0
]:
len
()
end
space_mt
.
len
=
function
(
space
)
return
space
.
index
[
0
]:
len
()
end
...
@@ -124,6 +143,9 @@ function box.on_reload_configuration()
...
@@ -124,6 +143,9 @@ function box.on_reload_configuration()
space_mt
.
select_range
=
function
(
space
,
ino
,
limit
,
...
)
space_mt
.
select_range
=
function
(
space
,
ino
,
limit
,
...
)
return
space
.
index
[
ino
]:
select_range
(
limit
,
...
)
return
space
.
index
[
ino
]:
select_range
(
limit
,
...
)
end
end
space_mt
.
select_reverse_range
=
function
(
space
,
ino
,
limit
,
...
)
return
space
.
index
[
ino
]:
select_reverse_range
(
limit
,
...
)
end
space_mt
.
select_limit
=
function
(
space
,
ino
,
offset
,
limit
,
...
)
space_mt
.
select_limit
=
function
(
space
,
ino
,
offset
,
limit
,
...
)
return
box
.
select_limit
(
space
.
n
,
ino
,
offset
,
limit
,
...
)
return
box
.
select_limit
(
space
.
n
,
ino
,
offset
,
limit
,
...
)
end
end
...
...
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