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
9fa33a5f
Commit
9fa33a5f
authored
Sep 20, 2016
by
Jay Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean up test directory
parent
7363e39b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
28 deletions
+28
-28
main.rs
src/main.rs
+0
-27
test_iterator.rs
test/test_iterator.rs
+28
-1
No files found.
src/main.rs
View file @
9fa33a5f
...
...
@@ -194,33 +194,6 @@ mod tests {
DB
::
open
(
&
opts
,
path
)
.unwrap
()
}
#[test]
fn
read_with_upper_bound
()
{
let
path
=
"_rust_rocksdb_read_with_upper_bound_test"
;
let
mut
opts
=
Options
::
new
();
opts
.create_if_missing
(
true
);
{
let
db
=
DB
::
open
(
&
opts
,
path
)
.unwrap
();
let
writeopts
=
WriteOptions
::
new
();
db
.put_opt
(
b
"k1-0"
,
b
"a"
,
&
writeopts
)
.unwrap
();
db
.put_opt
(
b
"k1-1"
,
b
"b"
,
&
writeopts
)
.unwrap
();
db
.put_opt
(
b
"k2-0"
,
b
"c"
,
&
writeopts
)
.unwrap
();
let
mut
readopts
=
ReadOptions
::
new
();
readopts
.set_iterate_upper_bound
(
b
"k2"
);
let
mut
iter
=
db
.iter_opt
(
readopts
);
iter
.seek
(
SeekKey
::
Start
);
let
mut
count
=
0
;
while
iter
.valid
()
{
count
+=
1
;
if
!
iter
.next
()
{
break
;
}
}
assert_eq!
(
count
,
2
);
}
}
// TODO(tyler) unstable
// #[bench]
// fn a_writes(b: &mut Bencher) {
...
...
test/test_iterator.rs
View file @
9fa33a5f
use
rocksdb
::
{
DB
,
Writable
,
SeekKey
,
DBIterator
,
Kv
}
;
use
rocksdb
::
*
;
use
tempdir
::
TempDir
;
fn
prev_collect
<
'a
>
(
iter
:
&
mut
DBIterator
<
'a
>
)
->
Vec
<
Kv
>
{
...
...
@@ -113,3 +113,30 @@ pub fn test_iterator() {
iter
.prev
();
assert
!
(
!
iter
.valid
());
}
#[test]
fn
read_with_upper_bound
()
{
let
path
=
TempDir
::
new
(
"_rust_rocksdb_read_with_upper_bound_test"
)
.expect
(
""
);
let
mut
opts
=
Options
::
new
();
opts
.create_if_missing
(
true
);
{
let
db
=
DB
::
open
(
&
opts
,
path
.path
()
.to_str
()
.unwrap
())
.unwrap
();
let
writeopts
=
WriteOptions
::
new
();
db
.put_opt
(
b
"k1-0"
,
b
"a"
,
&
writeopts
)
.unwrap
();
db
.put_opt
(
b
"k1-1"
,
b
"b"
,
&
writeopts
)
.unwrap
();
db
.put_opt
(
b
"k2-0"
,
b
"c"
,
&
writeopts
)
.unwrap
();
let
mut
readopts
=
ReadOptions
::
new
();
readopts
.set_iterate_upper_bound
(
b
"k2"
);
let
mut
iter
=
db
.iter_opt
(
readopts
);
iter
.seek
(
SeekKey
::
Start
);
let
mut
count
=
0
;
while
iter
.valid
()
{
count
+=
1
;
if
!
iter
.next
()
{
break
;
}
}
assert_eq!
(
count
,
2
);
}
}
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