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
d64e54ed
Commit
d64e54ed
authored
Sep 05, 2019
by
Little-Wallace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
filter empty batch
Signed-off-by:
Little-Wallace
<
bupt2013211450@gmail.com
>
parent
25391594
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
4 deletions
+21
-4
rocksdb.rs
src/rocksdb.rs
+21
-4
No files found.
src/rocksdb.rs
View file @
d64e54ed
...
@@ -738,13 +738,30 @@ impl DB {
...
@@ -738,13 +738,30 @@ impl DB {
&
self
.path
&
self
.path
}
}
pub
fn
multi_thread_write
(
&
self
,
batches
:
&
Vec
<
WriteBatch
>
,
writeopts
:
&
WriteOptions
)
->
Result
<
(),
String
>
{
pub
fn
multi_thread_write
(
&
self
,
batches
:
&
Vec
<
WriteBatch
>
,
writeopts
:
&
WriteOptions
,
)
->
Result
<
(),
String
>
{
unsafe
{
unsafe
{
if
batches
.len
()
==
1
{
if
batches
.len
()
==
1
{
ffi_try!
(
crocksdb_write
(
self
.inner
,
writeopts
.inner
,
batches
[
0
]
.inner
));
ffi_try!
(
crocksdb_write
(
self
.inner
,
writeopts
.inner
,
batches
[
0
]
.inner
));
}
else
{
}
else
{
let
b
:
Vec
<*
mut
DBWriteBatch
>
=
batches
.iter
()
.map
(|
w
|
w
.inner
)
.collect
();
let
b
:
Vec
<*
mut
DBWriteBatch
>
=
batches
ffi_try!
(
crocksdb_write_multi_batch
(
self
.inner
,
writeopts
.inner
,
b
.as_ptr
(),
b
.len
()));
.iter
()
.filter
(|
w
|
w
.count
()
>
0
)
.map
(|
w
|
w
.inner
)
.collect
();
ffi_try!
(
crocksdb_write_multi_batch
(
self
.inner
,
writeopts
.inner
,
b
.as_ptr
(),
b
.len
()
));
}
}
}
}
Ok
(())
Ok
(())
...
...
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