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
b8332a75
Commit
b8332a75
authored
Mar 13, 2017
by
Dylan Wen
Committed by
GitHub
Mar 13, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add get options cf method for DB (#25)
parent
3b8597dc
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
46 additions
and
4 deletions
+46
-4
c.cc
librocksdb_sys/crocksdb/c.cc
+14
-0
c.h
librocksdb_sys/crocksdb/rocksdb/c.h
+6
-0
lib.rs
librocksdb_sys/src/lib.rs
+2
-0
rocksdb.rs
src/rocksdb.rs
+12
-2
rocksdb_options.rs
src/rocksdb_options.rs
+9
-0
test_ingest_external_file.rs
tests/test_ingest_external_file.rs
+3
-2
No files found.
librocksdb_sys/crocksdb/c.cc
View file @
b8332a75
...
...
@@ -1053,6 +1053,20 @@ void crocksdb_enable_file_deletions(
SaveError
(
errptr
,
db
->
rep
->
EnableFileDeletions
(
force
));
}
crocksdb_options_t
*
crocksdb_get_options
(
const
crocksdb_t
*
db
)
{
crocksdb_options_t
*
options
=
new
crocksdb_options_t
;
options
->
rep
=
db
->
rep
->
GetOptions
();
return
options
;
}
crocksdb_options_t
*
crocksdb_get_options_cf
(
const
crocksdb_t
*
db
,
crocksdb_column_family_handle_t
*
column_family
)
{
crocksdb_options_t
*
options
=
new
crocksdb_options_t
;
options
->
rep
=
db
->
rep
->
GetOptions
(
column_family
->
rep
);
return
options
;
}
void
crocksdb_destroy_db
(
const
crocksdb_options_t
*
options
,
const
char
*
name
,
...
...
librocksdb_sys/crocksdb/rocksdb/c.h
View file @
b8332a75
...
...
@@ -362,6 +362,12 @@ extern C_ROCKSDB_LIBRARY_API void crocksdb_disable_file_deletions(crocksdb_t* db
extern
C_ROCKSDB_LIBRARY_API
void
crocksdb_enable_file_deletions
(
crocksdb_t
*
db
,
unsigned
char
force
,
char
**
errptr
);
extern
C_ROCKSDB_LIBRARY_API
crocksdb_options_t
*
crocksdb_get_options
(
const
crocksdb_t
*
db
);
extern
C_ROCKSDB_LIBRARY_API
crocksdb_options_t
*
crocksdb_get_options_cf
(
const
crocksdb_t
*
db
,
crocksdb_column_family_handle_t
*
column_family
);
/* Management operations */
extern
C_ROCKSDB_LIBRARY_API
void
crocksdb_destroy_db
(
...
...
librocksdb_sys/src/lib.rs
View file @
b8332a75
...
...
@@ -158,6 +158,8 @@ macro_rules! ffi_try {
// TODO audit the use of boolean arguments, b/c I think they need to be u8
// instead...
extern
"C"
{
pub
fn
crocksdb_get_options
(
db
:
*
mut
DBInstance
)
->
*
mut
DBOptions
;
pub
fn
crocksdb_get_options_cf
(
db
:
*
mut
DBInstance
,
cf
:
*
mut
DBCFHandle
)
->
*
mut
DBOptions
;
pub
fn
crocksdb_options_create
()
->
*
mut
DBOptions
;
pub
fn
crocksdb_options_destroy
(
opts
:
*
mut
DBOptions
);
pub
fn
crocksdb_cache_create_lru
(
capacity
:
size_t
)
->
*
mut
DBCache
;
...
...
src/rocksdb.rs
View file @
b8332a75
...
...
@@ -916,8 +916,18 @@ impl DB {
self
.opts
.get_statistics_histogram
(
hist_type
)
}
pub
fn
get_options
(
&
self
)
->
&
Options
{
&
self
.opts
pub
fn
get_options
(
&
self
)
->
Options
{
unsafe
{
let
inner
=
crocksdb_ffi
::
crocksdb_get_options
(
self
.inner
);
Options
::
new_with
(
inner
)
}
}
pub
fn
get_options_cf
(
&
self
,
cf
:
&
CFHandle
)
->
Options
{
unsafe
{
let
inner
=
crocksdb_ffi
::
crocksdb_get_options_cf
(
self
.inner
,
cf
.inner
);
Options
::
new_with
(
inner
)
}
}
pub
fn
ingest_external_file
(
&
self
,
...
...
src/rocksdb_options.rs
View file @
b8332a75
...
...
@@ -285,6 +285,15 @@ impl Options {
Options
::
default
()
}
pub
fn
new_with
(
inner
:
*
mut
DBOptions
)
->
Options
{
assert
!
(
!
inner
.is_null
(),
"could not new rocksdb options with null inner"
);
Options
{
inner
:
inner
,
filter
:
None
,
}
}
pub
fn
increase_parallelism
(
&
mut
self
,
parallelism
:
i32
)
{
unsafe
{
crocksdb_ffi
::
crocksdb_options_increase_parallelism
(
self
.inner
,
parallelism
);
...
...
tests/test_ingest_external_file.rs
View file @
b8332a75
...
...
@@ -43,7 +43,8 @@ fn test_ingest_external_file() {
let
test_sstfile
=
gen_path
.path
()
.join
(
"test_sst_file"
);
let
test_sstfile_str
=
test_sstfile
.to_str
()
.unwrap
();
gen_sst
(
db
.get_options
(),
let
default_options
=
db
.get_options
();
gen_sst
(
&
default_options
,
db
.cf_handle
(
"default"
)
.unwrap
(),
test_sstfile_str
,
&
[(
b
"k1"
,
b
"v1"
),
(
b
"k2"
,
b
"v2"
)]);
...
...
@@ -64,7 +65,7 @@ fn test_ingest_external_file() {
let
snap
=
db
.snapshot
();
gen_sst
(
db
.get_options
()
,
gen_sst
(
&
default_options
,
handle
,
test_sstfile_str
,
&
[(
b
"k2"
,
b
"v5"
),
(
b
"k3"
,
b
"v6"
)]);
...
...
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