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
83165e83
Commit
83165e83
authored
Nov 12, 2019
by
Connor
Committed by
pingcap-github-bot
Nov 12, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add API to set level merge and range merge (#379)
parent
c130c13b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
55 additions
and
10 deletions
+55
-10
c.cc
librocksdb_sys/crocksdb/c.cc
+15
-0
c.h
librocksdb_sys/crocksdb/crocksdb/c.h
+9
-0
titan
librocksdb_sys/libtitan_sys/titan
+1
-1
lib.rs
librocksdb_sys/src/lib.rs
+0
-0
rocksdb.rs
src/rocksdb.rs
+1
-1
table_properties_collector.rs
src/table_properties_collector.rs
+5
-5
table_properties_collector_factory.rs
src/table_properties_collector_factory.rs
+2
-2
titan.rs
src/titan.rs
+18
-0
test_column_family.rs
tests/cases/test_column_family.rs
+1
-1
test_titan.rs
tests/cases/test_titan.rs
+3
-0
No files found.
librocksdb_sys/crocksdb/c.cc
View file @
83165e83
...
...
@@ -5254,6 +5254,21 @@ void ctitandb_options_set_disable_background_gc(ctitandb_options_t* options,
options
->
rep
.
disable_background_gc
=
disable
;
}
void
ctitandb_options_set_level_merge
(
ctitandb_options_t
*
options
,
unsigned
char
enable
)
{
options
->
rep
.
level_merge
=
enable
;
}
void
ctitandb_options_set_range_merge
(
ctitandb_options_t
*
options
,
unsigned
char
enable
)
{
options
->
rep
.
range_merge
=
enable
;
}
void
ctitandb_options_set_max_sorted_runs
(
ctitandb_options_t
*
options
,
int
size
)
{
options
->
rep
.
max_sorted_runs
=
size
;
}
void
ctitandb_options_set_max_gc_batch_size
(
ctitandb_options_t
*
options
,
uint64_t
size
)
{
options
->
rep
.
max_gc_batch_size
=
size
;
...
...
librocksdb_sys/crocksdb/crocksdb/c.h
View file @
83165e83
...
...
@@ -2095,6 +2095,15 @@ extern C_ROCKSDB_LIBRARY_API void ctitandb_encode_blob_index(
extern
C_ROCKSDB_LIBRARY_API
void
ctitandb_options_set_disable_background_gc
(
ctitandb_options_t
*
options
,
unsigned
char
disable
);
extern
C_ROCKSDB_LIBRARY_API
void
ctitandb_options_set_level_merge
(
ctitandb_options_t
*
options
,
unsigned
char
enable
);
extern
C_ROCKSDB_LIBRARY_API
void
ctitandb_options_set_range_merge
(
ctitandb_options_t
*
options
,
unsigned
char
enable
);
extern
C_ROCKSDB_LIBRARY_API
void
ctitandb_options_set_max_sorted_runs
(
ctitandb_options_t
*
options
,
int
size
);
extern
C_ROCKSDB_LIBRARY_API
void
ctitandb_options_set_max_gc_batch_size
(
ctitandb_options_t
*
options
,
uint64_t
size
);
...
...
titan
@
96922d49
Subproject commit
8376c989f018f0edb88183d85981e0a530898eeb
Subproject commit
96922d49054b921b84003a78b73040a4bbac55dc
librocksdb_sys/src/lib.rs
View file @
83165e83
This diff is collapsed.
Click to expand it.
src/rocksdb.rs
View file @
83165e83
...
...
@@ -3196,7 +3196,7 @@ mod test {
let
mut
opts
=
DBOptions
::
new
();
opts
.create_if_missing
(
true
);
let
mut
db
=
DB
::
open
(
opts
,
dbpath
)
.unwrap
();
let
db
=
DB
::
open
(
opts
,
dbpath
)
.unwrap
();
let
cf_handle
=
db
.cf_handle
(
"default"
)
.unwrap
();
let
mp
=
db
.get_map_property_cf
(
cf_handle
,
"rocksdb.cfstats"
);
...
...
src/table_properties_collector.rs
View file @
83165e83
...
...
@@ -12,7 +12,7 @@
// limitations under the License.
use
crocksdb_ffi
::{
self
,
DBEntryType
,
DBTablePropertiesCollector
,
DBUserCollectedProperties
};
use
libc
::{
c_char
,
c_int
,
c_void
,
size_t
,
uint64_t
,
uint8_t
};
use
libc
::{
c_char
,
c_int
,
c_void
,
size_t
};
use
std
::
collections
::
HashMap
;
use
std
::
ffi
::
CString
;
use
std
::
mem
;
...
...
@@ -62,13 +62,13 @@ extern "C" fn destruct(handle: *mut c_void) {
pub
extern
"C"
fn
add
(
handle
:
*
mut
c_void
,
key
:
*
const
u
int8_t
,
key
:
*
const
u
8
,
key_len
:
size_t
,
value
:
*
const
u
int8_t
,
value
:
*
const
u
8
,
value_len
:
size_t
,
entry_type
:
c_int
,
seq
:
u
int64_t
,
file_size
:
u
int64_t
,
seq
:
u
64
,
file_size
:
u
64
,
)
{
unsafe
{
let
handle
=
&
mut
*
(
handle
as
*
mut
TablePropertiesCollectorHandle
);
...
...
src/table_properties_collector_factory.rs
View file @
83165e83
...
...
@@ -12,7 +12,7 @@
// limitations under the License.
use
crocksdb_ffi
::{
self
,
DBTablePropertiesCollector
,
DBTablePropertiesCollectorFactory
};
use
libc
::{
c_char
,
c_void
,
uint32_t
};
use
libc
::{
c_char
,
c_void
};
use
std
::
ffi
::
CString
;
use
table_properties_collector
::{
new_table_properties_collector
,
TablePropertiesCollector
};
...
...
@@ -55,7 +55,7 @@ extern "C" fn destruct(handle: *mut c_void) {
extern
"C"
fn
create_table_properties_collector
(
handle
:
*
mut
c_void
,
cf
:
u
int32_t
,
cf
:
u
32
,
)
->
*
mut
DBTablePropertiesCollector
{
unsafe
{
let
handle
=
&
mut
*
(
handle
as
*
mut
TablePropertiesCollectorFactoryHandle
);
...
...
src/titan.rs
View file @
83165e83
...
...
@@ -64,6 +64,24 @@ impl TitanDBOptions {
}
}
pub
fn
set_level_merge
(
&
mut
self
,
enable
:
bool
)
{
unsafe
{
crocksdb_ffi
::
ctitandb_options_set_level_merge
(
self
.inner
,
enable
);
}
}
pub
fn
set_range_merge
(
&
mut
self
,
enable
:
bool
)
{
unsafe
{
crocksdb_ffi
::
ctitandb_options_set_range_merge
(
self
.inner
,
enable
);
}
}
pub
fn
set_max_sorted_runs
(
&
mut
self
,
size
:
i32
)
{
unsafe
{
crocksdb_ffi
::
ctitandb_options_set_max_sorted_runs
(
self
.inner
,
size
);
}
}
pub
fn
set_max_background_gc
(
&
mut
self
,
size
:
i32
)
{
unsafe
{
crocksdb_ffi
::
ctitandb_options_set_max_background_gc
(
self
.inner
,
size
);
...
...
tests/cases/test_column_family.rs
View file @
83165e83
...
...
@@ -150,7 +150,7 @@ fn test_provided_merge(
#[test]
pub
fn
test_column_family_option_use_doubly_skiplist
()
{
let
mut
cf_opts
=
ColumnFamilyOptions
::
new
();
let
cf_opts
=
ColumnFamilyOptions
::
new
();
let
memtable_name
=
cf_opts
.get_memtable_factory_name
();
assert
!
(
memtable_name
.is_some
());
assert_eq!
(
"SkipListFactory"
,
memtable_name
.unwrap
());
...
...
tests/cases/test_titan.rs
View file @
83165e83
...
...
@@ -111,6 +111,9 @@ fn test_titandb() {
tdb_opts
.set_blob_file_compression
(
DBCompressionType
::
No
);
tdb_opts
.set_disable_background_gc
(
true
);
tdb_opts
.set_purge_obsolete_files_period
(
10
);
tdb_opts
.set_level_merge
(
false
);
tdb_opts
.set_range_merge
(
false
);
tdb_opts
.set_max_sorted_runs
(
20
);
let
mut
opts
=
DBOptions
::
new
();
opts
.create_if_missing
(
true
);
...
...
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