Skip to content

Commit 6cde663

Browse files
committed
v6
1 parent 4d77ed1 commit 6cde663

File tree

5 files changed

+640
-242
lines changed

5 files changed

+640
-242
lines changed

be/src/io/tools/CMakeLists.txt

+32-4
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,43 @@ set(LIBRARY_OUTPUT_PATH "${BUILD_DIR}/src/tools")
2121
# where to put generated binaries
2222
set(EXECUTABLE_OUTPUT_PATH "${BUILD_DIR}/src/tools")
2323

24-
# 添加 s3_writer_tool 可执行文件
25-
add_executable(s3_writer_tool
24+
# 编译proto文件
25+
execute_process(
26+
COMMAND make -C ${CMAKE_CURRENT_SOURCE_DIR}/proto
27+
RESULT_VARIABLE MAKE_RESULT
28+
)
29+
30+
if(NOT ${MAKE_RESULT} EQUAL 0)
31+
message(FATAL_ERROR "Failed to compile proto files")
32+
endif()
33+
34+
# 打印当前源代码目录
35+
message(STATUS "CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}")
36+
37+
# 查找生成的proto文件
38+
file(GLOB PROTO_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/build/proto/*.pb.cc")
39+
file(GLOB PROTO_HDRS "${CMAKE_CURRENT_SOURCE_DIR}/build/proto/*.pb.h")
40+
41+
# 打印PROTO_SRCS和PROTO_HDRS
42+
message(STATUS "PROTO_SRCS: ${PROTO_SRCS}")
43+
message(STATUS "PROTO_HDRS: ${PROTO_HDRS}")
44+
45+
# 添加 s3_writer_tool_http 可执行文件
46+
add_executable(s3_writer_tool_http
2647
s3_writer_tool.cpp
48+
${PROTO_SRCS}
49+
)
50+
51+
# 添加proto生成文件的包含路径
52+
target_include_directories(s3_writer_tool_http PRIVATE
53+
${CMAKE_CURRENT_SOURCE_DIR}/build/proto
2754
)
2855

2956
# 链接所需的库
30-
target_link_libraries(s3_writer_tool
57+
target_link_libraries(s3_writer_tool_http
3158
${DORIS_LINK_LIBS}
59+
protobuf
3260
)
3361

3462
# 安装规则
35-
install(TARGETS s3_writer_tool DESTINATION ${OUTPUT_DIR}/lib/)
63+
install(TARGETS s3_writer_tool_http DESTINATION ${OUTPUT_DIR}/lib/)

be/src/io/tools/Makefile

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
# This file is to make all generated file needed by fe and be.
19+
20+
BUILD_DIR = ${CURDIR}/build/
21+
22+
all: subdirs
23+
.PHONY: all
24+
25+
# build all subdir
26+
SUBDIR = script proto thrift
27+
subdirs: ${SUBDIR}
28+
.PHONY: subdirs ${SUBDIR}
29+
${SUBDIR}:
30+
$(MAKE) -C $@
31+
# script will product new thrift file.
32+
thrift: script
33+
34+
clean:
35+
rm -rf ${BUILD_DIR}
36+
.PHONY: clean

be/src/io/tools/proto/Makefile

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
# This file compile all protobuf files.
19+
20+
BUILD_DIR = ${CURDIR}/../build/proto
21+
PROTOC = ${DORIS_THIRDPARTY}/installed/bin/protoc
22+
23+
SOURCES = $(wildcard *.proto)
24+
OBJECTS = $(patsubst %.proto, ${BUILD_DIR}/%.pb.cc, ${SOURCES})
25+
HEADERS = $(patsubst %.proto, ${BUILD_DIR}/%.pb.h, ${SOURCES})
26+
27+
all: prepare ${OBJECTS} ${HEADERS}
28+
.PHONY: all prepare
29+
30+
prepare:
31+
mkdir -p ${BUILD_DIR}
32+
33+
${BUILD_DIR}/%.pb.h ${BUILD_DIR}/%.pb.cc: %.proto
34+
${PROTOC} --proto_path=. --cpp_out=${BUILD_DIR} $<
35+
36+
clean:
37+
rm -rf ${BUILD_DIR}
38+
.PHONY: clean
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
syntax="proto2";
19+
20+
package mircobench;
21+
22+
option cc_generic_services = true;
23+
24+
25+
message HttpRequest {};
26+
message HttpResponse {};
27+
28+
service MicrobenchService {
29+
rpc get_job_status(HttpRequest) returns (HttpResponse);
30+
rpc submit_job(HttpRequest) returns (HttpResponse);
31+
rpc list_jobs(HttpRequest) returns (HttpResponse);
32+
rpc cancel_job(HttpRequest) returns (HttpResponse);
33+
};

0 commit comments

Comments
 (0)