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
d2cc86c3
Commit
d2cc86c3
authored
Apr 29, 2017
by
arthurprs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add support for db.sync_wal()
parent
a3260478
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
0 deletions
+33
-0
c.cc
librocksdb_sys/crocksdb/c.cc
+6
-0
c.h
librocksdb_sys/crocksdb/rocksdb/c.h
+3
-0
lib.rs
librocksdb_sys/src/lib.rs
+2
-0
rocksdb.rs
src/rocksdb.rs
+11
-0
test_rocksdb_options.rs
tests/test_rocksdb_options.rs
+11
-0
No files found.
librocksdb_sys/crocksdb/c.cc
View file @
d2cc86c3
...
...
@@ -1050,6 +1050,12 @@ void crocksdb_flush_cf(
SaveError
(
errptr
,
db
->
rep
->
Flush
(
options
->
rep
,
column_family
->
rep
));
}
void
crocksdb_sync_wal
(
crocksdb_t
*
db
,
char
**
errptr
)
{
SaveError
(
errptr
,
db
->
rep
->
SyncWAL
());
}
void
crocksdb_disable_file_deletions
(
crocksdb_t
*
db
,
char
**
errptr
)
{
...
...
librocksdb_sys/crocksdb/rocksdb/c.h
View file @
d2cc86c3
...
...
@@ -360,6 +360,9 @@ extern C_ROCKSDB_LIBRARY_API void crocksdb_flush_cf(
crocksdb_t
*
db
,
crocksdb_column_family_handle_t
*
column_family
,
const
crocksdb_flushoptions_t
*
options
,
char
**
errptr
);
extern
C_ROCKSDB_LIBRARY_API
void
crocksdb_sync_wal
(
crocksdb_t
*
db
,
char
**
errptr
);
extern
C_ROCKSDB_LIBRARY_API
void
crocksdb_disable_file_deletions
(
crocksdb_t
*
db
,
char
**
errptr
);
...
...
librocksdb_sys/src/lib.rs
View file @
d2cc86c3
...
...
@@ -581,6 +581,8 @@ extern "C" {
cf
:
*
mut
DBCFHandle
,
options
:
*
const
DBFlushOptions
,
err
:
*
mut
*
mut
c_char
);
pub
fn
crocksdb_sync_wal
(
db
:
*
mut
DBInstance
,
err
:
*
mut
*
mut
c_char
);
pub
fn
crocksdb_approximate_sizes
(
db
:
*
mut
DBInstance
,
num_ranges
:
c_int
,
...
...
src/rocksdb.rs
View file @
d2cc86c3
...
...
@@ -744,6 +744,17 @@ impl DB {
}
}
/// Sync the wal. Note that Write() followed by SyncWAL() is not exactly the
/// same as Write() with sync=true: in the latter case the changes won't be
/// visible until the sync is done.
/// Currently only works if allow_mmap_writes = false in Options.
pub
fn
sync_wal
(
&
self
)
->
Result
<
(),
String
>
{
unsafe
{
ffi_try!
(
crocksdb_sync_wal
(
self
.inner
));
Ok
(())
}
}
/// Return the approximate file system space used by keys in each ranges.
///
/// Note that the returned sizes measure file system space usage, so
...
...
tests/test_rocksdb_options.rs
View file @
d2cc86c3
...
...
@@ -135,6 +135,17 @@ fn test_set_wal_opt() {
drop
(
db
);
}
#[test]
fn
test_sync_wal
()
{
let
path
=
TempDir
::
new
(
"_rust_rocksdb_test_sync_wal"
)
.expect
(
""
);
let
mut
opts
=
Options
::
new
();
opts
.create_if_missing
(
true
);
let
db
=
DB
::
open
(
opts
,
path
.path
()
.to_str
()
.unwrap
())
.unwrap
();
db
.put
(
b
"key"
,
b
"value"
);
db
.sync_wal
();
drop
(
db
);
}
#[test]
fn
test_create_info_log
()
{
let
path
=
TempDir
::
new
(
"_rust_rocksdb_test_create_info_log_opt"
)
.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