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
47329cae
Commit
47329cae
authored
Mar 05, 2016
by
Jay Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use global extern crate
parent
3048f8fd
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
22 additions
and
21 deletions
+22
-21
.gitignore
.gitignore
+5
-0
comparator.rs
src/comparator.rs
+1
-2
ffi.rs
src/ffi.rs
+2
-3
lib.rs
src/lib.rs
+9
-6
merge_operator.rs
src/merge_operator.rs
+1
-2
rocksdb.rs
src/rocksdb.rs
+3
-6
rocksdb_options.rs
src/rocksdb_options.rs
+1
-2
No files found.
.gitignore
View file @
47329cae
...
...
@@ -7,3 +7,7 @@ Cargo.lock
_rust_rocksdb*
*rlib
tags
.idea/
out/
*.iml
\ No newline at end of file
src/comparator.rs
View file @
47329cae
...
...
@@ -12,8 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
extern
crate
libc
;
use
self
::
libc
::{
c_char
,
c_int
,
c_void
,
size_t
};
use
libc
::{
c_char
,
c_int
,
c_void
,
size_t
};
use
std
::
ffi
::
CString
;
use
std
::
mem
;
use
std
::
slice
;
...
...
src/ffi.rs
View file @
47329cae
...
...
@@ -12,8 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
extern
crate
libc
;
use
self
::
libc
::{
c_char
,
c_int
,
c_void
,
size_t
};
use
libc
::{
self
,
c_char
,
c_int
,
c_void
,
size_t
};
use
std
::
ffi
::
CStr
;
use
std
::
str
::
from_utf8
;
...
...
@@ -92,7 +91,7 @@ pub fn error_message(ptr: *const i8) -> String {
let
c_str
=
unsafe
{
CStr
::
from_ptr
(
ptr
as
*
const
_
)
};
let
s
=
from_utf8
(
c_str
.to_bytes
())
.unwrap
()
.to_owned
();
unsafe
{
libc
::
free
(
ptr
as
*
mut
libc
::
c_void
);
libc
::
free
(
ptr
as
*
mut
c_void
);
}
s
}
...
...
src/lib.rs
View file @
47329cae
...
...
@@ -12,14 +12,17 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
pub
use
ffi
as
rocksdb_ffi
;
pub
use
ffi
::{
DBCompactionStyle
,
DBComparator
,
new_bloom_filter
};
pub
use
rocksdb
::{
DB
,
DBIterator
,
DBVector
,
Direction
,
IteratorMode
,
Writable
,
WriteBatch
};
pub
use
rocksdb_options
::{
BlockBasedOptions
,
Options
,
WriteOptions
};
pub
use
merge_operator
::
MergeOperands
;
extern
crate
libc
;
pub
mod
rocksdb
;
pub
mod
ffi
;
pub
mod
rocksdb_options
;
pub
mod
merge_operator
;
pub
mod
comparator
;
pub
use
ffi
::{
DBCompactionStyle
,
DBComparator
,
new_bloom_filter
,
self
as
rocksdb_ffi
};
pub
use
rocksdb
::{
DB
,
DBIterator
,
DBVector
,
Direction
,
IteratorMode
,
Writable
,
WriteBatch
};
pub
use
rocksdb_options
::{
BlockBasedOptions
,
Options
,
WriteOptions
};
pub
use
merge_operator
::
MergeOperands
;
src/merge_operator.rs
View file @
47329cae
...
...
@@ -12,8 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
extern
crate
libc
;
use
self
::
libc
::{
c_char
,
c_int
,
c_void
,
size_t
};
use
libc
::{
self
,
c_char
,
c_int
,
c_void
,
size_t
};
use
std
::
ffi
::
CString
;
use
std
::
mem
;
use
std
::
ptr
;
...
...
src/rocksdb.rs
View file @
47329cae
...
...
@@ -12,9 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
extern
crate
libc
;
use
std
::
collections
::
BTreeMap
;
use
std
::
ffi
::
CString
;
use
std
::
fs
;
...
...
@@ -23,7 +20,7 @@ use std::path::Path;
use
std
::
slice
;
use
std
::
str
::
from_utf8
;
use
self
::
libc
::{
c_void
,
size_t
};
use
libc
::{
self
,
c_int
,
c_void
,
size_t
};
use
rocksdb_ffi
::{
self
,
DBCFHandle
,
error_message
};
use
rocksdb_options
::{
Options
,
WriteOptions
};
...
...
@@ -313,7 +310,7 @@ impl DB {
let
nfam
=
cfs_v
.len
();
unsafe
{
db
=
rocksdb_ffi
::
rocksdb_open_column_families
(
opts
.inner
,
cpath_ptr
as
*
const
_
,
nfam
as
libc
::
c_int
,
nfam
as
c_int
,
cfnames
.as_ptr
()
as
*
const
_
,
copts
,
handles
,
err_ptr
);
}
...
...
@@ -848,7 +845,7 @@ impl Deref for DBVector {
impl
Drop
for
DBVector
{
fn
drop
(
&
mut
self
)
{
unsafe
{
libc
::
free
(
self
.base
as
*
mut
libc
::
c_void
);
libc
::
free
(
self
.base
as
*
mut
c_void
);
}
}
}
...
...
src/rocksdb_options.rs
View file @
47329cae
...
...
@@ -12,8 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//
extern
crate
libc
;
use
self
::
libc
::{
c_int
,
size_t
};
use
libc
::{
c_int
,
size_t
};
use
std
::
ffi
::
CString
;
use
std
::
mem
;
...
...
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