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
9d759502
Commit
9d759502
authored
May 01, 2017
by
arthurprs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add bytes_per_sync and wal_bytes_per_sync
parent
ee4c6ebb
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
0 deletions
+36
-0
c.cc
librocksdb_sys/crocksdb/c.cc
+8
-0
c.h
librocksdb_sys/crocksdb/rocksdb/c.h
+4
-0
lib.rs
librocksdb_sys/src/lib.rs
+2
-0
rocksdb_options.rs
src/rocksdb_options.rs
+12
-0
test_rocksdb_options.rs
tests/test_rocksdb_options.rs
+10
-0
No files found.
librocksdb_sys/crocksdb/c.cc
View file @
9d759502
...
...
@@ -1497,6 +1497,14 @@ void crocksdb_options_set_max_subcompactions(crocksdb_options_t *opt, size_t v)
opt
->
rep
.
max_subcompactions
=
v
;
}
void
crocksdb_options_set_wal_bytes_per_sync
(
crocksdb_options_t
*
opt
,
uint64_t
v
)
{
opt
->
rep
.
wal_bytes_per_sync
=
v
;
}
void
crocksdb_options_set_bytes_per_sync
(
crocksdb_options_t
*
opt
,
uint64_t
v
)
{
opt
->
rep
.
bytes_per_sync
=
v
;
}
size_t
crocksdb_options_get_block_cache_usage
(
crocksdb_options_t
*
opt
)
{
if
(
opt
&&
opt
->
rep
.
table_factory
!=
nullptr
)
{
void
*
table_opt
=
opt
->
rep
.
table_factory
->
GetOptions
();
...
...
librocksdb_sys/crocksdb/rocksdb/c.h
View file @
9d759502
...
...
@@ -783,6 +783,10 @@ extern C_ROCKSDB_LIBRARY_API void crocksdb_options_set_compaction_readahead_size
crocksdb_options_t
*
,
size_t
);
extern
C_ROCKSDB_LIBRARY_API
void
crocksdb_options_set_max_subcompactions
(
crocksdb_options_t
*
,
size_t
);
extern
C_ROCKSDB_LIBRARY_API
void
crocksdb_options_set_wal_bytes_per_sync
(
crocksdb_options_t
*
,
uint64_t
);
extern
C_ROCKSDB_LIBRARY_API
void
crocksdb_options_set_bytes_per_sync
(
crocksdb_options_t
*
,
uint64_t
);
enum
{
crocksdb_tolerate_corrupted_tail_records_recovery
=
0
,
...
...
librocksdb_sys/src/lib.rs
View file @
9d759502
...
...
@@ -257,6 +257,8 @@ extern "C" {
pub
fn
crocksdb_options_set_compaction_readahead_size
(
options
:
*
mut
DBOptions
,
v
:
size_t
);
pub
fn
crocksdb_options_set_wal_recovery_mode
(
options
:
*
mut
DBOptions
,
mode
:
DBRecoveryMode
);
pub
fn
crocksdb_options_set_max_subcompactions
(
options
:
*
mut
DBOptions
,
v
:
size_t
);
pub
fn
crocksdb_options_set_wal_bytes_per_sync
(
options
:
*
mut
DBOptions
,
v
:
u64
);
pub
fn
crocksdb_options_set_bytes_per_sync
(
options
:
*
mut
DBOptions
,
v
:
u64
);
pub
fn
crocksdb_options_enable_statistics
(
options
:
*
mut
DBOptions
);
pub
fn
crocksdb_options_statistics_get_string
(
options
:
*
mut
DBOptions
)
->
*
const
c_char
;
pub
fn
crocksdb_options_statistics_get_ticker_count
(
options
:
*
mut
DBOptions
,
...
...
src/rocksdb_options.rs
View file @
9d759502
...
...
@@ -554,6 +554,18 @@ impl Options {
}
}
pub
fn
set_wal_bytes_per_sync
(
&
mut
self
,
n
:
u64
)
{
unsafe
{
crocksdb_ffi
::
crocksdb_options_set_wal_bytes_per_sync
(
self
.inner
,
n
);
}
}
pub
fn
set_bytes_per_sync
(
&
mut
self
,
n
:
u64
)
{
unsafe
{
crocksdb_ffi
::
crocksdb_options_set_bytes_per_sync
(
self
.inner
,
n
);
}
}
pub
fn
set_disable_auto_compactions
(
&
mut
self
,
disable
:
bool
)
{
unsafe
{
if
disable
{
...
...
tests/test_rocksdb_options.rs
View file @
9d759502
...
...
@@ -212,6 +212,16 @@ fn test_set_max_subcompactions() {
DB
::
open
(
opts
,
path
.path
()
.to_str
()
.unwrap
())
.unwrap
();
}
#[test]
fn
test_set_bytes_per_sync
()
{
let
path
=
TempDir
::
new
(
"_rust_rocksdb_bytes_per_sync"
)
.expect
(
""
);
let
mut
opts
=
Options
::
new
();
opts
.create_if_missing
(
true
);
opts
.set_bytes_per_sync
(
1024
*
1024
);
opts
.set_wal_bytes_per_sync
(
1024
*
1024
);
DB
::
open
(
opts
,
path
.path
()
.to_str
()
.unwrap
())
.unwrap
();
}
#[test]
fn
test_set_optimize_filters_for_hits
()
{
let
path
=
TempDir
::
new
(
"_rust_rocksdb_optimize_filters_for_hits"
)
.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