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
461bd90d
Commit
461bd90d
authored
Jul 01, 2017
by
Cholerae Hu
Committed by
zhangjinpeng1987
Jul 01, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
api: add set_delayed_write_rate method (#80)
parent
5060d530
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
0 deletions
+24
-0
c.cc
librocksdb_sys/crocksdb/c.cc
+4
-0
c.h
librocksdb_sys/crocksdb/rocksdb/c.h
+3
-0
lib.rs
librocksdb_sys/src/lib.rs
+1
-0
rocksdb_options.rs
src/rocksdb_options.rs
+6
-0
test_rocksdb_options.rs
tests/test_rocksdb_options.rs
+10
-0
No files found.
librocksdb_sys/crocksdb/c.cc
View file @
461bd90d
...
...
@@ -2096,6 +2096,10 @@ void crocksdb_options_set_compaction_priority(crocksdb_options_t *opt,
opt
->
rep
.
compaction_pri
=
static_cast
<
rocksdb
::
CompactionPri
>
(
priority
);
}
void
crocksdb_options_set_delayed_write_rate
(
crocksdb_options_t
*
opt
,
uint64_t
delayed_write_rate
)
{
opt
->
rep
.
delayed_write_rate
=
delayed_write_rate
;
}
char
*
crocksdb_options_statistics_get_string
(
crocksdb_options_t
*
opt
)
{
rocksdb
::
Statistics
*
statistics
=
opt
->
rep
.
statistics
.
get
();
if
(
statistics
)
{
...
...
librocksdb_sys/crocksdb/rocksdb/c.h
View file @
461bd90d
...
...
@@ -843,6 +843,9 @@ enum {
extern
C_ROCKSDB_LIBRARY_API
void
crocksdb_options_set_compaction_priority
(
crocksdb_options_t
*
,
unsigned
char
);
extern
C_ROCKSDB_LIBRARY_API
void
crocksdb_options_set_delayed_write_rate
(
crocksdb_options_t
*
,
uint64_t
);
/* RateLimiter */
extern
C_ROCKSDB_LIBRARY_API
crocksdb_ratelimiter_t
*
crocksdb_ratelimiter_create
(
int64_t
rate_bytes_per_sec
,
int64_t
refill_period_us
,
int32_t
fairness
);
...
...
librocksdb_sys/src/lib.rs
View file @
461bd90d
...
...
@@ -324,6 +324,7 @@ extern "C" {
prefix_extractor
:
*
mut
DBSliceTransform
);
pub
fn
crocksdb_options_set_memtable_prefix_bloom_size_ratio
(
options
:
*
mut
DBOptions
,
ratio
:
c_double
);
pub
fn
crocksdb_options_set_delayed_write_rate
(
options
:
*
mut
DBOptions
,
rate
:
u64
);
pub
fn
crocksdb_options_set_ratelimiter
(
options
:
*
mut
DBOptions
,
limiter
:
*
mut
DBRateLimiter
);
pub
fn
crocksdb_options_set_info_log
(
options
:
*
mut
DBOptions
,
logger
:
*
mut
DBLogger
);
pub
fn
crocksdb_options_get_block_cache_usage
(
options
:
*
const
DBOptions
)
->
usize
;
...
...
src/rocksdb_options.rs
View file @
461bd90d
...
...
@@ -652,6 +652,12 @@ impl Options {
}
}
pub
fn
set_delayed_write_rate
(
&
mut
self
,
rate
:
u64
)
{
unsafe
{
crocksdb_ffi
::
crocksdb_options_set_delayed_write_rate
(
self
.inner
,
rate
);
}
}
pub
fn
enable_statistics
(
&
mut
self
)
{
unsafe
{
crocksdb_ffi
::
crocksdb_options_enable_statistics
(
self
.inner
);
...
...
tests/test_rocksdb_options.rs
View file @
461bd90d
...
...
@@ -114,6 +114,16 @@ fn test_memtable_insert_hint_prefix_extractor() {
assert_eq!
(
db
.get
(
b
"k0-3"
)
.unwrap
()
.unwrap
(),
b
"c"
);
}
#[test]
fn
test_set_delayed_write_rate
()
{
let
path
=
TempDir
::
new
(
"_rust_rocksdb_test_set_delayed_write_rate"
)
.expect
(
""
);
let
mut
opts
=
Options
::
new
();
opts
.create_if_missing
(
true
);
opts
.set_delayed_write_rate
(
2
*
1024
*
1024
);
let
db
=
DB
::
open
(
opts
,
path
.path
()
.to_str
()
.unwrap
())
.unwrap
();
drop
(
db
);
}
#[test]
fn
test_set_ratelimiter
()
{
let
path
=
TempDir
::
new
(
"_rust_rocksdb_test_set_rate_limiter"
)
.expect
(
""
);
...
...
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