Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tempsdb
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
public
tempsdb
Commits
e3ad397d
Commit
e3ad397d
authored
4 years ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
add iterate_range
parent
f580a546
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tempsdb/chunks.pxd
+1
-0
1 addition, 0 deletions
tempsdb/chunks.pxd
tempsdb/chunks.pyx
+18
-0
18 additions, 0 deletions
tempsdb/chunks.pyx
with
19 additions
and
0 deletions
tempsdb/chunks.pxd
+
1
−
0
View file @
e3ad397d
...
...
@@ -14,6 +14,7 @@ cdef class Chunk:
readonly
bint
writable
object
write_lock
cpdef
object
iterate_range
(
self
,
unsigned
long
starting_entry
,
unsigned
long
stopping_entry
)
cpdef
void
close
(
self
)
cpdef
tuple
get_piece_at
(
self
,
unsigned
int
index
)
cpdef
int
put
(
self
,
unsigned
long
long
timestamp
,
bytes
data
)
except
-
1
...
...
This diff is collapsed.
Click to expand it.
tempsdb/chunks.pyx
+
18
−
0
View file @
e3ad397d
...
...
@@ -85,6 +85,24 @@ cdef class Chunk:
self
.
max_ts
=
timestamp
return
0
cpdef
object
iterate_range
(
self
,
unsigned
long
starting_entry
,
unsigned
long
stopping_entry
):
"""
Return a partial iterator starting at starting_entry and ending at stopping_entry (exclusive)
:param starting_entry: number of starting entry
:type starting_entry: int
:param stopping_entry: number of stopping entry
:type stopping_entry:
:return: an iterator
:rtype: tp.Iterator[tp.Tuple[int, bytes]]
"""
return
self
.
_iterate
(
starting_entry
,
stopping_entry
)
def
_iterate
(
self
,
starting_entry
:
int
,
stopping_entry
:
int
):
cdef
int
i
for
i
in
range
(
starting_entry
,
stopping_entry
):
yield
self
.
get_piece_at
(
i
)
def
__iter__
(
self
)
->
tp
.
Iterator
[
tp
.
Tuple
[
int
,
bytes
]]:
cdef
unsigned
long
i
=
0
for
i
in
range
(
self
.
entries
):
...
...
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