Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
25e569e1
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
25e569e1
编写于
10月 15, 2021
作者:
H
Hongze Cheng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add deps test
上级
36c20ec6
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
73 addition
and
0 deletion
+73
-0
.gitignore
.gitignore
+1
-0
cmake/cmake.options
cmake/cmake.options
+6
-0
deps/CMakeLists.txt
deps/CMakeLists.txt
+10
-0
deps/test/CMakeLists.txt
deps/test/CMakeLists.txt
+4
-0
deps/test/rocksdb/CMakeLists.txt
deps/test/rocksdb/CMakeLists.txt
+6
-0
deps/test/rocksdb/main.c
deps/test/rocksdb/main.c
+46
-0
未找到文件。
.gitignore
浏览文件 @
25e569e1
...
...
@@ -99,3 +99,4 @@ TAGS
deps/*
!deps/CMakeLists.txt
!deps/test
cmake/cmake.options
浏览文件 @
25e569e1
...
...
@@ -23,4 +23,10 @@ option(
BUILD_WITH_LUCENE
"If build with lucene"
OFF
)
option(
BUILD_DEPENDENCY_TESTS
"If build dependency tests"
OFF
)
\ No newline at end of file
deps/CMakeLists.txt
浏览文件 @
25e569e1
# ================================================================================================
# DEPENDENCIES
# ================================================================================================
# googletest
if
(
${
BUILD_TEST
}
)
add_subdirectory
(
googletest
)
...
...
@@ -63,3 +66,10 @@ if(${BUILD_WITH_LUCENE})
option
(
ENABLE_TEST
"Enable the tests"
OFF
)
add_subdirectory
(
lucene
)
endif
(
${
BUILD_WITH_LUCENE
}
)
# ================================================================================================
# DEPENDENCY TEST
# ================================================================================================
if
(
${
BUILD_DEPENDENCY_TESTS
}
)
add_subdirectory
(
test
)
endif
(
${
BUILD_DEPENDENCY_TESTS
}
)
deps/test/CMakeLists.txt
0 → 100644
浏览文件 @
25e569e1
# rocksdb
if
(
${
BUILD_WITH_ROCKSDB
}
)
add_subdirectory
(
rocksdb
)
endif
(
${
BUILD_WITH_ROCKSDB
}
)
deps/test/rocksdb/CMakeLists.txt
0 → 100644
浏览文件 @
25e569e1
add_executable
(
rocksdbTest
""
)
target_sources
(
rocksdbTest
PRIVATE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/main.c"
)
target_link_libraries
(
rocksdbTest rocksdb
)
\ No newline at end of file
deps/test/rocksdb/main.c
0 → 100644
浏览文件 @
25e569e1
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h> // sysconf() - get CPU count
#include "rocksdb/c.h"
// const char DBPath[] = "/tmp/rocksdb_c_simple_example";
const
char
DBPath
[]
=
"rocksdb_c_simple_example"
;
const
char
DBBackupPath
[]
=
"/tmp/rocksdb_c_simple_example_backup"
;
int
main
(
int
argc
,
char
const
*
argv
[])
{
rocksdb_t
*
db
;
rocksdb_backup_engine_t
*
be
;
rocksdb_options_t
*
options
=
rocksdb_options_create
();
rocksdb_options_set_create_if_missing
(
options
,
1
);
// open DB
char
*
err
=
NULL
;
db
=
rocksdb_open
(
options
,
DBPath
,
&
err
);
// Write
rocksdb_writeoptions_t
*
writeoptions
=
rocksdb_writeoptions_create
();
rocksdb_put
(
db
,
writeoptions
,
"key"
,
3
,
"value"
,
5
,
&
err
);
// Read
rocksdb_readoptions_t
*
readoptions
=
rocksdb_readoptions_create
();
rocksdb_readoptions_set_snapshot
(
readoptions
,
rocksdb_create_snapshot
(
db
));
size_t
vallen
=
0
;
char
*
val
=
rocksdb_get
(
db
,
readoptions
,
"key"
,
3
,
&
vallen
,
&
err
);
printf
(
"val:%s
\n
"
,
val
);
// Update
// rocksdb_put(db, writeoptions, "key", 3, "eulav", 5, &err);
// Delete
rocksdb_delete
(
db
,
writeoptions
,
"key"
,
3
,
&
err
);
// Read again
val
=
rocksdb_get
(
db
,
readoptions
,
"key"
,
3
,
&
vallen
,
&
err
);
printf
(
"val:%s
\n
"
,
val
);
rocksdb_close
(
db
);
return
0
;
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录