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
21516f6f
Commit
21516f6f
authored
Jan 07, 2017
by
siddontang
Committed by
GitHub
Jan 07, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
format code (#74)
parent
65a06684
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
13 deletions
+18
-13
lib.rs
librocksdb_sys/src/lib.rs
+2
-1
compaction_filter.rs
src/compaction_filter.rs
+1
-2
main.rs
src/main.rs
+1
-0
rocksdb.rs
src/rocksdb.rs
+7
-5
rocksdb_options.rs
src/rocksdb_options.rs
+7
-5
No files found.
librocksdb_sys/src/lib.rs
View file @
21516f6f
...
@@ -155,7 +155,8 @@ extern "C" {
...
@@ -155,7 +155,8 @@ extern "C" {
bufno
:
c_int
);
bufno
:
c_int
);
pub
fn
crocksdb_options_set_level0_file_num_compaction_trigger
(
options
:
*
mut
DBOptions
,
pub
fn
crocksdb_options_set_level0_file_num_compaction_trigger
(
options
:
*
mut
DBOptions
,
no
:
c_int
);
no
:
c_int
);
pub
fn
crocksdb_options_set_level0_slowdown_writes_trigger
(
options
:
*
mut
DBOptions
,
no
:
c_int
);
pub
fn
crocksdb_options_set_level0_slowdown_writes_trigger
(
options
:
*
mut
DBOptions
,
no
:
c_int
);
pub
fn
crocksdb_options_set_level0_stop_writes_trigger
(
options
:
*
mut
DBOptions
,
no
:
c_int
);
pub
fn
crocksdb_options_set_level0_stop_writes_trigger
(
options
:
*
mut
DBOptions
,
no
:
c_int
);
pub
fn
crocksdb_options_set_write_buffer_size
(
options
:
*
mut
DBOptions
,
bytes
:
u64
);
pub
fn
crocksdb_options_set_write_buffer_size
(
options
:
*
mut
DBOptions
,
bytes
:
u64
);
pub
fn
crocksdb_options_set_target_file_size_base
(
options
:
*
mut
DBOptions
,
bytes
:
u64
);
pub
fn
crocksdb_options_set_target_file_size_base
(
options
:
*
mut
DBOptions
,
bytes
:
u64
);
...
...
src/compaction_filter.rs
View file @
21516f6f
use
libc
::{
c_void
,
c_char
,
c_int
,
size_t
};
use
crocksdb_ffi
::{
self
,
DBCompactionFilter
};
use
crocksdb_ffi
::{
self
,
DBCompactionFilter
};
use
libc
::{
c_void
,
c_char
,
c_int
,
size_t
};
use
std
::
ffi
::
CString
;
use
std
::
ffi
::
CString
;
use
std
::
slice
;
use
std
::
slice
;
...
...
src/main.rs
View file @
21516f6f
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// See the License for the specific language governing permissions and
// limitations under the License.
// limitations under the License.
//
//
extern
crate
rocksdb
;
extern
crate
rocksdb
;
use
rocksdb
::{
DB
,
MergeOperands
,
Options
,
Writable
};
use
rocksdb
::{
DB
,
MergeOperands
,
Options
,
Writable
};
...
...
src/rocksdb.rs
View file @
21516f6f
...
@@ -13,10 +13,8 @@
...
@@ -13,10 +13,8 @@
// limitations under the License.
// limitations under the License.
//
//
use
libc
::{
self
,
c_int
,
c_void
,
size_t
};
use
crocksdb_ffi
::{
self
,
DBWriteBatch
,
DBCFHandle
,
DBInstance
,
DBBackupEngine
};
use
crocksdb_ffi
::{
self
,
DBWriteBatch
,
DBCFHandle
,
DBInstance
,
DBBackupEngine
};
use
libc
::{
self
,
c_int
,
c_void
,
size_t
};
use
rocksdb_options
::{
Options
,
ReadOptions
,
UnsafeSnap
,
WriteOptions
,
FlushOptions
,
RestoreOptions
};
use
rocksdb_options
::{
Options
,
ReadOptions
,
UnsafeSnap
,
WriteOptions
,
FlushOptions
,
RestoreOptions
};
use
std
::
collections
::
BTreeMap
;
use
std
::
collections
::
BTreeMap
;
use
std
::
collections
::
btree_map
::
Entry
;
use
std
::
collections
::
btree_map
::
Entry
;
...
@@ -115,7 +113,9 @@ impl<'a> DBIterator<'a> {
...
@@ -115,7 +113,9 @@ impl<'a> DBIterator<'a> {
SeekKey
::
Start
=>
crocksdb_ffi
::
crocksdb_iter_seek_to_first
(
self
.inner
),
SeekKey
::
Start
=>
crocksdb_ffi
::
crocksdb_iter_seek_to_first
(
self
.inner
),
SeekKey
::
End
=>
crocksdb_ffi
::
crocksdb_iter_seek_to_last
(
self
.inner
),
SeekKey
::
End
=>
crocksdb_ffi
::
crocksdb_iter_seek_to_last
(
self
.inner
),
SeekKey
::
Key
(
key
)
=>
{
SeekKey
::
Key
(
key
)
=>
{
crocksdb_ffi
::
crocksdb_iter_seek_for_prev
(
self
.inner
,
key
.as_ptr
(),
key
.len
()
as
size_t
)
crocksdb_ffi
::
crocksdb_iter_seek_for_prev
(
self
.inner
,
key
.as_ptr
(),
key
.len
()
as
size_t
)
}
}
}
}
}
}
...
@@ -791,7 +791,9 @@ impl DB {
...
@@ -791,7 +791,9 @@ impl DB {
let
value
=
match
cf
{
let
value
=
match
cf
{
None
=>
crocksdb_ffi
::
crocksdb_property_value
(
self
.inner
,
prop_name
.as_ptr
()),
None
=>
crocksdb_ffi
::
crocksdb_property_value
(
self
.inner
,
prop_name
.as_ptr
()),
Some
(
cf
)
=>
{
Some
(
cf
)
=>
{
crocksdb_ffi
::
crocksdb_property_value_cf
(
self
.inner
,
cf
.inner
,
prop_name
.as_ptr
())
crocksdb_ffi
::
crocksdb_property_value_cf
(
self
.inner
,
cf
.inner
,
prop_name
.as_ptr
())
}
}
};
};
...
...
src/rocksdb_options.rs
View file @
21516f6f
...
@@ -15,13 +15,13 @@
...
@@ -15,13 +15,13 @@
use
compaction_filter
::{
CompactionFilter
,
new_compaction_filter
,
CompactionFilterHandle
};
use
compaction_filter
::{
CompactionFilter
,
new_compaction_filter
,
CompactionFilterHandle
};
use
comparator
::{
self
,
ComparatorCallback
,
compare_callback
};
use
comparator
::{
self
,
ComparatorCallback
,
compare_callback
};
use
libc
::{
self
,
c_int
,
size_t
,
c_void
};
use
merge_operator
::{
self
,
MergeOperatorCallback
,
full_merge_callback
,
partial_merge_callback
};
use
merge_operator
::
MergeFn
;
use
crocksdb_ffi
::{
self
,
DBOptions
,
DBWriteOptions
,
DBBlockBasedTableOptions
,
DBReadOptions
,
use
crocksdb_ffi
::{
self
,
DBOptions
,
DBWriteOptions
,
DBBlockBasedTableOptions
,
DBReadOptions
,
DBRestoreOptions
,
DBCompressionType
,
DBRecoveryMode
,
DBSnapshot
,
DBInstance
,
DBRestoreOptions
,
DBCompressionType
,
DBRecoveryMode
,
DBSnapshot
,
DBInstance
,
DBFlushOptions
};
DBFlushOptions
};
use
libc
::{
self
,
c_int
,
size_t
,
c_void
};
use
merge_operator
::{
self
,
MergeOperatorCallback
,
full_merge_callback
,
partial_merge_callback
};
use
merge_operator
::
MergeFn
;
use
std
::
ffi
::{
CStr
,
CString
};
use
std
::
ffi
::{
CStr
,
CString
};
use
std
::
mem
;
use
std
::
mem
;
...
@@ -312,7 +312,8 @@ impl Options {
...
@@ -312,7 +312,8 @@ impl Options {
});
});
unsafe
{
unsafe
{
let
mo
=
crocksdb_ffi
::
crocksdb_mergeoperator_create
(
mem
::
transmute
(
cb
),
let
mo
=
crocksdb_ffi
::
crocksdb_mergeoperator_create
(
mem
::
transmute
(
cb
),
merge_operator
::
destructor_callback
,
merge_operator
::
destructor_callback
,
full_merge_callback
,
full_merge_callback
,
partial_merge_callback
,
partial_merge_callback
,
...
@@ -432,7 +433,8 @@ impl Options {
...
@@ -432,7 +433,8 @@ impl Options {
pub
fn
set_min_write_buffer_number_to_merge
(
&
mut
self
,
to_merge
:
c_int
)
{
pub
fn
set_min_write_buffer_number_to_merge
(
&
mut
self
,
to_merge
:
c_int
)
{
unsafe
{
unsafe
{
crocksdb_ffi
::
crocksdb_options_set_min_write_buffer_number_to_merge
(
self
.inner
,
to_merge
);
crocksdb_ffi
::
crocksdb_options_set_min_write_buffer_number_to_merge
(
self
.inner
,
to_merge
);
}
}
}
}
...
...
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