Browse Source

Refine Docker and Test Sample. (#9)

* fix: docker path bug.

* renew: update comment.

* fix: update travis

* fix: test/get.cc bug.

Co-authored-by: wuxinzhen1 <wuxinzhen1@jd.com>
Co-authored-by: wuxz <1067764612@qq.com>
Co-authored-by: caopei11 <caopei11@jd.com>
YangShuang 2 years ago
parent
commit
7ebc91f4b8
5 changed files with 10 additions and 14 deletions
  1. 4 3
      .travis.yml
  2. 2 4
      CMakeLists.txt
  3. 1 6
      README.md
  4. 2 0
      dockerfiles/sdk-cpp/dockerfile
  5. 1 1
      test/get.cc

+ 4 - 3
.travis.yml

@@ -29,14 +29,15 @@ install:
 script:
 - mkdir build/
 - cd build/
-- cmake ../
+- cmake -DCMAKE_TEST_OPTION=ON ../
 - make
 
 after_success:
 - cd ../
 - cp conf/* dockerfiles/server/
-- cp src/core/dtcd dockerfiles/server/
-- cp src/devel/cpp/libdtc.2.so dockerfiles/sdk-cpp/
+- cp build/src/core/dtcd dockerfiles/server/
+- cp build/src/devel/cpp/libdtc.2.so dockerfiles/sdk-cpp/
+- cp build/test/* dockerfiles/sdk-cpp/
 - cp test/* dockerfiles/sdk-cpp/
 - cp src/devel/cpp/dtcapi.h dockerfiles/sdk-cpp/
 - cd dockerfiles/server/

+ 2 - 4
CMakeLists.txt

@@ -3,13 +3,11 @@ PROJECT(dtc)
 option(CMAKE_TEST_OPTION "option for test_demo" OFF)
 ADD_SUBDIRECTORY(./src)
 
+#if you want to build the test_demo,you should use this command `cmake -DCMAKE_TEST_OPTION=ON ..`
 if(CMAKE_TEST_OPTION)
 ADD_SUBDIRECTORY(./test)
 SET(CMAKE_TEST_OPTION OFF CACHE BOOL INTERNAL FORCE)
 ENDIF(CMAKE_TEST_OPTION)
 
 #if you want to uninstall libraries, you should enter "build" folder, and use this command
-# cat install_manifest.txt | sudo xargs rm
-
-#if you want to build the test_demo,you should use this command
-#cmake -DCMAKE_TEST_OPTION=ON ..
+# cat install_manifest.txt | sudo xargs rm

+ 1 - 6
README.md

@@ -33,15 +33,10 @@ DTC系统由以下组件组成:
     在真实的分布式场景中,DTC可支持超过3,000,000 QPS的查询服务,且命中率在99.9%以上。
 
 ## 构建
-  项目提供docker镜像,可快速启动和运行示例
+  项目提供docker镜像,可快速启动服务
   - 启动server镜像:<br/>
   `docker pull dtc8/server:latest`<br/>
   `docker run -i -t -p 127.0.0.1:20015:20015 dtc8/server:latest`
-  - 启动SDK镜像:
-    - C++:<br/>
-    `docker pull dtc8/sdk-cpp:latest`<br/>
-    `docker run -i -t dtc8/sdk-cpp:latest /bin/bash`
-    - 后续计划SDK支持更多语言版本。
 
   更多编译详情,请移步[buiding](docs/buiding.md).
 

+ 2 - 0
dockerfiles/sdk-cpp/dockerfile

@@ -13,7 +13,9 @@ RUN ln -sf /usr/lib/$sofile /usr/lib/libdtc.so.1 && \
 RUN mkdir -p /usr/local/sdk-cpp
 COPY dtcapi.h /usr/local/sdk-cpp/dtcapi.h
 COPY get.cc /usr/local/sdk-cpp/get.cc
+COPY get /usr/local/sdk-cpp/get
 COPY insert.cc /usr/local/sdk-cpp/insert.cc
+COPY insert /usr/local/sdk-cpp/insert
 COPY build.sh /usr/local/sdk-cpp/build.sh
 
 CMD ["/bin/bash", "/root/start.sh"]

+ 1 - 1
test/get.cc

@@ -72,7 +72,7 @@ void select(DTC::Server server) {
   printf("NumRows:%d\n", result.get_num_row_size());
 
   /* 输出结果 */
-  for (int i = 0; i <= result.get_num_row_size(); ++i) {
+  for (int i = 0; i < result.get_num_row_size(); ++i) {
     /* 读取一行数据 */
     iRet = result.fetch_row();
     if (iRet < 0) {