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
4fbd3dc1
Unverified
Commit
4fbd3dc1
authored
Nov 06, 2020
by
Xintao
Committed by
GitHub
Nov 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add api to set compression option for bottommost level (#559)
Signed-off-by:
Xintao
<
hunterlxt@live.com
>
parent
ee59a00c
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
94 additions
and
20 deletions
+94
-20
aarch64-unknown-linux-gnu-bindings.rs
...ocksdb_sys/bindings/aarch64-unknown-linux-gnu-bindings.rs
+6
-4
x86_64-unknown-linux-gnu-bindings.rs
librocksdb_sys/bindings/x86_64-unknown-linux-gnu-bindings.rs
+41
-14
c.cc
librocksdb_sys/crocksdb/c.cc
+12
-0
c.h
librocksdb_sys/crocksdb/crocksdb/c.h
+3
-0
lib.rs
librocksdb_sys/src/lib.rs
+8
-0
rocksdb.rs
src/rocksdb.rs
+4
-2
rocksdb_options.rs
src/rocksdb_options.rs
+20
-0
No files found.
librocksdb_sys/bindings/aarch64-unknown-linux-gnu-bindings.rs
View file @
4fbd3dc1
...
...
@@ -2070,8 +2070,9 @@ extern "C" {
);
}
extern
"C"
{
pub
fn
crocksdb_options_get_max_background_compactions
(
arg1
:
*
const
crocksdb_options_t
)
->
libc
::
c_int
;
pub
fn
crocksdb_options_get_max_background_compactions
(
arg1
:
*
const
crocksdb_options_t
,
)
->
libc
::
c_int
;
}
extern
"C"
{
pub
fn
crocksdb_options_set_max_background_flushes
(
...
...
@@ -2080,8 +2081,9 @@ extern "C" {
);
}
extern
"C"
{
pub
fn
crocksdb_options_get_max_background_flushes
(
arg1
:
*
const
crocksdb_options_t
)
->
libc
::
c_int
;
pub
fn
crocksdb_options_get_max_background_flushes
(
arg1
:
*
const
crocksdb_options_t
,
)
->
libc
::
c_int
;
}
extern
"C"
{
pub
fn
crocksdb_options_set_max_log_file_size
(
arg1
:
*
mut
crocksdb_options_t
,
arg2
:
usize
);
...
...
librocksdb_sys/bindings/x86_64-unknown-linux-gnu-bindings.rs
View file @
4fbd3dc1
...
...
@@ -4,6 +4,7 @@ pub const __GNUC_VA_LIST: u32 = 1;
pub
const
_STDINT_H
:
u32
=
1
;
pub
const
_FEATURES_H
:
u32
=
1
;
pub
const
_DEFAULT_SOURCE
:
u32
=
1
;
pub
const
__GLIBC_USE_ISOC2X
:
u32
=
0
;
pub
const
__USE_ISOC11
:
u32
=
1
;
pub
const
__USE_ISOC99
:
u32
=
1
;
pub
const
__USE_ISOC95
:
u32
=
1
;
...
...
@@ -21,30 +22,36 @@ pub const __USE_MISC: u32 = 1;
pub
const
__USE_ATFILE
:
u32
=
1
;
pub
const
__USE_FORTIFY_LEVEL
:
u32
=
0
;
pub
const
__GLIBC_USE_DEPRECATED_GETS
:
u32
=
0
;
pub
const
__GLIBC_USE_DEPRECATED_SCANF
:
u32
=
0
;
pub
const
_STDC_PREDEF_H
:
u32
=
1
;
pub
const
__STDC_IEC_559__
:
u32
=
1
;
pub
const
__STDC_IEC_559_COMPLEX__
:
u32
=
1
;
pub
const
__STDC_ISO_10646__
:
u32
=
201706
;
pub
const
__STDC_NO_THREADS__
:
u32
=
1
;
pub
const
__GNU_LIBRARY__
:
u32
=
6
;
pub
const
__GLIBC__
:
u32
=
2
;
pub
const
__GLIBC_MINOR__
:
u32
=
27
;
pub
const
__GLIBC_MINOR__
:
u32
=
31
;
pub
const
_SYS_CDEFS_H
:
u32
=
1
;
pub
const
__glibc_c99_flexarr_available
:
u32
=
1
;
pub
const
__WORDSIZE
:
u32
=
64
;
pub
const
__WORDSIZE_TIME64_COMPAT32
:
u32
=
1
;
pub
const
__SYSCALL_WORDSIZE
:
u32
=
64
;
pub
const
__LONG_DOUBLE_USES_FLOAT128
:
u32
=
0
;
pub
const
__HAVE_GENERIC_SELECTION
:
u32
=
1
;
pub
const
__GLIBC_USE_LIB_EXT2
:
u32
=
0
;
pub
const
__GLIBC_USE_IEC_60559_BFP_EXT
:
u32
=
0
;
pub
const
__GLIBC_USE_IEC_60559_BFP_EXT_C2X
:
u32
=
0
;
pub
const
__GLIBC_USE_IEC_60559_FUNCS_EXT
:
u32
=
0
;
pub
const
__GLIBC_USE_IEC_60559_FUNCS_EXT_C2X
:
u32
=
0
;
pub
const
__GLIBC_USE_IEC_60559_TYPES_EXT
:
u32
=
0
;
pub
const
_BITS_TYPES_H
:
u32
=
1
;
pub
const
__TIMESIZE
:
u32
=
64
;
pub
const
_BITS_TYPESIZES_H
:
u32
=
1
;
pub
const
__OFF_T_MATCHES_OFF64_T
:
u32
=
1
;
pub
const
__INO_T_MATCHES_INO64_T
:
u32
=
1
;
pub
const
__RLIM_T_MATCHES_RLIM64_T
:
u32
=
1
;
pub
const
__STATFS_MATCHES_STATFS64
:
u32
=
1
;
pub
const
__FD_SETSIZE
:
u32
=
1024
;
pub
const
_BITS_TIME64_H
:
u32
=
1
;
pub
const
_BITS_WCHAR_H
:
u32
=
1
;
pub
const
_BITS_STDINT_INTN_H
:
u32
=
1
;
pub
const
_BITS_STDINT_UINTN_H
:
u32
=
1
;
...
...
@@ -145,6 +152,14 @@ pub type __int32_t = libc::c_int;
pub
type
__uint32_t
=
libc
::
c_uint
;
pub
type
__int64_t
=
libc
::
c_long
;
pub
type
__uint64_t
=
libc
::
c_ulong
;
pub
type
__int_least8_t
=
__int8_t
;
pub
type
__uint_least8_t
=
__uint8_t
;
pub
type
__int_least16_t
=
__int16_t
;
pub
type
__uint_least16_t
=
__uint16_t
;
pub
type
__int_least32_t
=
__int32_t
;
pub
type
__uint_least32_t
=
__uint32_t
;
pub
type
__int_least64_t
=
__int64_t
;
pub
type
__uint_least64_t
=
__uint64_t
;
pub
type
__quad_t
=
libc
::
c_long
;
pub
type
__u_quad_t
=
libc
::
c_ulong
;
pub
type
__intmax_t
=
libc
::
c_long
;
...
...
@@ -214,14 +229,14 @@ pub type __caddr_t = *mut libc::c_char;
pub
type
__intptr_t
=
libc
::
c_long
;
pub
type
__socklen_t
=
libc
::
c_uint
;
pub
type
__sig_atomic_t
=
libc
::
c_int
;
pub
type
int_least8_t
=
libc
::
c_schar
;
pub
type
int_least16_t
=
libc
::
c_shor
t
;
pub
type
int_least32_t
=
libc
::
c_in
t
;
pub
type
int_least64_t
=
libc
::
c_long
;
pub
type
uint_least8_t
=
libc
::
c_uchar
;
pub
type
uint_least16_t
=
libc
::
c_ushor
t
;
pub
type
uint_least32_t
=
libc
::
c_uin
t
;
pub
type
uint_least64_t
=
libc
::
c_ulong
;
pub
type
int_least8_t
=
__int_least8_t
;
pub
type
int_least16_t
=
__int_least16_
t
;
pub
type
int_least32_t
=
__int_least32_
t
;
pub
type
int_least64_t
=
__int_least64_t
;
pub
type
uint_least8_t
=
__uint_least8_t
;
pub
type
uint_least16_t
=
__uint_least16_
t
;
pub
type
uint_least32_t
=
__uint_least32_
t
;
pub
type
uint_least64_t
=
__uint_least64_t
;
pub
type
int_fast8_t
=
libc
::
c_schar
;
pub
type
int_fast16_t
=
libc
::
c_long
;
pub
type
int_fast32_t
=
libc
::
c_long
;
...
...
@@ -2120,6 +2135,16 @@ extern "C" {
extern
"C"
{
pub
fn
crocksdb_options_set_max_total_wal_size
(
opt
:
*
mut
crocksdb_options_t
,
n
:
u64
);
}
extern
"C"
{
pub
fn
crocksdb_options_set_bottommost_compression_options
(
arg1
:
*
mut
crocksdb_options_t
,
arg2
:
libc
::
c_int
,
arg3
:
libc
::
c_int
,
arg4
:
libc
::
c_int
,
arg5
:
libc
::
c_int
,
arg6
:
libc
::
c_int
,
);
}
extern
"C"
{
pub
fn
crocksdb_options_set_compression_options
(
arg1
:
*
mut
crocksdb_options_t
,
...
...
@@ -2333,8 +2358,9 @@ extern "C" {
);
}
extern
"C"
{
pub
fn
crocksdb_options_get_max_background_compactions
(
arg1
:
*
const
crocksdb_options_t
)
->
libc
::
c_int
;
pub
fn
crocksdb_options_get_max_background_compactions
(
arg1
:
*
const
crocksdb_options_t
,
)
->
libc
::
c_int
;
}
extern
"C"
{
pub
fn
crocksdb_options_set_max_background_flushes
(
...
...
@@ -2343,8 +2369,9 @@ extern "C" {
);
}
extern
"C"
{
pub
fn
crocksdb_options_get_max_background_flushes
(
arg1
:
*
const
crocksdb_options_t
)
->
libc
::
c_int
;
pub
fn
crocksdb_options_get_max_background_flushes
(
arg1
:
*
const
crocksdb_options_t
,
)
->
libc
::
c_int
;
}
extern
"C"
{
pub
fn
crocksdb_options_set_max_log_file_size
(
arg1
:
*
mut
crocksdb_options_t
,
arg2
:
usize
);
...
...
librocksdb_sys/crocksdb/c.cc
View file @
4fbd3dc1
...
...
@@ -2619,6 +2619,18 @@ void crocksdb_options_set_compression_options(crocksdb_options_t* opt,
opt
->
rep
.
compression_opts
.
zstd_max_train_bytes
=
zstd_max_train_bytes
;
}
void
crocksdb_options_set_bottommost_compression_options
(
crocksdb_options_t
*
opt
,
int
w_bits
,
int
level
,
int
strategy
,
int
max_dict_bytes
,
int
zstd_max_train_bytes
)
{
opt
->
rep
.
bottommost_compression_opts
.
window_bits
=
w_bits
;
opt
->
rep
.
bottommost_compression_opts
.
level
=
level
;
opt
->
rep
.
bottommost_compression_opts
.
strategy
=
strategy
;
opt
->
rep
.
bottommost_compression_opts
.
max_dict_bytes
=
max_dict_bytes
;
opt
->
rep
.
bottommost_compression_opts
.
zstd_max_train_bytes
=
zstd_max_train_bytes
;
opt
->
rep
.
bottommost_compression_opts
.
enabled
=
true
;
}
void
crocksdb_options_set_use_direct_reads
(
crocksdb_options_t
*
opt
,
unsigned
char
v
)
{
opt
->
rep
.
use_direct_reads
=
v
;
...
...
librocksdb_sys/crocksdb/crocksdb/c.h
View file @
4fbd3dc1
...
...
@@ -966,6 +966,9 @@ extern C_ROCKSDB_LIBRARY_API void crocksdb_options_set_max_open_files(
crocksdb_options_t
*
,
int
);
extern
C_ROCKSDB_LIBRARY_API
void
crocksdb_options_set_max_total_wal_size
(
crocksdb_options_t
*
opt
,
uint64_t
n
);
extern
C_ROCKSDB_LIBRARY_API
void
crocksdb_options_set_bottommost_compression_options
(
crocksdb_options_t
*
,
int
,
int
,
int
,
int
,
int
);
extern
C_ROCKSDB_LIBRARY_API
void
crocksdb_options_set_compression_options
(
crocksdb_options_t
*
,
int
,
int
,
int
,
int
,
int
);
extern
C_ROCKSDB_LIBRARY_API
void
crocksdb_options_set_use_direct_reads
(
...
...
librocksdb_sys/src/lib.rs
View file @
4fbd3dc1
...
...
@@ -698,6 +698,14 @@ extern "C" {
max_dict_bytes
:
c_int
,
zstd_max_train_bytes
:
c_int
,
);
pub
fn
crocksdb_options_set_bottommost_compression_options
(
options
:
*
mut
Options
,
window_bits
:
c_int
,
level
:
c_int
,
strategy
:
c_int
,
max_dict_bytes
:
c_int
,
zstd_max_train_bytes
:
c_int
,
);
pub
fn
crocksdb_options_set_compression_per_level
(
options
:
*
mut
Options
,
level_values
:
*
const
DBCompressionType
,
...
...
src/rocksdb.rs
View file @
4fbd3dc1
...
...
@@ -3362,8 +3362,10 @@ mod test {
let
db_opts
=
db
.get_db_options
();
assert_eq!
(
db_opts
.get_max_background_jobs
(),
8
);
db
.set_db_options
(
&
[(
"max_background_compactions"
,
"6"
)])
.unwrap
();
db
.set_db_options
(
&
[(
"max_background_flushes"
,
"3"
)])
.unwrap
();
db
.set_db_options
(
&
[(
"max_background_compactions"
,
"6"
)])
.unwrap
();
db
.set_db_options
(
&
[(
"max_background_flushes"
,
"3"
)])
.unwrap
();
let
db_opts
=
db
.get_db_options
();
assert_eq!
(
db_opts
.get_max_background_jobs
(),
8
);
assert_eq!
(
db_opts
.get_max_background_compactions
(),
6
);
...
...
src/rocksdb_options.rs
View file @
4fbd3dc1
...
...
@@ -1426,6 +1426,26 @@ impl ColumnFamilyOptions {
}
}
pub
fn
set_bottommost_level_compression_options
(
&
mut
self
,
window_bits
:
i32
,
level
:
i32
,
strategy
:
i32
,
max_dict_bytes
:
i32
,
zstd_max_train_bytes
:
i32
,
)
{
unsafe
{
crocksdb_ffi
::
crocksdb_options_set_bottommost_compression_options
(
self
.inner
,
window_bits
,
level
,
strategy
,
max_dict_bytes
,
zstd_max_train_bytes
,
)
}
}
pub
fn
compression_per_level
(
&
mut
self
,
level_types
:
&
[
DBCompressionType
])
{
unsafe
{
crocksdb_ffi
::
crocksdb_options_set_compression_per_level
(
...
...
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