Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove stream_body.proto #668

Merged
merged 2 commits into from
Oct 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,15 @@ protos:
--cpp_out="$(GRPC_GATEWAY_PROTOS)"
cd "$(ROOT_DIR)" && LD_LIBRARY_PATH="$(PROTO_LIB):$(GRPC_LIB)" "$(PROTOC)" \
--proto_path="$(GRPC_GATEWAY_PROTOS)" \
--proto_path="$(PROTO_SRC)" "$(GRPC_GATEWAY_PROTOS)/stream_body.proto" \
--proto_path="$(ROOT_DIR)/third_party/grpc/src/proto/grpc/status" \
--proto_path="$(PROTO_SRC)" "status.proto" \
--cpp_out="$(GRPC_GATEWAY_PROTOS)"
mkdir -p "$(ROOT_DIR)"/google/rpc
cd "$(ROOT_DIR)" && LD_LIBRARY_PATH="$(PROTO_LIB):$(GRPC_LIB)" "$(PROTOC)" \
--proto_path="$(GRPC_GATEWAY_PROTOS)" \
--proto_path="$(ROOT_DIR)/third_party/grpc/src/proto/grpc/status" \
--proto_path="$(PROTO_SRC)" "status.proto" \
--cpp_out="$(ROOT_DIR)/google/rpc"

NGINX_DIR := third_party/nginx
NGINX_LD_OPT := -L"$(PROTO_LIB)" -L"$(GRPC_LIB)" -lgrpc++ \
Expand Down
6 changes: 3 additions & 3 deletions net/grpc/gateway/codec/json_encoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
#include <string>

#include "google/protobuf/any.pb.h"
#include "google/rpc/status.pb.h"
#include "net/grpc/gateway/protos/pair.pb.h"
#include "net/grpc/gateway/protos/stream_body.pb.h"
#include "net/grpc/gateway/runtime/constants.h"
#include "third_party/grpc/include/grpcpp/support/config.h"
#include "third_party/grpc/include/grpc/slice.h"
#include "third_party/grpc/include/grpcpp/support/config.h"

namespace grpc {
namespace gateway {
Expand Down Expand Up @@ -81,7 +81,7 @@ void JsonEncoder::EncodeStatus(const grpc::Status& status,
pair.set_first(trailer.first);
pair.set_second(trailer.second.data(), trailer.second.length());
// TODO(fengli): Change to open source protobuf.
pair.SerializeToString(any->mutable_value());
any->set_value(pair.SerializeAsString());
}
}

Expand Down
6 changes: 3 additions & 3 deletions net/grpc/gateway/codec/proto_encoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
#include <vector>

#include "google/protobuf/any.pb.h"
#include "google/rpc/status.pb.h"
#include "net/grpc/gateway/protos/pair.pb.h"
#include "net/grpc/gateway/protos/stream_body.pb.h"
#include "net/grpc/gateway/runtime/constants.h"
#include "net/grpc/gateway/runtime/types.h"
#include "third_party/grpc/include/grpc/slice.h"
#include "third_party/grpc/include/grpcpp/support/byte_buffer.h"
#include "third_party/grpc/include/grpcpp/support/slice.h"
#include "third_party/grpc/include/grpc/slice.h"

namespace grpc {
namespace gateway {
Expand All @@ -54,7 +54,7 @@ void ProtoEncoder::EncodeStatus(const grpc::Status& status,
Pair pair;
pair.set_first(trailer.first);
pair.set_second(trailer.second.data(), trailer.second.length());
pair.SerializeToString(any->mutable_value());
any->set_value(pair.SerializeAsString());
}
}

Expand Down
7 changes: 4 additions & 3 deletions net/grpc/gateway/codec/stream_body_encoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
#include "net/grpc/gateway/codec/stream_body_encoder.h"

#include <stddef.h>

#include <cstdint>
#include <cstring>
#include <string>
#include <vector>

#include "google/protobuf/any.pb.h"
#include "google/rpc/status.pb.h"
#include "net/grpc/gateway/protos/pair.pb.h"
#include "net/grpc/gateway/protos/stream_body.pb.h"
#include "net/grpc/gateway/runtime/constants.h"
#include "third_party/grpc/include/grpcpp/support/slice.h"

Expand Down Expand Up @@ -114,7 +115,7 @@ void StreamBodyEncoder::EncodeStatus(const grpc::Status& status,
const Trailers* trailers,
std::vector<Slice>* result,
bool add_padding) {
google::rpc::Status status_proto;
::google::rpc::Status status_proto;
status_proto.set_code(status.error_code());
status_proto.set_message(status.error_message());
if (trailers != nullptr) {
Expand All @@ -124,7 +125,7 @@ void StreamBodyEncoder::EncodeStatus(const grpc::Status& status,
Pair pair;
pair.set_first(trailer.first);
pair.set_second(trailer.second.data(), trailer.second.length());
pair.SerializeToString(any->mutable_value());
any->set_value(pair.SerializeAsString());
}
}

Expand Down
8 changes: 0 additions & 8 deletions net/grpc/gateway/examples/echo/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,6 @@ proto-js:
$(PROTOC) -I=$(ROOT_DIR)/$(PROTOBUF_PATH)/src/google/protobuf \
--js_out=$(JS_IMPORT_STYLE):$(OUT_DIR) \
$(ROOT_DIR)/$(PROTOBUF_PATH)/src/google/protobuf/any.proto
$(PROTOC) -I=$(PROTOS_PATH)/protos \
-I=$(ROOT_DIR)/$(PROTOBUF_PATH)/src \
--js_out=$(JS_IMPORT_STYLE):$(OUT_DIR) \
$(PROTOS_PATH)/protos/stream_body.proto
$(PROTOC) -I=$(PROTOS_PATH)/protos \
-I=$(ROOT_DIR)/$(PROTOBUF_PATH)/src \
--js_out=$(JS_IMPORT_STYLE):$(OUT_DIR) \
$(PROTOS_PATH)/protos/pair.proto
$(PROTOC) -I=. --js_out=$(JS_IMPORT_STYLE):$(OUT_DIR) ./echo.proto
$(PROTOC) -I=. --plugin=protoc-gen-grpc-web=$(GRPC_WEB_PLUGIN_PATH) \
--grpc-web_out=import_style=closure,mode=grpcwebtext:. ./echo.proto
Expand Down
92 changes: 0 additions & 92 deletions net/grpc/gateway/protos/stream_body.proto

This file was deleted.