This is an automated email from the ASF dual-hosted git repository.

alexey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit 9f6b653aba9618a0f4220913436effb3b486cfe6
Author: Hao Hao <[email protected]>
AuthorDate: Sun Oct 13 23:12:47 2019 -0700

    KUDU-2971 p2: add basic protobuf msg
    
    This commit adds some basic protobuf messages for communicating with a
    subprocess. For example, EchoRequestPB and EchoResponsePB that simply
    echoes the request as a response.
    
    Change-Id: If02ab0f9bc1bc73f9c1a46d96bdef6725b8f6954
    Reviewed-on: http://gerrit.cloudera.org:8080/14426
    Tested-by: Kudu Jenkins
    Reviewed-by: Andrew Wong <[email protected]>
---
 src/kudu/subprocess/CMakeLists.txt   | 18 ++++++++++++
 src/kudu/subprocess/subprocess.proto | 56 ++++++++++++++++++++++++++++++++++++
 2 files changed, 74 insertions(+)

diff --git a/src/kudu/subprocess/CMakeLists.txt 
b/src/kudu/subprocess/CMakeLists.txt
index 6637c82..7d34a1d 100644
--- a/src/kudu/subprocess/CMakeLists.txt
+++ b/src/kudu/subprocess/CMakeLists.txt
@@ -16,6 +16,23 @@
 # under the License.
 
 #######################################
+# subprocess_proto
+#######################################
+
+PROTOBUF_GENERATE_CPP(
+  SUBPROCESS_PROTO_SRCS SUBPROCESS_PROTO_HDRS SUBPROCESS_PROTO_TGTS
+  SOURCE_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../..
+  BINARY_ROOT ${CMAKE_CURRENT_BINARY_DIR}/../..
+  PROTO_FILES subprocess.proto)
+
+add_library(subprocess_proto
+  ${SUBPROCESS_PROTO_SRCS}
+  ${SUBPROCESS_PROTO_HDRS})
+target_link_libraries(subprocess_proto
+  protobuf
+  wire_protocol_proto)
+
+#######################################
 # kudu_subprocess
 #######################################
 
@@ -25,6 +42,7 @@ add_library(kudu_subprocess
 target_link_libraries(kudu_subprocess
   gutil
   kudu_util
+  subprocess_proto
   tool_proto
   ${KUDU_BASE_LIBS}
 )
diff --git a/src/kudu/subprocess/subprocess.proto 
b/src/kudu/subprocess/subprocess.proto
new file mode 100644
index 0000000..2444981
--- /dev/null
+++ b/src/kudu/subprocess/subprocess.proto
@@ -0,0 +1,56 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+// This protobuf definition file actually requires protobuf3 despite using
+// protobuf2 syntax.
+syntax = "proto2";
+package kudu.subprocess;
+
+option java_package = "org.apache.kudu.subprocess";
+
+import "google/protobuf/any.proto";
+import "kudu/common/wire_protocol.proto";
+
+// EchoResponsePB simply echoes the data in EchoRequestPB as a response.
+message EchoRequestPB {
+  required string data = 1;
+}
+message EchoResponsePB {
+  required string data = 1;
+}
+
+// Request sent to the subprocess.
+message SubprocessRequestPB {
+  // A sequence number that uniquely identifies a call to the subprocess. This
+  // number is sent back in the Response and allows to match it to the original
+  // Request.
+  optional int64 id = 1;
+
+  // The request.
+  optional google.protobuf.Any request = 3;
+}
+
+// Sent by the subprocess in response to a request.
+message SubprocessResponsePB {
+  optional int64 id = 1;
+
+  // Only set if there was some kind of subprocess-side error.
+  optional AppStatusPB error = 2;
+
+  // The subprocess response. Only set for requests that actually expect a 
response.
+  optional google.protobuf.Any response = 3;
+}

Reply via email to