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
9bcfe9a7
Commit
9bcfe9a7
authored
Jul 06, 2017
by
Cholerae Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rocksdb: add bottommost_compression method
Signed-off-by:
Cholerae Hu
<
huyingqian@pingcap.com
>
parent
0a5e010a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
0 deletions
+20
-0
c.cc
librocksdb_sys/crocksdb/c.cc
+4
-0
c.h
librocksdb_sys/crocksdb/rocksdb/c.h
+2
-0
lib.rs
librocksdb_sys/src/lib.rs
+1
-0
rocksdb_options.rs
src/rocksdb_options.rs
+4
-0
test_rocksdb_options.rs
tests/test_rocksdb_options.rs
+9
-0
No files found.
librocksdb_sys/crocksdb/c.cc
View file @
9bcfe9a7
...
...
@@ -3299,4 +3299,8 @@ void crocksdb_get_properties_of_tables_in_range(
}
}
void
crocksdb_set_bottommost_compression
(
crocksdb_options_t
*
opt
,
int
c
)
{
opt
->
rep
.
bottommost_compression
=
static_cast
<
CompressionType
>
(
c
);
}
}
// end extern "C"
librocksdb_sys/crocksdb/rocksdb/c.h
View file @
9bcfe9a7
...
...
@@ -629,6 +629,8 @@ extern C_ROCKSDB_LIBRARY_API size_t crocksdb_options_get_compression_level_numbe
crocksdb_options_t
*
opt
);
extern
C_ROCKSDB_LIBRARY_API
void
crocksdb_options_get_compression_per_level
(
crocksdb_options_t
*
opt
,
int
*
level_values
);
extern
C_ROCKSDB_LIBRARY_API
void
crocksdb_set_bottommost_compression
(
crocksdb_options_t
*
opt
,
int
c
);
extern
C_ROCKSDB_LIBRARY_API
void
crocksdb_options_set_create_if_missing
(
crocksdb_options_t
*
,
unsigned
char
);
extern
C_ROCKSDB_LIBRARY_API
void
...
...
librocksdb_sys/src/lib.rs
View file @
9bcfe9a7
...
...
@@ -320,6 +320,7 @@ extern "C" {
pub
fn
crocksdb_options_get_compression_level_number
(
options
:
*
mut
DBOptions
)
->
size_t
;
pub
fn
crocksdb_options_get_compression_per_level
(
options
:
*
mut
DBOptions
,
level_values
:
*
mut
DBCompressionType
);
pub
fn
crocksdb_set_bottommost_compression
(
options
:
*
mut
DBOptions
,
c
:
DBCompressionType
);
pub
fn
crocksdb_options_set_base_background_compactions
(
optinos
:
*
mut
DBOptions
,
base_bg_compactions
:
c_int
);
pub
fn
crocksdb_options_set_max_background_compactions
(
options
:
*
mut
DBOptions
,
...
...
src/rocksdb_options.rs
View file @
9bcfe9a7
...
...
@@ -439,6 +439,10 @@ impl Options {
}
}
pub
fn
bottommost_compression
(
&
self
,
c
:
DBCompressionType
)
{
unsafe
{
crocksdb_ffi
::
crocksdb_set_bottommost_compression
(
self
.inner
,
c
)
}
}
pub
fn
add_merge_operator
(
&
mut
self
,
name
:
&
str
,
merge_fn
:
MergeFn
)
{
let
cb
=
Box
::
new
(
MergeOperatorCallback
{
name
:
CString
::
new
(
name
.as_bytes
())
.unwrap
(),
...
...
tests/test_rocksdb_options.rs
View file @
9bcfe9a7
...
...
@@ -377,6 +377,15 @@ fn test_get_compression_per_level() {
assert_eq!
(
v2
.len
(),
0
);
}
#[test]
fn
test_bottommost_compression
()
{
let
path
=
TempDir
::
new
(
"_rust_rocksdb_bottommost_compression"
)
.expect
(
""
);
let
mut
opts
=
Options
::
new
();
opts
.create_if_missing
(
true
);
opts
.bottommost_compression
(
DBCompressionType
::
DBNo
);
DB
::
open
(
opts
,
path
.path
()
.to_str
()
.unwrap
())
.unwrap
();
}
#[test]
fn
test_clone_options
()
{
let
mut
opts
=
Options
::
new
();
...
...
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