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
51f27f8e
Commit
51f27f8e
authored
Jan 11, 2015
by
Tyler Neely
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compilation fixes, some cleanup, although much is still needed
parent
1e38a243
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
6 deletions
+12
-6
Cargo.toml
Cargo.toml
+1
-1
ffi.rs
src/ffi.rs
+8
-4
main.rs
src/main.rs
+3
-1
rocksdb.rs
src/rocksdb.rs
+0
-0
No files found.
Cargo.toml
View file @
51f27f8e
...
@@ -2,6 +2,6 @@
...
@@ -2,6 +2,6 @@
name
=
"rocksdb"
name
=
"rocksdb"
description
=
"A rust wrapper for Facebook's RocksDB embeddable database."
description
=
"A rust wrapper for Facebook's RocksDB embeddable database."
version
=
"0.0.
2
"
version
=
"0.0.
3
"
authors
=
[
"Tyler Neely <t@jujit.su>"
]
authors
=
[
"Tyler Neely <t@jujit.su>"
]
license
=
"Apache-2.0"
license
=
"Apache-2.0"
src/ffi.rs
View file @
51f27f8e
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
*/
*/
extern
crate
libc
;
extern
crate
libc
;
use
self
::
libc
::{
c_char
,
c_int
,
c_void
,
size_t
};
use
self
::
libc
::{
c_char
,
c_int
,
c_void
,
size_t
};
use
std
::
ffi
::
CString
;
#[repr(C)]
#[repr(C)]
pub
struct
RocksDBOptions
(
pub
*
const
c_void
);
pub
struct
RocksDBOptions
(
pub
*
const
c_void
);
...
@@ -41,6 +42,9 @@ impl Copy for RocksDBMergeOperator {}
...
@@ -41,6 +42,9 @@ impl Copy for RocksDBMergeOperator {}
impl
Copy
for
RocksDBBlockBasedTableOptions
{}
impl
Copy
for
RocksDBBlockBasedTableOptions
{}
impl
Copy
for
RocksDBCache
{}
impl
Copy
for
RocksDBCache
{}
impl
Copy
for
RocksDBFilterPolicy
{}
impl
Copy
for
RocksDBFilterPolicy
{}
impl
Copy
for
RocksDBCompactionStyle
{}
impl
Copy
for
RocksDBCompressionType
{}
impl
Copy
for
RocksDBUniversalCompactionStyle
{}
pub
fn
new_bloom_filter
(
bits
:
c_int
)
->
RocksDBFilterPolicy
{
pub
fn
new_bloom_filter
(
bits
:
c_int
)
->
RocksDBFilterPolicy
{
unsafe
{
unsafe
{
...
@@ -216,14 +220,14 @@ fn internal() {
...
@@ -216,14 +220,14 @@ fn internal() {
unsafe
{
unsafe
{
let
opts
=
rocksdb_options_create
();
let
opts
=
rocksdb_options_create
();
let
RocksDBOptions
(
opt_ptr
)
=
opts
;
let
RocksDBOptions
(
opt_ptr
)
=
opts
;
assert
!
(
opt_ptr
.is_not
_null
());
assert
!
(
!
opt_ptr
.is
_null
());
rocksdb_options_increase_parallelism
(
opts
,
0
);
rocksdb_options_increase_parallelism
(
opts
,
0
);
rocksdb_options_optimize_level_style_compaction
(
opts
,
0
);
rocksdb_options_optimize_level_style_compaction
(
opts
,
0
);
rocksdb_options_set_create_if_missing
(
opts
,
true
);
rocksdb_options_set_create_if_missing
(
opts
,
true
);
let
rustpath
=
"_rust_rocksdb_internaltest"
;
let
rustpath
=
"_rust_rocksdb_internaltest"
;
let
cpath
=
rustpath
.to_c_str
(
);
let
cpath
=
CString
::
from_slice
(
rustpath
.as_bytes
()
);
let
cpath_ptr
=
cpath
.as_ptr
();
let
cpath_ptr
=
cpath
.as_ptr
();
let
err
=
0
as
*
mut
i8
;
let
err
=
0
as
*
mut
i8
;
...
@@ -232,7 +236,7 @@ fn internal() {
...
@@ -232,7 +236,7 @@ fn internal() {
let
writeopts
=
rocksdb_writeoptions_create
();
let
writeopts
=
rocksdb_writeoptions_create
();
let
RocksDBWriteOptions
(
write_opt_ptr
)
=
writeopts
;
let
RocksDBWriteOptions
(
write_opt_ptr
)
=
writeopts
;
assert
!
(
write_opt_ptr
.is_not
_null
());
assert
!
(
!
write_opt_ptr
.is
_null
());
let
key
=
b
"name
\x00
"
;
let
key
=
b
"name
\x00
"
;
let
val
=
b
"spacejam
\x00
"
;
let
val
=
b
"spacejam
\x00
"
;
...
@@ -242,7 +246,7 @@ fn internal() {
...
@@ -242,7 +246,7 @@ fn internal() {
let
readopts
=
rocksdb_readoptions_create
();
let
readopts
=
rocksdb_readoptions_create
();
let
RocksDBReadOptions
(
read_opts_ptr
)
=
readopts
;
let
RocksDBReadOptions
(
read_opts_ptr
)
=
readopts
;
assert
!
(
read_opts_ptr
.is_not
_null
());
assert
!
(
!
read_opts_ptr
.is
_null
());
let
val_len
:
size_t
=
0
;
let
val_len
:
size_t
=
0
;
let
val_len_ptr
=
&
val_len
as
*
const
size_t
;
let
val_len_ptr
=
&
val_len
as
*
const
size_t
;
...
...
src/main.rs
View file @
51f27f8e
...
@@ -13,6 +13,8 @@
...
@@ -13,6 +13,8 @@
See the License for the specific language governing permissions and
See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
*/
*/
#
!
[
allow
(
unstable
)]
extern
crate
rocksdb
;
extern
crate
rocksdb
;
extern
crate
test
;
extern
crate
test
;
use
rocksdb
::{
RocksDBOptions
,
RocksDB
,
MergeOperands
,
new_bloom_filter
};
use
rocksdb
::{
RocksDBOptions
,
RocksDB
,
MergeOperands
,
new_bloom_filter
};
...
@@ -44,7 +46,7 @@ fn main() {
...
@@ -44,7 +46,7 @@ fn main() {
#[allow(dead_code)]
#[allow(dead_code)]
fn
concat_merge
(
new_key
:
&
[
u8
],
existing_val
:
Option
<&
[
u8
]
>
,
fn
concat_merge
(
new_key
:
&
[
u8
],
existing_val
:
Option
<&
[
u8
]
>
,
mut
operands
:
&
mut
MergeOperands
)
->
Vec
<
u8
>
{
mut
operands
:
&
mut
MergeOperands
)
->
Vec
<
u8
>
{
let
mut
result
:
Vec
<
u8
>
=
Vec
::
with_capacity
(
operands
.size_hint
()
.
val0
()
);
let
mut
result
:
Vec
<
u8
>
=
Vec
::
with_capacity
(
operands
.size_hint
()
.
0
);
match
existing_val
{
match
existing_val
{
Some
(
v
)
=>
result
.push_all
(
v
),
Some
(
v
)
=>
result
.push_all
(
v
),
None
=>
(),
None
=>
(),
...
...
src/rocksdb.rs
View file @
51f27f8e
This diff is collapsed.
Click to expand it.
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