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
df6d4950
Commit
df6d4950
authored
Feb 24, 2016
by
Ceri Storey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a DB#put_opt method for use with writeOptions.
parent
c1c067f1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
rocksdb.rs
src/rocksdb.rs
+9
-7
No files found.
src/rocksdb.rs
View file @
df6d4950
...
@@ -28,7 +28,7 @@ use std::str::from_utf8;
...
@@ -28,7 +28,7 @@ use std::str::from_utf8;
use
self
::
libc
::{
c_void
,
size_t
};
use
self
::
libc
::{
c_void
,
size_t
};
use
rocksdb_ffi
::{
self
,
DBCFHandle
,
error_message
};
use
rocksdb_ffi
::{
self
,
DBCFHandle
,
error_message
};
use
rocksdb_options
::
Options
;
use
rocksdb_options
::
{
Options
,
WriteOptions
}
;
pub
struct
DB
{
pub
struct
DB
{
inner
:
rocksdb_ffi
::
DBInstance
,
inner
:
rocksdb_ffi
::
DBInstance
,
...
@@ -522,28 +522,30 @@ impl DB {
...
@@ -522,28 +522,30 @@ impl DB {
pub
fn
snapshot
(
&
self
)
->
Snapshot
{
pub
fn
snapshot
(
&
self
)
->
Snapshot
{
Snapshot
::
new
(
self
)
Snapshot
::
new
(
self
)
}
}
}
impl
Writable
for
DB
{
fn
put_opt
(
&
self
,
key
:
&
[
u8
],
value
:
&
[
u8
],
writeopts
:
&
WriteOptions
)
->
Result
<
(),
String
>
{
fn
put
(
&
self
,
key
:
&
[
u8
],
value
:
&
[
u8
])
->
Result
<
(),
String
>
{
unsafe
{
unsafe
{
let
writeopts
=
rocksdb_ffi
::
rocksdb_writeoptions_create
();
let
mut
err
:
*
const
i8
=
0
as
*
const
i8
;
let
mut
err
:
*
const
i8
=
0
as
*
const
i8
;
let
err_ptr
:
*
mut
*
const
i8
=
&
mut
err
;
let
err_ptr
:
*
mut
*
const
i8
=
&
mut
err
;
rocksdb_ffi
::
rocksdb_put
(
self
.inner
,
rocksdb_ffi
::
rocksdb_put
(
self
.inner
,
writeopts
.
clone
()
,
writeopts
.
inner
,
key
.as_ptr
(),
key
.as_ptr
(),
key
.len
()
as
size_t
,
key
.len
()
as
size_t
,
value
.as_ptr
(),
value
.as_ptr
(),
value
.len
()
as
size_t
,
value
.len
()
as
size_t
,
err_ptr
);
err_ptr
);
rocksdb_ffi
::
rocksdb_writeoptions_destroy
(
writeopts
);
if
!
err
.is_null
()
{
if
!
err
.is_null
()
{
return
Err
(
error_message
(
err
));
return
Err
(
error_message
(
err
));
}
}
Ok
(())
Ok
(())
}
}
}
}
}
impl
Writable
for
DB
{
fn
put
(
&
self
,
key
:
&
[
u8
],
value
:
&
[
u8
])
->
Result
<
(),
String
>
{
self
.put_opt
(
key
,
value
,
&
WriteOptions
::
new
())
}
fn
put_cf
(
&
self
,
fn
put_cf
(
&
self
,
cf
:
DBCFHandle
,
cf
:
DBCFHandle
,
...
...
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