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
92eef015
Commit
92eef015
authored
May 31, 2016
by
Jay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow setting iterate option (#16)
parent
5b805d74
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
7 deletions
+15
-7
lib.rs
src/lib.rs
+1
-1
rocksdb.rs
src/rocksdb.rs
+14
-6
No files found.
src/lib.rs
View file @
92eef015
...
@@ -27,6 +27,6 @@ pub mod comparator;
...
@@ -27,6 +27,6 @@ pub mod comparator;
pub
use
librocksdb_sys
::{
DBCompactionStyle
,
DBComparator
,
DBCompressionType
,
pub
use
librocksdb_sys
::{
DBCompactionStyle
,
DBComparator
,
DBCompressionType
,
new_bloom_filter
,
self
as
rocksdb_ffi
};
new_bloom_filter
,
self
as
rocksdb_ffi
};
pub
use
rocksdb
::{
DB
,
DBIterator
,
DBVector
,
Kv
,
SeekKey
,
Writable
,
WriteBatch
};
pub
use
rocksdb
::{
DB
,
DBIterator
,
DBVector
,
Kv
,
SeekKey
,
Writable
,
WriteBatch
,
ReadOptions
};
pub
use
rocksdb_options
::{
BlockBasedOptions
,
Options
,
WriteOptions
};
pub
use
rocksdb_options
::{
BlockBasedOptions
,
Options
,
WriteOptions
};
pub
use
merge_operator
::
MergeOperands
;
pub
use
merge_operator
::
MergeOperands
;
src/rocksdb.rs
View file @
92eef015
...
@@ -204,9 +204,13 @@ impl<'a> Snapshot<'a> {
...
@@ -204,9 +204,13 @@ impl<'a> Snapshot<'a> {
}
}
pub
fn
iter
(
&
self
)
->
DBIterator
{
pub
fn
iter
(
&
self
)
->
DBIterator
{
let
mut
readopts
=
ReadOptions
::
new
();
let
readopts
=
ReadOptions
::
new
();
readopts
.set_snapshot
(
self
);
self
.iter_opt
(
readopts
)
DBIterator
::
new
(
self
.db
,
&
readopts
)
}
pub
fn
iter_opt
(
&
self
,
mut
opt
:
ReadOptions
)
->
DBIterator
{
opt
.set_snapshot
(
self
);
DBIterator
::
new
(
self
.db
,
&
opt
)
}
}
pub
fn
get
(
&
self
,
key
:
&
[
u8
])
->
Result
<
Option
<
DBVector
>
,
String
>
{
pub
fn
get
(
&
self
,
key
:
&
[
u8
])
->
Result
<
Option
<
DBVector
>
,
String
>
{
...
@@ -583,7 +587,11 @@ impl DB {
...
@@ -583,7 +587,11 @@ impl DB {
pub
fn
iter
(
&
self
)
->
DBIterator
{
pub
fn
iter
(
&
self
)
->
DBIterator
{
let
opts
=
ReadOptions
::
new
();
let
opts
=
ReadOptions
::
new
();
DBIterator
::
new
(
&
self
,
&
opts
)
self
.iter_opt
(
&
opts
)
}
pub
fn
iter_opt
(
&
self
,
opt
:
&
ReadOptions
)
->
DBIterator
{
DBIterator
::
new
(
&
self
,
opt
)
}
}
pub
fn
iter_cf
(
&
self
,
pub
fn
iter_cf
(
&
self
,
...
@@ -971,14 +979,14 @@ impl Default for ReadOptions {
...
@@ -971,14 +979,14 @@ impl Default for ReadOptions {
}
}
impl
ReadOptions
{
impl
ReadOptions
{
fn
new
()
->
ReadOptions
{
pub
fn
new
()
->
ReadOptions
{
ReadOptions
::
default
()
ReadOptions
::
default
()
}
}
// TODO add snapshot setting here
// TODO add snapshot setting here
// TODO add snapshot wrapper structs with proper destructors;
// TODO add snapshot wrapper structs with proper destructors;
// that struct needs an "iterator" impl too.
// that struct needs an "iterator" impl too.
#[allow(dead_code)]
#[allow(dead_code)]
fn
fill_cache
(
&
mut
self
,
v
:
bool
)
{
pub
fn
fill_cache
(
&
mut
self
,
v
:
bool
)
{
unsafe
{
unsafe
{
rocksdb_ffi
::
rocksdb_readoptions_set_fill_cache
(
self
.inner
,
v
);
rocksdb_ffi
::
rocksdb_readoptions_set_fill_cache
(
self
.inner
,
v
);
}
}
...
...
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