Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
kvdb
rocksdb
提交
ae508df9
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,发现更多精彩内容 >>
提交
ae508df9
编写于
12月 23, 2014
作者:
I
Igor Canadi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Clean up compile for c_simple_example
上级
b6230096
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
10 addition
and
8 deletion
+10
-8
examples/Makefile
examples/Makefile
+7
-4
examples/c_simple_example.c
examples/c_simple_example.c
+3
-4
未找到文件。
examples/Makefile
浏览文件 @
ae508df9
...
...
@@ -2,7 +2,7 @@ include ../build_config.mk
.PHONY
:
clean
all
:
simple_example column_families_example compact_files_example
simple_example-c
all
:
simple_example column_families_example compact_files_example
c_simple_example
simple_example
:
simple_example.cc
$(CXX)
$(CXXFLAGS)
$@
.cc
-o
$@
../librocksdb.a
-I
../include
-O2
-std
=
c++11
$(PLATFORM_LDFLAGS)
$(PLATFORM_CXXFLAGS)
$(EXEC_LDFLAGS)
...
...
@@ -13,8 +13,11 @@ column_families_example: column_families_example.cc
compact_files_example
:
compact_files_example.cc
$(CXX)
$(CXXFLAGS)
$@
.cc
-o
$@
../librocksdb.a
-I
../include
-O2
-std
=
c++11
$(PLATFORM_LDFLAGS)
$(PLATFORM_CXXFLAGS)
$(EXEC_LDFLAGS)
simple_example-c
:
simple_example.c
$(CXX)
-xc
-I
../include simple_example.c
-o
$@
-L
..
-lrocksdb
-pthread
-lsnappy
-lbz2
-lz
-lrt
.c.o
:
$(CC)
$(CFLAGS)
-c
$<
-o
$@
-I
../include
c_simple_example
:
c_simple_example.o
$(CXX)
$@
.o
-o
$@
../librocksdb.a
$(PLATFORM_LDFLAGS)
$(EXEC_LDFLAGS)
clean
:
rm
-rf
./simple_example ./column_families_example ./compact_files_example ./
simple_example-c
rm
-rf
./simple_example ./column_families_example ./compact_files_example ./
c_simple_example c_simple_example.o
examples/simple_example.c
→
examples/
c_
simple_example.c
浏览文件 @
ae508df9
...
...
@@ -14,8 +14,8 @@ int main(int argc, char **argv) {
rocksdb_options_t
*
options
=
rocksdb_options_create
();
// Optimize RocksDB. This is the easiest way to
// get RocksDB to perform well
int
cpus
=
sysconf
(
_SC_NPROCESSORS_ONLN
);
// get # of online cores
rocksdb_options_increase_parallelism
(
options
,
cpus
);
long
cpus
=
sysconf
(
_SC_NPROCESSORS_ONLN
);
// get # of online cores
rocksdb_options_increase_parallelism
(
options
,
(
int
)(
cpus
)
);
rocksdb_options_optimize_level_style_compaction
(
options
,
0
);
// create the DB if it's not already present
rocksdb_options_set_create_if_missing
(
options
,
1
);
...
...
@@ -28,7 +28,7 @@ int main(int argc, char **argv) {
// Put key-value
rocksdb_writeoptions_t
*
writeoptions
=
rocksdb_writeoptions_create
();
const
char
key
[]
=
"key"
;
char
*
value
=
"value"
;
c
onst
c
har
*
value
=
"value"
;
rocksdb_put
(
db
,
writeoptions
,
key
,
strlen
(
key
),
value
,
\
strlen
(
value
),
&
err
);
assert
(
!
err
);
...
...
@@ -38,7 +38,6 @@ int main(int argc, char **argv) {
value
=
rocksdb_get
(
db
,
readoptions
,
key
,
strlen
(
key
),
&
len
,
&
err
);
assert
(
!
err
);
assert
(
strcmp
(
value
,
"value"
)
==
0
);
free
(
value
);
// cleanup
rocksdb_writeoptions_destroy
(
writeoptions
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录