Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
R
rust-rocksdb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangzongwu
rust-rocksdb
Commits
30463dab
Commit
30463dab
authored
Sep 12, 2016
by
zhangjinpeng1987
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
address comments
parent
02604f2f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
main.rs
src/main.rs
+1
-1
rocksdb.rs
src/rocksdb.rs
+4
-4
No files found.
src/main.rs
View file @
30463dab
...
@@ -205,7 +205,7 @@ mod tests {
...
@@ -205,7 +205,7 @@ mod tests {
db
.put_opt
(
b
"k2-0"
,
b
"c"
,
&
writeopts
)
.unwrap
();
db
.put_opt
(
b
"k2-0"
,
b
"c"
,
&
writeopts
)
.unwrap
();
let
mut
readopts
=
ReadOptions
::
new
();
let
mut
readopts
=
ReadOptions
::
new
();
readopts
.set_iterate_upper_bound
(
"k2"
);
readopts
.set_iterate_upper_bound
(
b
"k2"
);
let
mut
iter
=
db
.iter_opt
(
readopts
);
let
mut
iter
=
db
.iter_opt
(
readopts
);
iter
.seek
(
SeekKey
::
Start
);
iter
.seek
(
SeekKey
::
Start
);
let
mut
count
=
0
;
let
mut
count
=
0
;
...
...
src/rocksdb.rs
View file @
30463dab
...
@@ -42,7 +42,7 @@ pub struct WriteBatch {
...
@@ -42,7 +42,7 @@ pub struct WriteBatch {
pub
struct
ReadOptions
{
pub
struct
ReadOptions
{
inner
:
rocksdb_ffi
::
DBReadOptions
,
inner
:
rocksdb_ffi
::
DBReadOptions
,
upper_bound
:
String
,
upper_bound
:
Vec
<
u8
>
,
}
}
/// The UnsafeSnap must be destroyed by db, it maybe be leaked
/// The UnsafeSnap must be destroyed by db, it maybe be leaked
...
@@ -1062,7 +1062,7 @@ impl Drop for ReadOptions {
...
@@ -1062,7 +1062,7 @@ impl Drop for ReadOptions {
impl
Default
for
ReadOptions
{
impl
Default
for
ReadOptions
{
fn
default
()
->
ReadOptions
{
fn
default
()
->
ReadOptions
{
unsafe
{
unsafe
{
ReadOptions
{
inner
:
rocksdb_ffi
::
rocksdb_readoptions_create
(),
upper_bound
:
String
::
new
()
}
ReadOptions
{
inner
:
rocksdb_ffi
::
rocksdb_readoptions_create
(),
upper_bound
:
vec!
[]
}
}
}
}
}
}
}
...
@@ -1086,8 +1086,8 @@ impl ReadOptions {
...
@@ -1086,8 +1086,8 @@ impl ReadOptions {
snapshot
.inner
);
snapshot
.inner
);
}
}
pub
fn
set_iterate_upper_bound
(
&
mut
self
,
key
:
&
str
)
{
pub
fn
set_iterate_upper_bound
(
&
mut
self
,
key
:
&
[
u8
]
)
{
self
.upper_bound
=
String
::
from
(
key
);
self
.upper_bound
=
Vec
::
from
(
key
);
unsafe
{
unsafe
{
rocksdb_ffi
::
rocksdb_readoptions_set_iterate_upper_bound
(
self
.inner
,
rocksdb_ffi
::
rocksdb_readoptions_set_iterate_upper_bound
(
self
.inner
,
self
.upper_bound
.as_ptr
(),
self
.upper_bound
.as_ptr
(),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment