Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Python Rocksdb
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
Python Rocksdb
Commits
c1a47535
Commit
c1a47535
authored
3 years ago
by
Mandar Harshe
Committed by
Jan Segre
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add iteration bounds to provide start/stop support
parent
ca76ffb0
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
rocksdb/_rocksdb.pyx
+23
-2
23 additions, 2 deletions
rocksdb/_rocksdb.pyx
with
23 additions
and
2 deletions
rocksdb/_rocksdb.pyx
+
23
−
2
View file @
c1a47535
...
@@ -113,6 +113,9 @@ cdef string_to_bytes(string ob):
...
@@ -113,6 +113,9 @@ cdef string_to_bytes(string ob):
cdef
Slice
bytes_to_slice
(
ob
)
except
*
:
cdef
Slice
bytes_to_slice
(
ob
)
except
*
:
return
Slice
(
PyBytes_AsString
(
ob
),
PyBytes_Size
(
ob
))
return
Slice
(
PyBytes_AsString
(
ob
),
PyBytes_Size
(
ob
))
cdef
Slice
*
bytes_to_new_slice
(
ob
)
except
*
:
return
new
Slice
(
PyBytes_AsString
(
ob
),
PyBytes_Size
(
ob
))
cdef
slice_to_bytes
(
Slice
sl
):
cdef
slice_to_bytes
(
Slice
sl
):
return
PyBytes_FromStringAndSize
(
sl
.
data
(),
sl
.
size
())
return
PyBytes_FromStringAndSize
(
sl
.
data
(),
sl
.
size
())
...
@@ -2187,11 +2190,13 @@ cdef class DB(object):
...
@@ -2187,11 +2190,13 @@ cdef class DB(object):
fill_cache
=
True
,
fill_cache
=
True
,
snapshot
=
None
,
snapshot
=
None
,
read_tier
=
"
all
"
,
read_tier
=
"
all
"
,
total_order_seek
=
False
):
total_order_seek
=
False
,
iterate_lower_bound
=
None
,
iterate_upper_bound
=
None
):
# TODO: Is this really effiencet ?
# TODO: Is this really effiencet ?
return
locals
()
return
locals
()
cdef
options
.
ReadOptions
build_read_opts
(
self
,
dict
py_opts
):
cdef
options
.
ReadOptions
build_read_opts
(
self
,
dict
py_opts
):
cdef
options
.
ReadOptions
opts
cdef
options
.
ReadOptions
opts
opts
.
verify_checksums
=
py_opts
[
'
verify_checksums
'
]
opts
.
verify_checksums
=
py_opts
[
'
verify_checksums
'
]
...
@@ -2209,6 +2214,22 @@ cdef class DB(object):
...
@@ -2209,6 +2214,22 @@ cdef class DB(object):
else
:
else
:
raise
ValueError
(
"
Invalid read_tier
"
)
raise
ValueError
(
"
Invalid read_tier
"
)
def
make_bytes
(
iterate_bound
):
if
isinstance
(
iterate_bound
,
bytes
):
return
iterate_bound
elif
isinstance
(
iterate_bound
,
str
):
return
str
.
encode
(
iterate_bound
)
elif
isinstance
(
iterate_bound
,
int
):
return
str
.
encode
(
str
(
iterate_bound
))
else
:
return
None
if
py_opts
[
'
iterate_lower_bound
'
]
is
not
None
:
# Calling this new without corresponding delete causes a memory leak.
# TODO: Figure out where the object should be destroyed without causing segfaults
opts
.
iterate_lower_bound
=
bytes_to_new_slice
(
make_bytes
(
py_opts
[
'
iterate_lower_bound
'
]))
if
py_opts
[
'
iterate_upper_bound
'
]
is
not
None
:
opts
.
iterate_upper_bound
=
bytes_to_new_slice
(
make_bytes
(
py_opts
[
'
iterate_upper_bound
'
]))
return
opts
return
opts
property
options
:
property
options
:
...
...
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