Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
kvdb
rocksdb
提交
078365bd
R
rocksdb
项目概览
kvdb
/
rocksdb
12 个月 前同步成功
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rocksdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
078365bd
编写于
4月 03, 2014
作者:
I
Igor Canadi
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #108 from tecbot/c-api-enhancements
C-API enhancements
上级
48bc0c6a
98422cba
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
94 addition
and
7 deletion
+94
-7
db/c.cc
db/c.cc
+75
-7
db/c_test.c
db/c_test.c
+1
-0
include/rocksdb/c.h
include/rocksdb/c.h
+18
-0
未找到文件。
db/c.cc
浏览文件 @
078365bd
...
...
@@ -25,12 +25,14 @@
#include "rocksdb/universal_compaction.h"
#include "rocksdb/statistics.h"
#include "rocksdb/slice_transform.h"
#include "rocksdb/table.h"
using
rocksdb
::
Cache
;
using
rocksdb
::
Comparator
;
using
rocksdb
::
CompressionType
;
using
rocksdb
::
DB
;
using
rocksdb
::
Env
;
using
rocksdb
::
InfoLogLevel
;
using
rocksdb
::
FileLock
;
using
rocksdb
::
FilterPolicy
;
using
rocksdb
::
FlushOptions
;
...
...
@@ -656,6 +658,11 @@ void rocksdb_options_set_info_log(rocksdb_options_t* opt, rocksdb_logger_t* l) {
}
}
void
rocksdb_options_set_info_log_level
(
rocksdb_options_t
*
opt
,
int
v
)
{
opt
->
rep
.
info_log_level
=
static_cast
<
InfoLogLevel
>
(
v
);
}
void
rocksdb_options_set_write_buffer_size
(
rocksdb_options_t
*
opt
,
size_t
s
)
{
opt
->
rep
.
write_buffer_size
=
s
;
}
...
...
@@ -714,6 +721,14 @@ void rocksdb_options_set_max_grandparent_overlap_factor(
opt
->
rep
.
max_grandparent_overlap_factor
=
n
;
}
void
rocksdb_options_set_max_bytes_for_level_multiplier_additional
(
rocksdb_options_t
*
opt
,
int
*
level_values
,
size_t
num_levels
)
{
opt
->
rep
.
max_bytes_for_level_multiplier_additional
.
resize
(
num_levels
);
for
(
size_t
i
=
0
;
i
<
num_levels
;
++
i
)
{
opt
->
rep
.
max_bytes_for_level_multiplier_additional
[
i
]
=
level_values
[
i
];
}
}
void
rocksdb_options_enable_statistics
(
rocksdb_options_t
*
opt
)
{
opt
->
rep
.
statistics
=
rocksdb
::
CreateDBStatistics
();
}
...
...
@@ -857,6 +872,24 @@ void rocksdb_options_set_advise_random_on_open(
opt
->
rep
.
advise_random_on_open
=
v
;
}
void
rocksdb_options_set_access_hint_on_compaction_start
(
rocksdb_options_t
*
opt
,
int
v
)
{
switch
(
v
)
{
case
0
:
opt
->
rep
.
access_hint_on_compaction_start
=
rocksdb
::
Options
::
NONE
;
break
;
case
1
:
opt
->
rep
.
access_hint_on_compaction_start
=
rocksdb
::
Options
::
NORMAL
;
break
;
case
2
:
opt
->
rep
.
access_hint_on_compaction_start
=
rocksdb
::
Options
::
SEQUENTIAL
;
break
;
case
3
:
opt
->
rep
.
access_hint_on_compaction_start
=
rocksdb
::
Options
::
WILLNEED
;
break
;
}
}
void
rocksdb_options_set_use_adaptive_mutex
(
rocksdb_options_t
*
opt
,
unsigned
char
v
)
{
opt
->
rep
.
use_adaptive_mutex
=
v
;
...
...
@@ -867,6 +900,11 @@ void rocksdb_options_set_bytes_per_sync(
opt
->
rep
.
bytes_per_sync
=
v
;
}
void
rocksdb_options_set_verify_checksums_in_compaction
(
rocksdb_options_t
*
opt
,
unsigned
char
v
)
{
opt
->
rep
.
verify_checksums_in_compaction
=
v
;
}
void
rocksdb_options_set_filter_deletes
(
rocksdb_options_t
*
opt
,
unsigned
char
v
)
{
opt
->
rep
.
filter_deletes
=
v
;
...
...
@@ -1003,11 +1041,48 @@ void rocksdb_options_set_hash_link_list_rep(
opt
->
rep
.
memtable_factory
.
reset
(
factory
);
}
void
rocksdb_options_set_plain_table_factory
(
rocksdb_options_t
*
opt
,
uint32_t
user_key_len
,
int
bloom_bits_per_key
,
double
hash_table_ratio
,
size_t
index_sparseness
)
{
static
rocksdb
::
TableFactory
*
factory
=
0
;
if
(
!
factory
)
{
factory
=
rocksdb
::
NewPlainTableFactory
(
user_key_len
,
bloom_bits_per_key
,
hash_table_ratio
,
index_sparseness
);
}
opt
->
rep
.
table_factory
.
reset
(
factory
);
}
void
rocksdb_options_set_max_successive_merges
(
rocksdb_options_t
*
opt
,
size_t
v
)
{
opt
->
rep
.
max_successive_merges
=
v
;
}
void
rocksdb_options_set_min_partial_merge_operands
(
rocksdb_options_t
*
opt
,
uint32_t
v
)
{
opt
->
rep
.
min_partial_merge_operands
=
v
;
}
void
rocksdb_options_set_bloom_locality
(
rocksdb_options_t
*
opt
,
uint32_t
v
)
{
opt
->
rep
.
bloom_locality
=
v
;
}
void
rocksdb_options_set_allow_thread_local
(
rocksdb_options_t
*
opt
,
unsigned
char
v
)
{
opt
->
rep
.
allow_thread_local
=
v
;
}
void
rocksdb_options_set_inplace_update_support
(
rocksdb_options_t
*
opt
,
unsigned
char
v
)
{
opt
->
rep
.
inplace_update_support
=
v
;
}
void
rocksdb_options_set_inplace_update_num_locks
(
rocksdb_options_t
*
opt
,
size_t
v
)
{
opt
->
rep
.
inplace_update_num_locks
=
v
;
}
void
rocksdb_options_set_compaction_style
(
rocksdb_options_t
*
opt
,
int
style
)
{
opt
->
rep
.
compaction_style
=
static_cast
<
rocksdb
::
CompactionStyle
>
(
style
);
}
...
...
@@ -1022,21 +1097,14 @@ DB::OpenForReadOnly
DB::MultiGet
DB::KeyMayExist
DB::GetOptions
DB::GetLiveFiles
DB::GetSortedWalFiles
DB::GetLatestSequenceNumber
DB::GetUpdatesSince
DB::DeleteFile
DB::GetDbIdentity
DB::RunManualCompaction
custom cache
compaction_filter
max_bytes_for_level_multiplier_additional
access_hint_on_compaction_start
table_factory
table_properties_collectors
inplace_update_support
inplace_update_num_locks
*/
rocksdb_comparator_t
*
rocksdb_comparator_create
(
...
...
db/c_test.c
浏览文件 @
078365bd
...
...
@@ -443,6 +443,7 @@ int main(int argc, char** argv) {
rocksdb_options_set_filter_policy
(
options
,
policy
);
rocksdb_options_set_prefix_extractor
(
options
,
rocksdb_slicetransform_create_fixed_prefix
(
3
));
rocksdb_options_set_hash_skip_list_rep
(
options
,
50000
,
4
,
4
);
rocksdb_options_set_plain_table_factory
(
options
,
4
,
10
,
0
.
75
,
16
);
db
=
rocksdb_open
(
options
,
dbname
,
&
err
);
CheckNoError
(
err
);
...
...
include/rocksdb/c.h
浏览文件 @
078365bd
...
...
@@ -243,6 +243,7 @@ extern void rocksdb_options_set_paranoid_checks(
rocksdb_options_t
*
,
unsigned
char
);
extern
void
rocksdb_options_set_env
(
rocksdb_options_t
*
,
rocksdb_env_t
*
);
extern
void
rocksdb_options_set_info_log
(
rocksdb_options_t
*
,
rocksdb_logger_t
*
);
extern
void
rocksdb_options_set_info_log_level
(
rocksdb_options_t
*
,
int
);
extern
void
rocksdb_options_set_write_buffer_size
(
rocksdb_options_t
*
,
size_t
);
extern
void
rocksdb_options_set_max_open_files
(
rocksdb_options_t
*
,
int
);
extern
void
rocksdb_options_set_cache
(
rocksdb_options_t
*
,
rocksdb_cache_t
*
);
...
...
@@ -275,6 +276,8 @@ extern void rocksdb_options_set_expanded_compaction_factor(
rocksdb_options_t
*
,
int
);
extern
void
rocksdb_options_set_max_grandparent_overlap_factor
(
rocksdb_options_t
*
,
int
);
extern
void
rocksdb_options_set_max_bytes_for_level_multiplier_additional
(
rocksdb_options_t
*
,
int
*
level_values
,
size_t
num_levels
);
extern
void
rocksdb_options_enable_statistics
(
rocksdb_options_t
*
);
extern
void
rocksdb_options_set_max_write_buffer_number
(
rocksdb_options_t
*
,
int
);
...
...
@@ -330,10 +333,14 @@ extern void rocksdb_options_set_block_size_deviation(
rocksdb_options_t
*
,
int
);
extern
void
rocksdb_options_set_advise_random_on_open
(
rocksdb_options_t
*
,
unsigned
char
);
extern
void
rocksdb_options_set_access_hint_on_compaction_start
(
rocksdb_options_t
*
,
int
);
extern
void
rocksdb_options_set_use_adaptive_mutex
(
rocksdb_options_t
*
,
unsigned
char
);
extern
void
rocksdb_options_set_bytes_per_sync
(
rocksdb_options_t
*
,
uint64_t
);
extern
void
rocksdb_options_set_verify_checksums_in_compaction
(
rocksdb_options_t
*
,
unsigned
char
);
extern
void
rocksdb_options_set_filter_deletes
(
rocksdb_options_t
*
,
unsigned
char
);
extern
void
rocksdb_options_set_max_sequential_skip_in_iterations
(
...
...
@@ -348,6 +355,7 @@ extern void rocksdb_options_prepare_for_bulk_load(rocksdb_options_t*);
extern
void
rocksdb_options_set_memtable_vector_rep
(
rocksdb_options_t
*
);
extern
void
rocksdb_options_set_hash_skip_list_rep
(
rocksdb_options_t
*
,
size_t
,
int32_t
,
int32_t
);
extern
void
rocksdb_options_set_hash_link_list_rep
(
rocksdb_options_t
*
,
size_t
);
extern
void
rocksdb_options_set_plain_table_factory
(
rocksdb_options_t
*
,
uint32_t
,
int
,
double
,
size_t
);
extern
void
rocksdb_options_set_max_bytes_for_level_base
(
rocksdb_options_t
*
opt
,
uint64_t
n
);
extern
void
rocksdb_options_set_stats_dump_period_sec
(
rocksdb_options_t
*
opt
,
unsigned
int
sec
);
...
...
@@ -360,6 +368,16 @@ extern void rocksdb_options_set_memtable_prefix_bloom_probes(
rocksdb_options_t
*
,
uint32_t
);
extern
void
rocksdb_options_set_max_successive_merges
(
rocksdb_options_t
*
,
size_t
);
extern
void
rocksdb_options_set_min_partial_merge_operands
(
rocksdb_options_t
*
,
uint32_t
);
extern
void
rocksdb_options_set_bloom_locality
(
rocksdb_options_t
*
,
uint32_t
);
extern
void
rocksdb_options_set_allow_thread_local
(
rocksdb_options_t
*
,
unsigned
char
);
extern
void
rocksdb_options_set_inplace_update_support
(
rocksdb_options_t
*
,
unsigned
char
);
extern
void
rocksdb_options_set_inplace_update_num_locks
(
rocksdb_options_t
*
,
size_t
);
enum
{
rocksdb_no_compression
=
0
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录