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
e951a51d
Commit
e951a51d
authored
Jul 28, 2016
by
zhangjinpeng1987
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rocksdb use shared_ptr hold filter_policy, so we don't need call rocksdb_filterpolicy_destroy
parent
c712a98e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
16 deletions
+2
-16
lib.rs
librocksdb_sys/src/lib.rs
+0
-1
rocksdb_options.rs
src/rocksdb_options.rs
+2
-15
No files found.
librocksdb_sys/src/lib.rs
View file @
e951a51d
...
@@ -200,7 +200,6 @@ extern "C" {
...
@@ -200,7 +200,6 @@ extern "C" {
pub
fn
rocksdb_options_set_disable_auto_compactions
(
options
:
DBOptions
,
pub
fn
rocksdb_options_set_disable_auto_compactions
(
options
:
DBOptions
,
v
:
c_int
);
v
:
c_int
);
pub
fn
rocksdb_options_set_report_bg_io_stats
(
options
:
DBOptions
,
v
:
c_int
);
pub
fn
rocksdb_options_set_report_bg_io_stats
(
options
:
DBOptions
,
v
:
c_int
);
pub
fn
rocksdb_filterpolicy_destroy
(
filter_policy
:
DBFilterPolicy
);
pub
fn
rocksdb_filterpolicy_create_bloom_full
(
bits_per_key
:
c_int
)
pub
fn
rocksdb_filterpolicy_create_bloom_full
(
bits_per_key
:
c_int
)
->
DBFilterPolicy
;
->
DBFilterPolicy
;
pub
fn
rocksdb_filterpolicy_create_bloom
(
bits_per_key
:
c_int
)
pub
fn
rocksdb_filterpolicy_create_bloom
(
bits_per_key
:
c_int
)
...
...
src/rocksdb_options.rs
View file @
e951a51d
...
@@ -28,10 +28,6 @@ pub struct FilterPolicy {
...
@@ -28,10 +28,6 @@ pub struct FilterPolicy {
pub
struct
BlockBasedOptions
{
pub
struct
BlockBasedOptions
{
inner
:
rocksdb_ffi
::
DBBlockBasedTableOptions
,
inner
:
rocksdb_ffi
::
DBBlockBasedTableOptions
,
// FilterPolicy must live as long as BlockBasedTableOptions,
// so we introduce this field
filter_policy
:
Option
<
FilterPolicy
>
,
}
}
pub
struct
Options
{
pub
struct
Options
{
...
@@ -50,14 +46,6 @@ impl Drop for Options {
...
@@ -50,14 +46,6 @@ impl Drop for Options {
}
}
}
}
impl
Drop
for
FilterPolicy
{
fn
drop
(
&
mut
self
)
{
unsafe
{
rocksdb_ffi
::
rocksdb_filterpolicy_destroy
(
self
.inner
);
}
}
}
impl
Drop
for
BlockBasedOptions
{
impl
Drop
for
BlockBasedOptions
{
fn
drop
(
&
mut
self
)
{
fn
drop
(
&
mut
self
)
{
unsafe
{
unsafe
{
...
@@ -82,7 +70,7 @@ impl Default for BlockBasedOptions {
...
@@ -82,7 +70,7 @@ impl Default for BlockBasedOptions {
if
opt_ptr
.is_null
()
{
if
opt_ptr
.is_null
()
{
panic!
(
"Could not create rocksdb block based options"
.to_string
());
panic!
(
"Could not create rocksdb block based options"
.to_string
());
}
}
BlockBasedOptions
{
inner
:
block_opts
,
filter_policy
:
None
}
BlockBasedOptions
{
inner
:
block_opts
}
}
}
}
}
...
@@ -120,10 +108,9 @@ impl BlockBasedOptions {
...
@@ -120,10 +108,9 @@ impl BlockBasedOptions {
}
}
pub
fn
set_filter_policy
(
&
mut
self
,
filter
:
FilterPolicy
)
{
pub
fn
set_filter_policy
(
&
mut
self
,
filter
:
FilterPolicy
)
{
self
.filter_policy
=
Some
(
filter
);
unsafe
{
unsafe
{
rocksdb_ffi
::
rocksdb_block_based_options_set_filter_policy
(
self
.inner
,
rocksdb_ffi
::
rocksdb_block_based_options_set_filter_policy
(
self
.inner
,
self
.filter_policy
.as_ref
()
.unwrap
()
.inner
);
filter
.inner
);
}
}
}
}
...
...
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