Merge branch 'master' of github.com:grpc/grpc into codegen_cleanse
This commit is contained in:
commit
1f32ae4e84
6
BUILD
6
BUILD
|
|
@ -297,6 +297,7 @@ cc_library(
|
||||||
"src/core/ext/client_config/subchannel_call_holder.h",
|
"src/core/ext/client_config/subchannel_call_holder.h",
|
||||||
"src/core/ext/client_config/subchannel_index.h",
|
"src/core/ext/client_config/subchannel_index.h",
|
||||||
"src/core/ext/client_config/uri_parser.h",
|
"src/core/ext/client_config/uri_parser.h",
|
||||||
|
"src/core/ext/lb_policy/grpclb/grpclb.h",
|
||||||
"src/core/ext/lb_policy/grpclb/load_balancer_api.h",
|
"src/core/ext/lb_policy/grpclb/load_balancer_api.h",
|
||||||
"src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h",
|
"src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h",
|
||||||
"src/core/ext/load_reporting/load_reporting.h",
|
"src/core/ext/load_reporting/load_reporting.h",
|
||||||
|
|
@ -473,6 +474,7 @@ cc_library(
|
||||||
"src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c",
|
"src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c",
|
||||||
"src/core/ext/transport/chttp2/client/insecure/channel_create.c",
|
"src/core/ext/transport/chttp2/client/insecure/channel_create.c",
|
||||||
"src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c",
|
"src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c",
|
||||||
|
"src/core/ext/lb_policy/grpclb/grpclb.c",
|
||||||
"src/core/ext/lb_policy/grpclb/load_balancer_api.c",
|
"src/core/ext/lb_policy/grpclb/load_balancer_api.c",
|
||||||
"src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c",
|
"src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c",
|
||||||
"src/core/ext/lb_policy/pick_first/pick_first.c",
|
"src/core/ext/lb_policy/pick_first/pick_first.c",
|
||||||
|
|
@ -1010,6 +1012,7 @@ cc_library(
|
||||||
"src/core/ext/client_config/uri_parser.h",
|
"src/core/ext/client_config/uri_parser.h",
|
||||||
"src/core/ext/load_reporting/load_reporting.h",
|
"src/core/ext/load_reporting/load_reporting.h",
|
||||||
"src/core/ext/load_reporting/load_reporting_filter.h",
|
"src/core/ext/load_reporting/load_reporting_filter.h",
|
||||||
|
"src/core/ext/lb_policy/grpclb/grpclb.h",
|
||||||
"src/core/ext/lb_policy/grpclb/load_balancer_api.h",
|
"src/core/ext/lb_policy/grpclb/load_balancer_api.h",
|
||||||
"src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h",
|
"src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h",
|
||||||
"src/core/ext/census/aggregation.h",
|
"src/core/ext/census/aggregation.h",
|
||||||
|
|
@ -1159,6 +1162,7 @@ cc_library(
|
||||||
"src/core/ext/resolver/sockaddr/sockaddr_resolver.c",
|
"src/core/ext/resolver/sockaddr/sockaddr_resolver.c",
|
||||||
"src/core/ext/load_reporting/load_reporting.c",
|
"src/core/ext/load_reporting/load_reporting.c",
|
||||||
"src/core/ext/load_reporting/load_reporting_filter.c",
|
"src/core/ext/load_reporting/load_reporting_filter.c",
|
||||||
|
"src/core/ext/lb_policy/grpclb/grpclb.c",
|
||||||
"src/core/ext/lb_policy/grpclb/load_balancer_api.c",
|
"src/core/ext/lb_policy/grpclb/load_balancer_api.c",
|
||||||
"src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c",
|
"src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c",
|
||||||
"src/core/ext/lb_policy/pick_first/pick_first.c",
|
"src/core/ext/lb_policy/pick_first/pick_first.c",
|
||||||
|
|
@ -1926,6 +1930,7 @@ objc_library(
|
||||||
"src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c",
|
"src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c",
|
||||||
"src/core/ext/transport/chttp2/client/insecure/channel_create.c",
|
"src/core/ext/transport/chttp2/client/insecure/channel_create.c",
|
||||||
"src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c",
|
"src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c",
|
||||||
|
"src/core/ext/lb_policy/grpclb/grpclb.c",
|
||||||
"src/core/ext/lb_policy/grpclb/load_balancer_api.c",
|
"src/core/ext/lb_policy/grpclb/load_balancer_api.c",
|
||||||
"src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c",
|
"src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c",
|
||||||
"src/core/ext/lb_policy/pick_first/pick_first.c",
|
"src/core/ext/lb_policy/pick_first/pick_first.c",
|
||||||
|
|
@ -2114,6 +2119,7 @@ objc_library(
|
||||||
"src/core/ext/client_config/subchannel_call_holder.h",
|
"src/core/ext/client_config/subchannel_call_holder.h",
|
||||||
"src/core/ext/client_config/subchannel_index.h",
|
"src/core/ext/client_config/subchannel_index.h",
|
||||||
"src/core/ext/client_config/uri_parser.h",
|
"src/core/ext/client_config/uri_parser.h",
|
||||||
|
"src/core/ext/lb_policy/grpclb/grpclb.h",
|
||||||
"src/core/ext/lb_policy/grpclb/load_balancer_api.h",
|
"src/core/ext/lb_policy/grpclb/load_balancer_api.h",
|
||||||
"src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h",
|
"src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h",
|
||||||
"src/core/ext/load_reporting/load_reporting.h",
|
"src/core/ext/load_reporting/load_reporting.h",
|
||||||
|
|
|
||||||
789
CMakeLists.txt
789
CMakeLists.txt
File diff suppressed because it is too large
Load Diff
213
Makefile
213
Makefile
|
|
@ -1048,6 +1048,7 @@ grpc_objective_c_plugin: $(BINDIR)/$(CONFIG)/grpc_objective_c_plugin
|
||||||
grpc_python_plugin: $(BINDIR)/$(CONFIG)/grpc_python_plugin
|
grpc_python_plugin: $(BINDIR)/$(CONFIG)/grpc_python_plugin
|
||||||
grpc_ruby_plugin: $(BINDIR)/$(CONFIG)/grpc_ruby_plugin
|
grpc_ruby_plugin: $(BINDIR)/$(CONFIG)/grpc_ruby_plugin
|
||||||
grpclb_api_test: $(BINDIR)/$(CONFIG)/grpclb_api_test
|
grpclb_api_test: $(BINDIR)/$(CONFIG)/grpclb_api_test
|
||||||
|
grpclb_test: $(BINDIR)/$(CONFIG)/grpclb_test
|
||||||
hybrid_end2end_test: $(BINDIR)/$(CONFIG)/hybrid_end2end_test
|
hybrid_end2end_test: $(BINDIR)/$(CONFIG)/hybrid_end2end_test
|
||||||
interop_client: $(BINDIR)/$(CONFIG)/interop_client
|
interop_client: $(BINDIR)/$(CONFIG)/interop_client
|
||||||
interop_server: $(BINDIR)/$(CONFIG)/interop_server
|
interop_server: $(BINDIR)/$(CONFIG)/interop_server
|
||||||
|
|
@ -1132,7 +1133,7 @@ h2_fd_test: $(BINDIR)/$(CONFIG)/h2_fd_test
|
||||||
h2_full_test: $(BINDIR)/$(CONFIG)/h2_full_test
|
h2_full_test: $(BINDIR)/$(CONFIG)/h2_full_test
|
||||||
h2_full+pipe_test: $(BINDIR)/$(CONFIG)/h2_full+pipe_test
|
h2_full+pipe_test: $(BINDIR)/$(CONFIG)/h2_full+pipe_test
|
||||||
h2_full+trace_test: $(BINDIR)/$(CONFIG)/h2_full+trace_test
|
h2_full+trace_test: $(BINDIR)/$(CONFIG)/h2_full+trace_test
|
||||||
h2_loadreporting_test: $(BINDIR)/$(CONFIG)/h2_loadreporting_test
|
h2_load_reporting_test: $(BINDIR)/$(CONFIG)/h2_load_reporting_test
|
||||||
h2_oauth2_test: $(BINDIR)/$(CONFIG)/h2_oauth2_test
|
h2_oauth2_test: $(BINDIR)/$(CONFIG)/h2_oauth2_test
|
||||||
h2_proxy_test: $(BINDIR)/$(CONFIG)/h2_proxy_test
|
h2_proxy_test: $(BINDIR)/$(CONFIG)/h2_proxy_test
|
||||||
h2_sockpair_test: $(BINDIR)/$(CONFIG)/h2_sockpair_test
|
h2_sockpair_test: $(BINDIR)/$(CONFIG)/h2_sockpair_test
|
||||||
|
|
@ -1148,7 +1149,7 @@ h2_fd_nosec_test: $(BINDIR)/$(CONFIG)/h2_fd_nosec_test
|
||||||
h2_full_nosec_test: $(BINDIR)/$(CONFIG)/h2_full_nosec_test
|
h2_full_nosec_test: $(BINDIR)/$(CONFIG)/h2_full_nosec_test
|
||||||
h2_full+pipe_nosec_test: $(BINDIR)/$(CONFIG)/h2_full+pipe_nosec_test
|
h2_full+pipe_nosec_test: $(BINDIR)/$(CONFIG)/h2_full+pipe_nosec_test
|
||||||
h2_full+trace_nosec_test: $(BINDIR)/$(CONFIG)/h2_full+trace_nosec_test
|
h2_full+trace_nosec_test: $(BINDIR)/$(CONFIG)/h2_full+trace_nosec_test
|
||||||
h2_loadreporting_nosec_test: $(BINDIR)/$(CONFIG)/h2_loadreporting_nosec_test
|
h2_load_reporting_nosec_test: $(BINDIR)/$(CONFIG)/h2_load_reporting_nosec_test
|
||||||
h2_proxy_nosec_test: $(BINDIR)/$(CONFIG)/h2_proxy_nosec_test
|
h2_proxy_nosec_test: $(BINDIR)/$(CONFIG)/h2_proxy_nosec_test
|
||||||
h2_sockpair_nosec_test: $(BINDIR)/$(CONFIG)/h2_sockpair_nosec_test
|
h2_sockpair_nosec_test: $(BINDIR)/$(CONFIG)/h2_sockpair_nosec_test
|
||||||
h2_sockpair+trace_nosec_test: $(BINDIR)/$(CONFIG)/h2_sockpair+trace_nosec_test
|
h2_sockpair+trace_nosec_test: $(BINDIR)/$(CONFIG)/h2_sockpair+trace_nosec_test
|
||||||
|
|
@ -1348,7 +1349,7 @@ buildtests_c: privatelibs_c \
|
||||||
$(BINDIR)/$(CONFIG)/h2_full_test \
|
$(BINDIR)/$(CONFIG)/h2_full_test \
|
||||||
$(BINDIR)/$(CONFIG)/h2_full+pipe_test \
|
$(BINDIR)/$(CONFIG)/h2_full+pipe_test \
|
||||||
$(BINDIR)/$(CONFIG)/h2_full+trace_test \
|
$(BINDIR)/$(CONFIG)/h2_full+trace_test \
|
||||||
$(BINDIR)/$(CONFIG)/h2_loadreporting_test \
|
$(BINDIR)/$(CONFIG)/h2_load_reporting_test \
|
||||||
$(BINDIR)/$(CONFIG)/h2_oauth2_test \
|
$(BINDIR)/$(CONFIG)/h2_oauth2_test \
|
||||||
$(BINDIR)/$(CONFIG)/h2_proxy_test \
|
$(BINDIR)/$(CONFIG)/h2_proxy_test \
|
||||||
$(BINDIR)/$(CONFIG)/h2_sockpair_test \
|
$(BINDIR)/$(CONFIG)/h2_sockpair_test \
|
||||||
|
|
@ -1364,7 +1365,7 @@ buildtests_c: privatelibs_c \
|
||||||
$(BINDIR)/$(CONFIG)/h2_full_nosec_test \
|
$(BINDIR)/$(CONFIG)/h2_full_nosec_test \
|
||||||
$(BINDIR)/$(CONFIG)/h2_full+pipe_nosec_test \
|
$(BINDIR)/$(CONFIG)/h2_full+pipe_nosec_test \
|
||||||
$(BINDIR)/$(CONFIG)/h2_full+trace_nosec_test \
|
$(BINDIR)/$(CONFIG)/h2_full+trace_nosec_test \
|
||||||
$(BINDIR)/$(CONFIG)/h2_loadreporting_nosec_test \
|
$(BINDIR)/$(CONFIG)/h2_load_reporting_nosec_test \
|
||||||
$(BINDIR)/$(CONFIG)/h2_proxy_nosec_test \
|
$(BINDIR)/$(CONFIG)/h2_proxy_nosec_test \
|
||||||
$(BINDIR)/$(CONFIG)/h2_sockpair_nosec_test \
|
$(BINDIR)/$(CONFIG)/h2_sockpair_nosec_test \
|
||||||
$(BINDIR)/$(CONFIG)/h2_sockpair+trace_nosec_test \
|
$(BINDIR)/$(CONFIG)/h2_sockpair+trace_nosec_test \
|
||||||
|
|
@ -1403,6 +1404,7 @@ buildtests_cxx: privatelibs_cxx \
|
||||||
$(BINDIR)/$(CONFIG)/golden_file_test \
|
$(BINDIR)/$(CONFIG)/golden_file_test \
|
||||||
$(BINDIR)/$(CONFIG)/grpc_cli \
|
$(BINDIR)/$(CONFIG)/grpc_cli \
|
||||||
$(BINDIR)/$(CONFIG)/grpclb_api_test \
|
$(BINDIR)/$(CONFIG)/grpclb_api_test \
|
||||||
|
$(BINDIR)/$(CONFIG)/grpclb_test \
|
||||||
$(BINDIR)/$(CONFIG)/hybrid_end2end_test \
|
$(BINDIR)/$(CONFIG)/hybrid_end2end_test \
|
||||||
$(BINDIR)/$(CONFIG)/interop_client \
|
$(BINDIR)/$(CONFIG)/interop_client \
|
||||||
$(BINDIR)/$(CONFIG)/interop_server \
|
$(BINDIR)/$(CONFIG)/interop_server \
|
||||||
|
|
@ -1487,6 +1489,7 @@ buildtests_cxx: privatelibs_cxx \
|
||||||
$(BINDIR)/$(CONFIG)/golden_file_test \
|
$(BINDIR)/$(CONFIG)/golden_file_test \
|
||||||
$(BINDIR)/$(CONFIG)/grpc_cli \
|
$(BINDIR)/$(CONFIG)/grpc_cli \
|
||||||
$(BINDIR)/$(CONFIG)/grpclb_api_test \
|
$(BINDIR)/$(CONFIG)/grpclb_api_test \
|
||||||
|
$(BINDIR)/$(CONFIG)/grpclb_test \
|
||||||
$(BINDIR)/$(CONFIG)/hybrid_end2end_test \
|
$(BINDIR)/$(CONFIG)/hybrid_end2end_test \
|
||||||
$(BINDIR)/$(CONFIG)/interop_client \
|
$(BINDIR)/$(CONFIG)/interop_client \
|
||||||
$(BINDIR)/$(CONFIG)/interop_server \
|
$(BINDIR)/$(CONFIG)/interop_server \
|
||||||
|
|
@ -1774,6 +1777,8 @@ test_cxx: buildtests_cxx
|
||||||
$(Q) $(BINDIR)/$(CONFIG)/golden_file_test || ( echo test golden_file_test failed ; exit 1 )
|
$(Q) $(BINDIR)/$(CONFIG)/golden_file_test || ( echo test golden_file_test failed ; exit 1 )
|
||||||
$(E) "[RUN] Testing grpclb_api_test"
|
$(E) "[RUN] Testing grpclb_api_test"
|
||||||
$(Q) $(BINDIR)/$(CONFIG)/grpclb_api_test || ( echo test grpclb_api_test failed ; exit 1 )
|
$(Q) $(BINDIR)/$(CONFIG)/grpclb_api_test || ( echo test grpclb_api_test failed ; exit 1 )
|
||||||
|
$(E) "[RUN] Testing grpclb_test"
|
||||||
|
$(Q) $(BINDIR)/$(CONFIG)/grpclb_test || ( echo test grpclb_test failed ; exit 1 )
|
||||||
$(E) "[RUN] Testing hybrid_end2end_test"
|
$(E) "[RUN] Testing hybrid_end2end_test"
|
||||||
$(Q) $(BINDIR)/$(CONFIG)/hybrid_end2end_test || ( echo test hybrid_end2end_test failed ; exit 1 )
|
$(Q) $(BINDIR)/$(CONFIG)/hybrid_end2end_test || ( echo test hybrid_end2end_test failed ; exit 1 )
|
||||||
$(E) "[RUN] Testing interop_test"
|
$(E) "[RUN] Testing interop_test"
|
||||||
|
|
@ -2678,6 +2683,7 @@ LIBGRPC_SRC = \
|
||||||
src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c \
|
src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c \
|
||||||
src/core/ext/transport/chttp2/client/insecure/channel_create.c \
|
src/core/ext/transport/chttp2/client/insecure/channel_create.c \
|
||||||
src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c \
|
src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c \
|
||||||
|
src/core/ext/lb_policy/grpclb/grpclb.c \
|
||||||
src/core/ext/lb_policy/grpclb/load_balancer_api.c \
|
src/core/ext/lb_policy/grpclb/load_balancer_api.c \
|
||||||
src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c \
|
src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c \
|
||||||
third_party/nanopb/pb_common.c \
|
third_party/nanopb/pb_common.c \
|
||||||
|
|
@ -3045,8 +3051,123 @@ LIBGRPC_TEST_UTIL_SRC = \
|
||||||
test/core/util/port_server_client.c \
|
test/core/util/port_server_client.c \
|
||||||
test/core/util/port_windows.c \
|
test/core/util/port_windows.c \
|
||||||
test/core/util/slice_splitter.c \
|
test/core/util/slice_splitter.c \
|
||||||
|
src/core/lib/channel/channel_args.c \
|
||||||
|
src/core/lib/channel/channel_stack.c \
|
||||||
|
src/core/lib/channel/channel_stack_builder.c \
|
||||||
|
src/core/lib/channel/compress_filter.c \
|
||||||
|
src/core/lib/channel/connected_channel.c \
|
||||||
|
src/core/lib/channel/handshaker.c \
|
||||||
|
src/core/lib/channel/http_client_filter.c \
|
||||||
|
src/core/lib/channel/http_server_filter.c \
|
||||||
|
src/core/lib/compression/compression.c \
|
||||||
|
src/core/lib/compression/message_compress.c \
|
||||||
|
src/core/lib/debug/trace.c \
|
||||||
|
src/core/lib/http/format_request.c \
|
||||||
|
src/core/lib/http/httpcli.c \
|
||||||
|
src/core/lib/http/parser.c \
|
||||||
|
src/core/lib/iomgr/closure.c \
|
||||||
|
src/core/lib/iomgr/endpoint.c \
|
||||||
|
src/core/lib/iomgr/endpoint_pair_posix.c \
|
||||||
|
src/core/lib/iomgr/endpoint_pair_windows.c \
|
||||||
|
src/core/lib/iomgr/error.c \
|
||||||
|
src/core/lib/iomgr/ev_epoll_linux.c \
|
||||||
|
src/core/lib/iomgr/ev_poll_and_epoll_posix.c \
|
||||||
|
src/core/lib/iomgr/ev_poll_posix.c \
|
||||||
|
src/core/lib/iomgr/ev_posix.c \
|
||||||
|
src/core/lib/iomgr/exec_ctx.c \
|
||||||
|
src/core/lib/iomgr/executor.c \
|
||||||
|
src/core/lib/iomgr/iocp_windows.c \
|
||||||
|
src/core/lib/iomgr/iomgr.c \
|
||||||
|
src/core/lib/iomgr/iomgr_posix.c \
|
||||||
|
src/core/lib/iomgr/iomgr_windows.c \
|
||||||
|
src/core/lib/iomgr/load_file.c \
|
||||||
|
src/core/lib/iomgr/network_status_tracker.c \
|
||||||
|
src/core/lib/iomgr/polling_entity.c \
|
||||||
|
src/core/lib/iomgr/pollset_set_windows.c \
|
||||||
|
src/core/lib/iomgr/pollset_windows.c \
|
||||||
|
src/core/lib/iomgr/resolve_address_posix.c \
|
||||||
|
src/core/lib/iomgr/resolve_address_windows.c \
|
||||||
|
src/core/lib/iomgr/sockaddr_utils.c \
|
||||||
|
src/core/lib/iomgr/socket_utils_common_posix.c \
|
||||||
|
src/core/lib/iomgr/socket_utils_linux.c \
|
||||||
|
src/core/lib/iomgr/socket_utils_posix.c \
|
||||||
|
src/core/lib/iomgr/socket_windows.c \
|
||||||
|
src/core/lib/iomgr/tcp_client_posix.c \
|
||||||
|
src/core/lib/iomgr/tcp_client_windows.c \
|
||||||
|
src/core/lib/iomgr/tcp_posix.c \
|
||||||
|
src/core/lib/iomgr/tcp_server_posix.c \
|
||||||
|
src/core/lib/iomgr/tcp_server_windows.c \
|
||||||
|
src/core/lib/iomgr/tcp_windows.c \
|
||||||
|
src/core/lib/iomgr/time_averaged_stats.c \
|
||||||
|
src/core/lib/iomgr/timer.c \
|
||||||
|
src/core/lib/iomgr/timer_heap.c \
|
||||||
|
src/core/lib/iomgr/udp_server.c \
|
||||||
|
src/core/lib/iomgr/unix_sockets_posix.c \
|
||||||
|
src/core/lib/iomgr/unix_sockets_posix_noop.c \
|
||||||
|
src/core/lib/iomgr/wakeup_fd_eventfd.c \
|
||||||
|
src/core/lib/iomgr/wakeup_fd_nospecial.c \
|
||||||
|
src/core/lib/iomgr/wakeup_fd_pipe.c \
|
||||||
|
src/core/lib/iomgr/wakeup_fd_posix.c \
|
||||||
|
src/core/lib/iomgr/workqueue_posix.c \
|
||||||
|
src/core/lib/iomgr/workqueue_windows.c \
|
||||||
|
src/core/lib/json/json.c \
|
||||||
|
src/core/lib/json/json_reader.c \
|
||||||
|
src/core/lib/json/json_string.c \
|
||||||
|
src/core/lib/json/json_writer.c \
|
||||||
|
src/core/lib/surface/alarm.c \
|
||||||
|
src/core/lib/surface/api_trace.c \
|
||||||
|
src/core/lib/surface/byte_buffer.c \
|
||||||
|
src/core/lib/surface/byte_buffer_reader.c \
|
||||||
|
src/core/lib/surface/call.c \
|
||||||
|
src/core/lib/surface/call_details.c \
|
||||||
|
src/core/lib/surface/call_log_batch.c \
|
||||||
|
src/core/lib/surface/channel.c \
|
||||||
|
src/core/lib/surface/channel_init.c \
|
||||||
|
src/core/lib/surface/channel_ping.c \
|
||||||
|
src/core/lib/surface/channel_stack_type.c \
|
||||||
|
src/core/lib/surface/completion_queue.c \
|
||||||
|
src/core/lib/surface/event_string.c \
|
||||||
|
src/core/lib/surface/lame_client.c \
|
||||||
|
src/core/lib/surface/metadata_array.c \
|
||||||
|
src/core/lib/surface/server.c \
|
||||||
|
src/core/lib/surface/validate_metadata.c \
|
||||||
|
src/core/lib/surface/version.c \
|
||||||
|
src/core/lib/transport/byte_stream.c \
|
||||||
|
src/core/lib/transport/connectivity_state.c \
|
||||||
|
src/core/lib/transport/metadata.c \
|
||||||
|
src/core/lib/transport/metadata_batch.c \
|
||||||
|
src/core/lib/transport/static_metadata.c \
|
||||||
|
src/core/lib/transport/transport.c \
|
||||||
|
src/core/lib/transport/transport_op_string.c \
|
||||||
|
|
||||||
PUBLIC_HEADERS_C += \
|
PUBLIC_HEADERS_C += \
|
||||||
|
include/grpc/byte_buffer.h \
|
||||||
|
include/grpc/byte_buffer_reader.h \
|
||||||
|
include/grpc/compression.h \
|
||||||
|
include/grpc/grpc.h \
|
||||||
|
include/grpc/grpc_posix.h \
|
||||||
|
include/grpc/status.h \
|
||||||
|
include/grpc/impl/codegen/byte_buffer.h \
|
||||||
|
include/grpc/impl/codegen/byte_buffer_reader.h \
|
||||||
|
include/grpc/impl/codegen/compression_types.h \
|
||||||
|
include/grpc/impl/codegen/connectivity_state.h \
|
||||||
|
include/grpc/impl/codegen/grpc_types.h \
|
||||||
|
include/grpc/impl/codegen/propagation_bits.h \
|
||||||
|
include/grpc/impl/codegen/status.h \
|
||||||
|
include/grpc/impl/codegen/alloc.h \
|
||||||
|
include/grpc/impl/codegen/atm.h \
|
||||||
|
include/grpc/impl/codegen/atm_gcc_atomic.h \
|
||||||
|
include/grpc/impl/codegen/atm_gcc_sync.h \
|
||||||
|
include/grpc/impl/codegen/atm_windows.h \
|
||||||
|
include/grpc/impl/codegen/log.h \
|
||||||
|
include/grpc/impl/codegen/port_platform.h \
|
||||||
|
include/grpc/impl/codegen/slice.h \
|
||||||
|
include/grpc/impl/codegen/slice_buffer.h \
|
||||||
|
include/grpc/impl/codegen/sync.h \
|
||||||
|
include/grpc/impl/codegen/sync_generic.h \
|
||||||
|
include/grpc/impl/codegen/sync_posix.h \
|
||||||
|
include/grpc/impl/codegen/sync_windows.h \
|
||||||
|
include/grpc/impl/codegen/time.h \
|
||||||
|
|
||||||
LIBGRPC_TEST_UTIL_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC_TEST_UTIL_SRC))))
|
LIBGRPC_TEST_UTIL_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC_TEST_UTIL_SRC))))
|
||||||
|
|
||||||
|
|
@ -3259,6 +3380,7 @@ LIBGRPC_UNSECURE_SRC = \
|
||||||
src/core/ext/resolver/sockaddr/sockaddr_resolver.c \
|
src/core/ext/resolver/sockaddr/sockaddr_resolver.c \
|
||||||
src/core/ext/load_reporting/load_reporting.c \
|
src/core/ext/load_reporting/load_reporting.c \
|
||||||
src/core/ext/load_reporting/load_reporting_filter.c \
|
src/core/ext/load_reporting/load_reporting_filter.c \
|
||||||
|
src/core/ext/lb_policy/grpclb/grpclb.c \
|
||||||
src/core/ext/lb_policy/grpclb/load_balancer_api.c \
|
src/core/ext/lb_policy/grpclb/load_balancer_api.c \
|
||||||
src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c \
|
src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c \
|
||||||
third_party/nanopb/pb_common.c \
|
third_party/nanopb/pb_common.c \
|
||||||
|
|
@ -6372,6 +6494,7 @@ LIBEND2END_TESTS_SRC = \
|
||||||
test/core/end2end/tests/idempotent_request.c \
|
test/core/end2end/tests/idempotent_request.c \
|
||||||
test/core/end2end/tests/invoke_large_request.c \
|
test/core/end2end/tests/invoke_large_request.c \
|
||||||
test/core/end2end/tests/large_metadata.c \
|
test/core/end2end/tests/large_metadata.c \
|
||||||
|
test/core/end2end/tests/load_reporting_hook.c \
|
||||||
test/core/end2end/tests/max_concurrent_streams.c \
|
test/core/end2end/tests/max_concurrent_streams.c \
|
||||||
test/core/end2end/tests/max_message_length.c \
|
test/core/end2end/tests/max_message_length.c \
|
||||||
test/core/end2end/tests/negative_deadline.c \
|
test/core/end2end/tests/negative_deadline.c \
|
||||||
|
|
@ -6450,6 +6573,7 @@ LIBEND2END_NOSEC_TESTS_SRC = \
|
||||||
test/core/end2end/tests/idempotent_request.c \
|
test/core/end2end/tests/idempotent_request.c \
|
||||||
test/core/end2end/tests/invoke_large_request.c \
|
test/core/end2end/tests/invoke_large_request.c \
|
||||||
test/core/end2end/tests/large_metadata.c \
|
test/core/end2end/tests/large_metadata.c \
|
||||||
|
test/core/end2end/tests/load_reporting_hook.c \
|
||||||
test/core/end2end/tests/max_concurrent_streams.c \
|
test/core/end2end/tests/max_concurrent_streams.c \
|
||||||
test/core/end2end/tests/max_message_length.c \
|
test/core/end2end/tests/max_message_length.c \
|
||||||
test/core/end2end/tests/negative_deadline.c \
|
test/core/end2end/tests/negative_deadline.c \
|
||||||
|
|
@ -11287,6 +11411,53 @@ endif
|
||||||
$(OBJDIR)/$(CONFIG)/test/cpp/grpclb/grpclb_api_test.o: $(GENDIR)/src/proto/grpc/lb/v1/load_balancer.pb.cc $(GENDIR)/src/proto/grpc/lb/v1/load_balancer.grpc.pb.cc
|
$(OBJDIR)/$(CONFIG)/test/cpp/grpclb/grpclb_api_test.o: $(GENDIR)/src/proto/grpc/lb/v1/load_balancer.pb.cc $(GENDIR)/src/proto/grpc/lb/v1/load_balancer.grpc.pb.cc
|
||||||
|
|
||||||
|
|
||||||
|
GRPCLB_TEST_SRC = \
|
||||||
|
$(GENDIR)/src/proto/grpc/lb/v1/load_balancer.pb.cc $(GENDIR)/src/proto/grpc/lb/v1/load_balancer.grpc.pb.cc \
|
||||||
|
test/cpp/grpclb/grpclb_test.cc \
|
||||||
|
|
||||||
|
GRPCLB_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GRPCLB_TEST_SRC))))
|
||||||
|
ifeq ($(NO_SECURE),true)
|
||||||
|
|
||||||
|
# You can't build secure targets if you don't have OpenSSL.
|
||||||
|
|
||||||
|
$(BINDIR)/$(CONFIG)/grpclb_test: openssl_dep_error
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ifeq ($(NO_PROTOBUF),true)
|
||||||
|
|
||||||
|
# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+.
|
||||||
|
|
||||||
|
$(BINDIR)/$(CONFIG)/grpclb_test: protobuf_dep_error
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
$(BINDIR)/$(CONFIG)/grpclb_test: $(PROTOBUF_DEP) $(GRPCLB_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a
|
||||||
|
$(E) "[LD] Linking $@"
|
||||||
|
$(Q) mkdir -p `dirname $@`
|
||||||
|
$(Q) $(LDXX) $(LDFLAGS) $(GRPCLB_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/grpclb_test
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(OBJDIR)/$(CONFIG)/src/proto/grpc/lb/v1/load_balancer.o: $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a
|
||||||
|
|
||||||
|
$(OBJDIR)/$(CONFIG)/test/cpp/grpclb/grpclb_test.o: $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a
|
||||||
|
|
||||||
|
deps_grpclb_test: $(GRPCLB_TEST_OBJS:.o=.dep)
|
||||||
|
|
||||||
|
ifneq ($(NO_SECURE),true)
|
||||||
|
ifneq ($(NO_DEPS),true)
|
||||||
|
-include $(GRPCLB_TEST_OBJS:.o=.dep)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
$(OBJDIR)/$(CONFIG)/test/cpp/grpclb/grpclb_test.o: $(GENDIR)/src/proto/grpc/lb/v1/load_balancer.pb.cc $(GENDIR)/src/proto/grpc/lb/v1/load_balancer.grpc.pb.cc
|
||||||
|
|
||||||
|
|
||||||
HYBRID_END2END_TEST_SRC = \
|
HYBRID_END2END_TEST_SRC = \
|
||||||
test/cpp/end2end/hybrid_end2end_test.cc \
|
test/cpp/end2end/hybrid_end2end_test.cc \
|
||||||
|
|
||||||
|
|
@ -13961,34 +14132,34 @@ endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
H2_LOADREPORTING_TEST_SRC = \
|
H2_LOAD_REPORTING_TEST_SRC = \
|
||||||
test/core/end2end/fixtures/h2_loadreporting.c \
|
test/core/end2end/fixtures/h2_load_reporting.c \
|
||||||
|
|
||||||
H2_LOADREPORTING_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(H2_LOADREPORTING_TEST_SRC))))
|
H2_LOAD_REPORTING_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(H2_LOAD_REPORTING_TEST_SRC))))
|
||||||
ifeq ($(NO_SECURE),true)
|
ifeq ($(NO_SECURE),true)
|
||||||
|
|
||||||
# You can't build secure targets if you don't have OpenSSL.
|
# You can't build secure targets if you don't have OpenSSL.
|
||||||
|
|
||||||
$(BINDIR)/$(CONFIG)/h2_loadreporting_test: openssl_dep_error
|
$(BINDIR)/$(CONFIG)/h2_load_reporting_test: openssl_dep_error
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$(BINDIR)/$(CONFIG)/h2_loadreporting_test: $(H2_LOADREPORTING_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
|
$(BINDIR)/$(CONFIG)/h2_load_reporting_test: $(H2_LOAD_REPORTING_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
|
||||||
$(E) "[LD] Linking $@"
|
$(E) "[LD] Linking $@"
|
||||||
$(Q) mkdir -p `dirname $@`
|
$(Q) mkdir -p `dirname $@`
|
||||||
$(Q) $(LD) $(LDFLAGS) $(H2_LOADREPORTING_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_loadreporting_test
|
$(Q) $(LD) $(LDFLAGS) $(H2_LOAD_REPORTING_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_load_reporting_test
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(OBJDIR)/$(CONFIG)/test/core/end2end/fixtures/h2_loadreporting.o: $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
|
$(OBJDIR)/$(CONFIG)/test/core/end2end/fixtures/h2_load_reporting.o: $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
|
||||||
|
|
||||||
deps_h2_loadreporting_test: $(H2_LOADREPORTING_TEST_OBJS:.o=.dep)
|
deps_h2_load_reporting_test: $(H2_LOAD_REPORTING_TEST_OBJS:.o=.dep)
|
||||||
|
|
||||||
ifneq ($(NO_SECURE),true)
|
ifneq ($(NO_SECURE),true)
|
||||||
ifneq ($(NO_DEPS),true)
|
ifneq ($(NO_DEPS),true)
|
||||||
-include $(H2_LOADREPORTING_TEST_OBJS:.o=.dep)
|
-include $(H2_LOAD_REPORTING_TEST_OBJS:.o=.dep)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
@ -14401,23 +14572,23 @@ ifneq ($(NO_DEPS),true)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
H2_LOADREPORTING_NOSEC_TEST_SRC = \
|
H2_LOAD_REPORTING_NOSEC_TEST_SRC = \
|
||||||
test/core/end2end/fixtures/h2_loadreporting.c \
|
test/core/end2end/fixtures/h2_load_reporting.c \
|
||||||
|
|
||||||
H2_LOADREPORTING_NOSEC_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(H2_LOADREPORTING_NOSEC_TEST_SRC))))
|
H2_LOAD_REPORTING_NOSEC_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(H2_LOAD_REPORTING_NOSEC_TEST_SRC))))
|
||||||
|
|
||||||
|
|
||||||
$(BINDIR)/$(CONFIG)/h2_loadreporting_nosec_test: $(H2_LOADREPORTING_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
|
$(BINDIR)/$(CONFIG)/h2_load_reporting_nosec_test: $(H2_LOAD_REPORTING_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
|
||||||
$(E) "[LD] Linking $@"
|
$(E) "[LD] Linking $@"
|
||||||
$(Q) mkdir -p `dirname $@`
|
$(Q) mkdir -p `dirname $@`
|
||||||
$(Q) $(LD) $(LDFLAGS) $(H2_LOADREPORTING_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/h2_loadreporting_nosec_test
|
$(Q) $(LD) $(LDFLAGS) $(H2_LOAD_REPORTING_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/h2_load_reporting_nosec_test
|
||||||
|
|
||||||
$(OBJDIR)/$(CONFIG)/test/core/end2end/fixtures/h2_loadreporting.o: $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
|
$(OBJDIR)/$(CONFIG)/test/core/end2end/fixtures/h2_load_reporting.o: $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
|
||||||
|
|
||||||
deps_h2_loadreporting_nosec_test: $(H2_LOADREPORTING_NOSEC_TEST_OBJS:.o=.dep)
|
deps_h2_load_reporting_nosec_test: $(H2_LOAD_REPORTING_NOSEC_TEST_OBJS:.o=.dep)
|
||||||
|
|
||||||
ifneq ($(NO_DEPS),true)
|
ifneq ($(NO_DEPS),true)
|
||||||
-include $(H2_LOADREPORTING_NOSEC_TEST_OBJS:.o=.dep)
|
-include $(H2_LOAD_REPORTING_NOSEC_TEST_OBJS:.o=.dep)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -727,6 +727,7 @@
|
||||||
'src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c',
|
'src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c',
|
||||||
'src/core/ext/transport/chttp2/client/insecure/channel_create.c',
|
'src/core/ext/transport/chttp2/client/insecure/channel_create.c',
|
||||||
'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c',
|
'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c',
|
||||||
|
'src/core/ext/lb_policy/grpclb/grpclb.c',
|
||||||
'src/core/ext/lb_policy/grpclb/load_balancer_api.c',
|
'src/core/ext/lb_policy/grpclb/load_balancer_api.c',
|
||||||
'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c',
|
'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c',
|
||||||
'third_party/nanopb/pb_common.c',
|
'third_party/nanopb/pb_common.c',
|
||||||
|
|
|
||||||
20
build.yaml
20
build.yaml
|
|
@ -372,11 +372,14 @@ filegroups:
|
||||||
- gpr_codegen
|
- gpr_codegen
|
||||||
- name: grpc_lb_policy_grpclb
|
- name: grpc_lb_policy_grpclb
|
||||||
headers:
|
headers:
|
||||||
|
- src/core/ext/lb_policy/grpclb/grpclb.h
|
||||||
- src/core/ext/lb_policy/grpclb/load_balancer_api.h
|
- src/core/ext/lb_policy/grpclb/load_balancer_api.h
|
||||||
- src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h
|
- src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h
|
||||||
src:
|
src:
|
||||||
|
- src/core/ext/lb_policy/grpclb/grpclb.c
|
||||||
- src/core/ext/lb_policy/grpclb/load_balancer_api.c
|
- src/core/ext/lb_policy/grpclb/load_balancer_api.c
|
||||||
- src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c
|
- src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c
|
||||||
|
plugin: grpc_lb_policy_grpclb
|
||||||
uses:
|
uses:
|
||||||
- grpc_base
|
- grpc_base
|
||||||
- grpc_client_config
|
- grpc_client_config
|
||||||
|
|
@ -812,6 +815,7 @@ libs:
|
||||||
- grpc_lb_policy_grpclb
|
- grpc_lb_policy_grpclb
|
||||||
- grpc_lb_policy_pick_first
|
- grpc_lb_policy_pick_first
|
||||||
- grpc_lb_policy_round_robin
|
- grpc_lb_policy_round_robin
|
||||||
|
- grpc_lb_policy_grpclb
|
||||||
- grpc_resolver_dns_native
|
- grpc_resolver_dns_native
|
||||||
- grpc_resolver_sockaddr
|
- grpc_resolver_sockaddr
|
||||||
- grpc_load_reporting
|
- grpc_load_reporting
|
||||||
|
|
@ -878,6 +882,7 @@ libs:
|
||||||
- grpc
|
- grpc
|
||||||
filegroups:
|
filegroups:
|
||||||
- grpc_test_util_base
|
- grpc_test_util_base
|
||||||
|
- grpc_base
|
||||||
vs_project_guid: '{17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}'
|
vs_project_guid: '{17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}'
|
||||||
- name: grpc_test_util_unsecure
|
- name: grpc_test_util_unsecure
|
||||||
build: private
|
build: private
|
||||||
|
|
@ -909,6 +914,7 @@ libs:
|
||||||
- grpc_lb_policy_grpclb
|
- grpc_lb_policy_grpclb
|
||||||
- grpc_lb_policy_pick_first
|
- grpc_lb_policy_pick_first
|
||||||
- grpc_lb_policy_round_robin
|
- grpc_lb_policy_round_robin
|
||||||
|
- grpc_lb_policy_grpclb
|
||||||
- census
|
- census
|
||||||
generate_plugin_registry: true
|
generate_plugin_registry: true
|
||||||
secure: false
|
secure: false
|
||||||
|
|
@ -2746,6 +2752,20 @@ targets:
|
||||||
- grpc_test_util
|
- grpc_test_util
|
||||||
- grpc++
|
- grpc++
|
||||||
- grpc
|
- grpc
|
||||||
|
- name: grpclb_test
|
||||||
|
gtest: false
|
||||||
|
build: test
|
||||||
|
language: c++
|
||||||
|
src:
|
||||||
|
- src/proto/grpc/lb/v1/load_balancer.proto
|
||||||
|
- test/cpp/grpclb/grpclb_test.cc
|
||||||
|
deps:
|
||||||
|
- gpr
|
||||||
|
- gpr_test_util
|
||||||
|
- grpc
|
||||||
|
- grpc++
|
||||||
|
- grpc++_test_util
|
||||||
|
- grpc_test_util
|
||||||
- name: hybrid_end2end_test
|
- name: hybrid_end2end_test
|
||||||
gtest: true
|
gtest: true
|
||||||
build: test
|
build: test
|
||||||
|
|
|
||||||
|
|
@ -246,6 +246,7 @@ if test "$PHP_GRPC" != "no"; then
|
||||||
src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c \
|
src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c \
|
||||||
src/core/ext/transport/chttp2/client/insecure/channel_create.c \
|
src/core/ext/transport/chttp2/client/insecure/channel_create.c \
|
||||||
src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c \
|
src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c \
|
||||||
|
src/core/ext/lb_policy/grpclb/grpclb.c \
|
||||||
src/core/ext/lb_policy/grpclb/load_balancer_api.c \
|
src/core/ext/lb_policy/grpclb/load_balancer_api.c \
|
||||||
src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c \
|
src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c \
|
||||||
third_party/nanopb/pb_common.c \
|
third_party/nanopb/pb_common.c \
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
# Minimum CMake required
|
||||||
|
cmake_minimum_required(VERSION 2.8)
|
||||||
|
|
||||||
|
# Project
|
||||||
|
project(HelloWorld CXX)
|
||||||
|
|
||||||
|
# Protobuf
|
||||||
|
set(protobuf_MODULE_COMPATIBLE TRUE)
|
||||||
|
find_package(protobuf CONFIG REQUIRED)
|
||||||
|
message(STATUS "Using protobuf ${protobuf_VERSION}")
|
||||||
|
|
||||||
|
# gRPC
|
||||||
|
find_package(gRPC CONFIG REQUIRED)
|
||||||
|
message(STATUS "Using gRPC ${gRPC_VERSION}")
|
||||||
|
|
||||||
|
# gRPC C++ plugin
|
||||||
|
get_target_property(gRPC_CPP_PLUGIN_EXECUTABLE gRPC::grpc_cpp_plugin
|
||||||
|
IMPORTED_LOCATION_RELEASE)
|
||||||
|
|
||||||
|
# Proto file
|
||||||
|
get_filename_component(hw_proto "../../protos/helloworld.proto" ABSOLUTE)
|
||||||
|
get_filename_component(hw_proto_path "${hw_proto}" PATH)
|
||||||
|
|
||||||
|
# Generated sources
|
||||||
|
protobuf_generate_cpp(hw_proto_srcs hw_proto_hdrs "${hw_proto}")
|
||||||
|
set(hw_grpc_srcs "${CMAKE_CURRENT_BINARY_DIR}/helloworld.grpc.pb.cc")
|
||||||
|
set(hw_grpc_hdrs "${CMAKE_CURRENT_BINARY_DIR}/helloworld.grpc.pb.h")
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT "${hw_grpc_srcs}" "${hw_grpc_hdrs}"
|
||||||
|
COMMAND protobuf::protoc
|
||||||
|
ARGS --grpc_out "${CMAKE_CURRENT_BINARY_DIR}" -I "${hw_proto_path}"
|
||||||
|
--plugin=protoc-gen-grpc="${gRPC_CPP_PLUGIN_EXECUTABLE}"
|
||||||
|
"${hw_proto}"
|
||||||
|
DEPENDS "${hw_proto}")
|
||||||
|
|
||||||
|
# Generated include directory
|
||||||
|
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
|
||||||
|
|
||||||
|
# Targets greeter_[async_](client|server)
|
||||||
|
foreach(_target
|
||||||
|
greeter_client greeter_server
|
||||||
|
greeter_async_client greeter_async_server)
|
||||||
|
add_executable(${_target} "${_target}.cc"
|
||||||
|
${hw_proto_srcs}
|
||||||
|
${hw_grpc_srcs})
|
||||||
|
target_link_libraries(${_target}
|
||||||
|
protobuf::libprotobuf
|
||||||
|
gRPC::grpc++_unsecure)
|
||||||
|
endforeach()
|
||||||
|
|
@ -2,9 +2,39 @@
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
|
<key>AD_UNIT_ID_FOR_BANNER_TEST</key>
|
||||||
|
<string>redacted</string>
|
||||||
|
<key>AD_UNIT_ID_FOR_INTERSTITIAL_TEST</key>
|
||||||
|
<string>redacted</string>
|
||||||
<key>CLIENT_ID</key>
|
<key>CLIENT_ID</key>
|
||||||
<string>15087385131-lh9bpkiai9nls53uadju0if6k7un3uih.apps.googleusercontent.com</string>
|
<string>15087385131-lh9bpkiai9nls53uadju0if6k7un3uih.apps.googleusercontent.com</string>
|
||||||
<key>REVERSED_CLIENT_ID</key>
|
<key>REVERSED_CLIENT_ID</key>
|
||||||
<string>com.googleusercontent.apps.15087385131-lh9bpkiai9nls53uadju0if6k7un3uih</string>
|
<string>com.googleusercontent.apps.15087385131-lh9bpkiai9nls53uadju0if6k7un3uih</string>
|
||||||
|
<key>API_KEY</key>
|
||||||
|
<string>redacted</string>
|
||||||
|
<key>GCM_SENDER_ID</key>
|
||||||
|
<string>redacted</string>
|
||||||
|
<key>PLIST_VERSION</key>
|
||||||
|
<string>1</string>
|
||||||
|
<key>BUNDLE_ID</key>
|
||||||
|
<string>io.grpc.AuthSample</string>
|
||||||
|
<key>PROJECT_ID</key>
|
||||||
|
<string>grpc-authsample</string>
|
||||||
|
<key>STORAGE_BUCKET</key>
|
||||||
|
<string>grpc-authsample.appspot.com</string>
|
||||||
|
<key>IS_ADS_ENABLED</key>
|
||||||
|
<false/>
|
||||||
|
<key>IS_ANALYTICS_ENABLED</key>
|
||||||
|
<false/>
|
||||||
|
<key>IS_APPINVITE_ENABLED</key>
|
||||||
|
<false/>
|
||||||
|
<key>IS_GCM_ENABLED</key>
|
||||||
|
<false/>
|
||||||
|
<key>IS_SIGNIN_ENABLED</key>
|
||||||
|
<true/>
|
||||||
|
<key>GOOGLE_APP_ID</key>
|
||||||
|
<string>1:15087385131:ios:d547168abe3c362f</string>
|
||||||
|
<key>DATABASE_URL</key>
|
||||||
|
<string>https://grpc-authsample.firebaseio.com</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|
|
||||||
|
|
@ -386,6 +386,7 @@ Pod::Spec.new do |s|
|
||||||
'src/core/ext/client_config/subchannel_call_holder.h',
|
'src/core/ext/client_config/subchannel_call_holder.h',
|
||||||
'src/core/ext/client_config/subchannel_index.h',
|
'src/core/ext/client_config/subchannel_index.h',
|
||||||
'src/core/ext/client_config/uri_parser.h',
|
'src/core/ext/client_config/uri_parser.h',
|
||||||
|
'src/core/ext/lb_policy/grpclb/grpclb.h',
|
||||||
'src/core/ext/lb_policy/grpclb/load_balancer_api.h',
|
'src/core/ext/lb_policy/grpclb/load_balancer_api.h',
|
||||||
'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h',
|
'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h',
|
||||||
'third_party/nanopb/pb.h',
|
'third_party/nanopb/pb.h',
|
||||||
|
|
@ -566,6 +567,7 @@ Pod::Spec.new do |s|
|
||||||
'src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c',
|
'src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c',
|
||||||
'src/core/ext/transport/chttp2/client/insecure/channel_create.c',
|
'src/core/ext/transport/chttp2/client/insecure/channel_create.c',
|
||||||
'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c',
|
'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c',
|
||||||
|
'src/core/ext/lb_policy/grpclb/grpclb.c',
|
||||||
'src/core/ext/lb_policy/grpclb/load_balancer_api.c',
|
'src/core/ext/lb_policy/grpclb/load_balancer_api.c',
|
||||||
'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c',
|
'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c',
|
||||||
'third_party/nanopb/pb_common.c',
|
'third_party/nanopb/pb_common.c',
|
||||||
|
|
@ -741,6 +743,7 @@ Pod::Spec.new do |s|
|
||||||
'src/core/ext/client_config/subchannel_call_holder.h',
|
'src/core/ext/client_config/subchannel_call_holder.h',
|
||||||
'src/core/ext/client_config/subchannel_index.h',
|
'src/core/ext/client_config/subchannel_index.h',
|
||||||
'src/core/ext/client_config/uri_parser.h',
|
'src/core/ext/client_config/uri_parser.h',
|
||||||
|
'src/core/ext/lb_policy/grpclb/grpclb.h',
|
||||||
'src/core/ext/lb_policy/grpclb/load_balancer_api.h',
|
'src/core/ext/lb_policy/grpclb/load_balancer_api.h',
|
||||||
'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h',
|
'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h',
|
||||||
'third_party/nanopb/pb.h',
|
'third_party/nanopb/pb.h',
|
||||||
|
|
|
||||||
|
|
@ -305,6 +305,7 @@ Gem::Specification.new do |s|
|
||||||
s.files += %w( src/core/ext/client_config/subchannel_call_holder.h )
|
s.files += %w( src/core/ext/client_config/subchannel_call_holder.h )
|
||||||
s.files += %w( src/core/ext/client_config/subchannel_index.h )
|
s.files += %w( src/core/ext/client_config/subchannel_index.h )
|
||||||
s.files += %w( src/core/ext/client_config/uri_parser.h )
|
s.files += %w( src/core/ext/client_config/uri_parser.h )
|
||||||
|
s.files += %w( src/core/ext/lb_policy/grpclb/grpclb.h )
|
||||||
s.files += %w( src/core/ext/lb_policy/grpclb/load_balancer_api.h )
|
s.files += %w( src/core/ext/lb_policy/grpclb/load_balancer_api.h )
|
||||||
s.files += %w( src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h )
|
s.files += %w( src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h )
|
||||||
s.files += %w( third_party/nanopb/pb.h )
|
s.files += %w( third_party/nanopb/pb.h )
|
||||||
|
|
@ -485,6 +486,7 @@ Gem::Specification.new do |s|
|
||||||
s.files += %w( src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c )
|
s.files += %w( src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c )
|
||||||
s.files += %w( src/core/ext/transport/chttp2/client/insecure/channel_create.c )
|
s.files += %w( src/core/ext/transport/chttp2/client/insecure/channel_create.c )
|
||||||
s.files += %w( src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c )
|
s.files += %w( src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c )
|
||||||
|
s.files += %w( src/core/ext/lb_policy/grpclb/grpclb.c )
|
||||||
s.files += %w( src/core/ext/lb_policy/grpclb/load_balancer_api.c )
|
s.files += %w( src/core/ext/lb_policy/grpclb/load_balancer_api.c )
|
||||||
s.files += %w( src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c )
|
s.files += %w( src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c )
|
||||||
s.files += %w( third_party/nanopb/pb_common.c )
|
s.files += %w( third_party/nanopb/pb_common.c )
|
||||||
|
|
|
||||||
|
|
@ -330,6 +330,9 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncReaderInterface<W, R> {
|
||||||
meta_ops_.set_output_tag(tag);
|
meta_ops_.set_output_tag(tag);
|
||||||
meta_ops_.SendInitialMetadata(ctx_->initial_metadata_,
|
meta_ops_.SendInitialMetadata(ctx_->initial_metadata_,
|
||||||
ctx_->initial_metadata_flags());
|
ctx_->initial_metadata_flags());
|
||||||
|
if (ctx_->compression_level_set()) {
|
||||||
|
meta_ops_.set_compression_level(ctx_->compression_level());
|
||||||
|
}
|
||||||
ctx_->sent_initial_metadata_ = true;
|
ctx_->sent_initial_metadata_ = true;
|
||||||
call_.PerformOps(&meta_ops_);
|
call_.PerformOps(&meta_ops_);
|
||||||
}
|
}
|
||||||
|
|
@ -345,6 +348,9 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncReaderInterface<W, R> {
|
||||||
if (!ctx_->sent_initial_metadata_) {
|
if (!ctx_->sent_initial_metadata_) {
|
||||||
finish_ops_.SendInitialMetadata(ctx_->initial_metadata_,
|
finish_ops_.SendInitialMetadata(ctx_->initial_metadata_,
|
||||||
ctx_->initial_metadata_flags());
|
ctx_->initial_metadata_flags());
|
||||||
|
if (ctx_->compression_level_set()) {
|
||||||
|
finish_ops_.set_compression_level(ctx_->compression_level());
|
||||||
|
}
|
||||||
ctx_->sent_initial_metadata_ = true;
|
ctx_->sent_initial_metadata_ = true;
|
||||||
}
|
}
|
||||||
// The response is dropped if the status is not OK.
|
// The response is dropped if the status is not OK.
|
||||||
|
|
@ -363,6 +369,9 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncReaderInterface<W, R> {
|
||||||
if (!ctx_->sent_initial_metadata_) {
|
if (!ctx_->sent_initial_metadata_) {
|
||||||
finish_ops_.SendInitialMetadata(ctx_->initial_metadata_,
|
finish_ops_.SendInitialMetadata(ctx_->initial_metadata_,
|
||||||
ctx_->initial_metadata_flags());
|
ctx_->initial_metadata_flags());
|
||||||
|
if (ctx_->compression_level_set()) {
|
||||||
|
finish_ops_.set_compression_level(ctx_->compression_level());
|
||||||
|
}
|
||||||
ctx_->sent_initial_metadata_ = true;
|
ctx_->sent_initial_metadata_ = true;
|
||||||
}
|
}
|
||||||
finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, status);
|
finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, status);
|
||||||
|
|
@ -400,6 +409,9 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncWriterInterface<W> {
|
||||||
meta_ops_.set_output_tag(tag);
|
meta_ops_.set_output_tag(tag);
|
||||||
meta_ops_.SendInitialMetadata(ctx_->initial_metadata_,
|
meta_ops_.SendInitialMetadata(ctx_->initial_metadata_,
|
||||||
ctx_->initial_metadata_flags());
|
ctx_->initial_metadata_flags());
|
||||||
|
if (ctx_->compression_level_set()) {
|
||||||
|
meta_ops_.set_compression_level(ctx_->compression_level());
|
||||||
|
}
|
||||||
ctx_->sent_initial_metadata_ = true;
|
ctx_->sent_initial_metadata_ = true;
|
||||||
call_.PerformOps(&meta_ops_);
|
call_.PerformOps(&meta_ops_);
|
||||||
}
|
}
|
||||||
|
|
@ -409,6 +421,9 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncWriterInterface<W> {
|
||||||
if (!ctx_->sent_initial_metadata_) {
|
if (!ctx_->sent_initial_metadata_) {
|
||||||
write_ops_.SendInitialMetadata(ctx_->initial_metadata_,
|
write_ops_.SendInitialMetadata(ctx_->initial_metadata_,
|
||||||
ctx_->initial_metadata_flags());
|
ctx_->initial_metadata_flags());
|
||||||
|
if (ctx_->compression_level_set()) {
|
||||||
|
write_ops_.set_compression_level(ctx_->compression_level());
|
||||||
|
}
|
||||||
ctx_->sent_initial_metadata_ = true;
|
ctx_->sent_initial_metadata_ = true;
|
||||||
}
|
}
|
||||||
// TODO(ctiller): don't assert
|
// TODO(ctiller): don't assert
|
||||||
|
|
@ -421,6 +436,9 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncWriterInterface<W> {
|
||||||
if (!ctx_->sent_initial_metadata_) {
|
if (!ctx_->sent_initial_metadata_) {
|
||||||
finish_ops_.SendInitialMetadata(ctx_->initial_metadata_,
|
finish_ops_.SendInitialMetadata(ctx_->initial_metadata_,
|
||||||
ctx_->initial_metadata_flags());
|
ctx_->initial_metadata_flags());
|
||||||
|
if (ctx_->compression_level_set()) {
|
||||||
|
finish_ops_.set_compression_level(ctx_->compression_level());
|
||||||
|
}
|
||||||
ctx_->sent_initial_metadata_ = true;
|
ctx_->sent_initial_metadata_ = true;
|
||||||
}
|
}
|
||||||
finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, status);
|
finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, status);
|
||||||
|
|
@ -459,6 +477,9 @@ class ServerAsyncReaderWriter GRPC_FINAL
|
||||||
meta_ops_.set_output_tag(tag);
|
meta_ops_.set_output_tag(tag);
|
||||||
meta_ops_.SendInitialMetadata(ctx_->initial_metadata_,
|
meta_ops_.SendInitialMetadata(ctx_->initial_metadata_,
|
||||||
ctx_->initial_metadata_flags());
|
ctx_->initial_metadata_flags());
|
||||||
|
if (ctx_->compression_level_set()) {
|
||||||
|
meta_ops_.set_compression_level(ctx_->compression_level());
|
||||||
|
}
|
||||||
ctx_->sent_initial_metadata_ = true;
|
ctx_->sent_initial_metadata_ = true;
|
||||||
call_.PerformOps(&meta_ops_);
|
call_.PerformOps(&meta_ops_);
|
||||||
}
|
}
|
||||||
|
|
@ -474,6 +495,9 @@ class ServerAsyncReaderWriter GRPC_FINAL
|
||||||
if (!ctx_->sent_initial_metadata_) {
|
if (!ctx_->sent_initial_metadata_) {
|
||||||
write_ops_.SendInitialMetadata(ctx_->initial_metadata_,
|
write_ops_.SendInitialMetadata(ctx_->initial_metadata_,
|
||||||
ctx_->initial_metadata_flags());
|
ctx_->initial_metadata_flags());
|
||||||
|
if (ctx_->compression_level_set()) {
|
||||||
|
write_ops_.set_compression_level(ctx_->compression_level());
|
||||||
|
}
|
||||||
ctx_->sent_initial_metadata_ = true;
|
ctx_->sent_initial_metadata_ = true;
|
||||||
}
|
}
|
||||||
// TODO(ctiller): don't assert
|
// TODO(ctiller): don't assert
|
||||||
|
|
@ -486,6 +510,9 @@ class ServerAsyncReaderWriter GRPC_FINAL
|
||||||
if (!ctx_->sent_initial_metadata_) {
|
if (!ctx_->sent_initial_metadata_) {
|
||||||
finish_ops_.SendInitialMetadata(ctx_->initial_metadata_,
|
finish_ops_.SendInitialMetadata(ctx_->initial_metadata_,
|
||||||
ctx_->initial_metadata_flags());
|
ctx_->initial_metadata_flags());
|
||||||
|
if (ctx_->compression_level_set()) {
|
||||||
|
finish_ops_.set_compression_level(ctx_->compression_level());
|
||||||
|
}
|
||||||
ctx_->sent_initial_metadata_ = true;
|
ctx_->sent_initial_metadata_ = true;
|
||||||
}
|
}
|
||||||
finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, status);
|
finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, status);
|
||||||
|
|
|
||||||
|
|
@ -125,6 +125,9 @@ class ServerAsyncResponseWriter GRPC_FINAL
|
||||||
meta_buf_.set_output_tag(tag);
|
meta_buf_.set_output_tag(tag);
|
||||||
meta_buf_.SendInitialMetadata(ctx_->initial_metadata_,
|
meta_buf_.SendInitialMetadata(ctx_->initial_metadata_,
|
||||||
ctx_->initial_metadata_flags());
|
ctx_->initial_metadata_flags());
|
||||||
|
if (ctx_->compression_level_set()) {
|
||||||
|
meta_buf_.set_compression_level(ctx_->compression_level());
|
||||||
|
}
|
||||||
ctx_->sent_initial_metadata_ = true;
|
ctx_->sent_initial_metadata_ = true;
|
||||||
call_.PerformOps(&meta_buf_);
|
call_.PerformOps(&meta_buf_);
|
||||||
}
|
}
|
||||||
|
|
@ -134,6 +137,9 @@ class ServerAsyncResponseWriter GRPC_FINAL
|
||||||
if (!ctx_->sent_initial_metadata_) {
|
if (!ctx_->sent_initial_metadata_) {
|
||||||
finish_buf_.SendInitialMetadata(ctx_->initial_metadata_,
|
finish_buf_.SendInitialMetadata(ctx_->initial_metadata_,
|
||||||
ctx_->initial_metadata_flags());
|
ctx_->initial_metadata_flags());
|
||||||
|
if (ctx_->compression_level_set()) {
|
||||||
|
finish_buf_.set_compression_level(ctx_->compression_level());
|
||||||
|
}
|
||||||
ctx_->sent_initial_metadata_ = true;
|
ctx_->sent_initial_metadata_ = true;
|
||||||
}
|
}
|
||||||
// The response is dropped if the status is not OK.
|
// The response is dropped if the status is not OK.
|
||||||
|
|
@ -152,6 +158,9 @@ class ServerAsyncResponseWriter GRPC_FINAL
|
||||||
if (!ctx_->sent_initial_metadata_) {
|
if (!ctx_->sent_initial_metadata_) {
|
||||||
finish_buf_.SendInitialMetadata(ctx_->initial_metadata_,
|
finish_buf_.SendInitialMetadata(ctx_->initial_metadata_,
|
||||||
ctx_->initial_metadata_flags());
|
ctx_->initial_metadata_flags());
|
||||||
|
if (ctx_->compression_level_set()) {
|
||||||
|
finish_buf_.set_compression_level(ctx_->compression_level());
|
||||||
|
}
|
||||||
ctx_->sent_initial_metadata_ = true;
|
ctx_->sent_initial_metadata_ = true;
|
||||||
}
|
}
|
||||||
finish_buf_.ServerSendStatus(ctx_->trailing_metadata_, status);
|
finish_buf_.ServerSendStatus(ctx_->trailing_metadata_, status);
|
||||||
|
|
|
||||||
|
|
@ -179,17 +179,23 @@ class CallNoOp {
|
||||||
|
|
||||||
class CallOpSendInitialMetadata {
|
class CallOpSendInitialMetadata {
|
||||||
public:
|
public:
|
||||||
CallOpSendInitialMetadata() : send_(false) {}
|
CallOpSendInitialMetadata() : send_(false) {
|
||||||
|
maybe_compression_level_.is_set = false;
|
||||||
|
}
|
||||||
|
|
||||||
void SendInitialMetadata(
|
void SendInitialMetadata(
|
||||||
const std::multimap<grpc::string, grpc::string>& metadata,
|
const std::multimap<grpc::string, grpc::string>& metadata,
|
||||||
uint32_t flags) {
|
uint32_t flags) {
|
||||||
|
maybe_compression_level_.is_set = false;
|
||||||
send_ = true;
|
send_ = true;
|
||||||
flags_ = flags;
|
flags_ = flags;
|
||||||
initial_metadata_count_ = metadata.size();
|
initial_metadata_count_ = metadata.size();
|
||||||
initial_metadata_ = FillMetadataArray(metadata);
|
initial_metadata_ = FillMetadataArray(metadata);
|
||||||
// TODO(dgq): expose compression level in API so it can be properly set.
|
}
|
||||||
maybe_compression_level_.is_set = false;
|
|
||||||
|
void set_compression_level(grpc_compression_level level) {
|
||||||
|
maybe_compression_level_.is_set = true;
|
||||||
|
maybe_compression_level_.level = level;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,9 @@ class RpcMethodHandler : public MethodHandler {
|
||||||
ops;
|
ops;
|
||||||
ops.SendInitialMetadata(param.server_context->initial_metadata_,
|
ops.SendInitialMetadata(param.server_context->initial_metadata_,
|
||||||
param.server_context->initial_metadata_flags());
|
param.server_context->initial_metadata_flags());
|
||||||
|
if (param.server_context->compression_level_set()) {
|
||||||
|
ops.set_compression_level(param.server_context->compression_level());
|
||||||
|
}
|
||||||
if (status.ok()) {
|
if (status.ok()) {
|
||||||
status = ops.SendMessage(rsp);
|
status = ops.SendMessage(rsp);
|
||||||
}
|
}
|
||||||
|
|
@ -104,6 +107,9 @@ class ClientStreamingHandler : public MethodHandler {
|
||||||
ops;
|
ops;
|
||||||
ops.SendInitialMetadata(param.server_context->initial_metadata_,
|
ops.SendInitialMetadata(param.server_context->initial_metadata_,
|
||||||
param.server_context->initial_metadata_flags());
|
param.server_context->initial_metadata_flags());
|
||||||
|
if (param.server_context->compression_level_set()) {
|
||||||
|
ops.set_compression_level(param.server_context->compression_level());
|
||||||
|
}
|
||||||
if (status.ok()) {
|
if (status.ok()) {
|
||||||
status = ops.SendMessage(rsp);
|
status = ops.SendMessage(rsp);
|
||||||
}
|
}
|
||||||
|
|
@ -144,6 +150,9 @@ class ServerStreamingHandler : public MethodHandler {
|
||||||
if (!param.server_context->sent_initial_metadata_) {
|
if (!param.server_context->sent_initial_metadata_) {
|
||||||
ops.SendInitialMetadata(param.server_context->initial_metadata_,
|
ops.SendInitialMetadata(param.server_context->initial_metadata_,
|
||||||
param.server_context->initial_metadata_flags());
|
param.server_context->initial_metadata_flags());
|
||||||
|
if (param.server_context->compression_level_set()) {
|
||||||
|
ops.set_compression_level(param.server_context->compression_level());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ops.ServerSendStatus(param.server_context->trailing_metadata_, status);
|
ops.ServerSendStatus(param.server_context->trailing_metadata_, status);
|
||||||
param.call->PerformOps(&ops);
|
param.call->PerformOps(&ops);
|
||||||
|
|
@ -177,6 +186,9 @@ class BidiStreamingHandler : public MethodHandler {
|
||||||
if (!param.server_context->sent_initial_metadata_) {
|
if (!param.server_context->sent_initial_metadata_) {
|
||||||
ops.SendInitialMetadata(param.server_context->initial_metadata_,
|
ops.SendInitialMetadata(param.server_context->initial_metadata_,
|
||||||
param.server_context->initial_metadata_flags());
|
param.server_context->initial_metadata_flags());
|
||||||
|
if (param.server_context->compression_level_set()) {
|
||||||
|
ops.set_compression_level(param.server_context->compression_level());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ops.ServerSendStatus(param.server_context->trailing_metadata_, status);
|
ops.ServerSendStatus(param.server_context->trailing_metadata_, status);
|
||||||
param.call->PerformOps(&ops);
|
param.call->PerformOps(&ops);
|
||||||
|
|
@ -199,6 +211,9 @@ class UnknownMethodHandler : public MethodHandler {
|
||||||
if (!context->sent_initial_metadata_) {
|
if (!context->sent_initial_metadata_) {
|
||||||
ops->SendInitialMetadata(context->initial_metadata_,
|
ops->SendInitialMetadata(context->initial_metadata_,
|
||||||
context->initial_metadata_flags());
|
context->initial_metadata_flags());
|
||||||
|
if (context->compression_level_set()) {
|
||||||
|
ops->set_compression_level(context->compression_level());
|
||||||
|
}
|
||||||
context->sent_initial_metadata_ = true;
|
context->sent_initial_metadata_ = true;
|
||||||
}
|
}
|
||||||
ops->ServerSendStatus(context->trailing_metadata_, status);
|
ops->ServerSendStatus(context->trailing_metadata_, status);
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,13 @@ class ServerContext {
|
||||||
grpc_compression_level compression_level() const {
|
grpc_compression_level compression_level() const {
|
||||||
return compression_level_;
|
return compression_level_;
|
||||||
}
|
}
|
||||||
void set_compression_level(grpc_compression_level level);
|
|
||||||
|
void set_compression_level(grpc_compression_level level) {
|
||||||
|
compression_level_set_ = true;
|
||||||
|
compression_level_ = level;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool compression_level_set() const { return compression_level_set_; }
|
||||||
|
|
||||||
grpc_compression_algorithm compression_algorithm() const {
|
grpc_compression_algorithm compression_algorithm() const {
|
||||||
return compression_algorithm_;
|
return compression_algorithm_;
|
||||||
|
|
@ -216,6 +222,7 @@ class ServerContext {
|
||||||
std::multimap<grpc::string, grpc::string> initial_metadata_;
|
std::multimap<grpc::string, grpc::string> initial_metadata_;
|
||||||
std::multimap<grpc::string, grpc::string> trailing_metadata_;
|
std::multimap<grpc::string, grpc::string> trailing_metadata_;
|
||||||
|
|
||||||
|
bool compression_level_set_;
|
||||||
grpc_compression_level compression_level_;
|
grpc_compression_level compression_level_;
|
||||||
grpc_compression_algorithm compression_algorithm_;
|
grpc_compression_algorithm compression_algorithm_;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -346,6 +346,9 @@ class ServerReader GRPC_FINAL : public ReaderInterface<R> {
|
||||||
CallOpSet<CallOpSendInitialMetadata> ops;
|
CallOpSet<CallOpSendInitialMetadata> ops;
|
||||||
ops.SendInitialMetadata(ctx_->initial_metadata_,
|
ops.SendInitialMetadata(ctx_->initial_metadata_,
|
||||||
ctx_->initial_metadata_flags());
|
ctx_->initial_metadata_flags());
|
||||||
|
if (ctx_->compression_level_set()) {
|
||||||
|
ops.set_compression_level(ctx_->compression_level());
|
||||||
|
}
|
||||||
ctx_->sent_initial_metadata_ = true;
|
ctx_->sent_initial_metadata_ = true;
|
||||||
call_->PerformOps(&ops);
|
call_->PerformOps(&ops);
|
||||||
call_->cq()->Pluck(&ops);
|
call_->cq()->Pluck(&ops);
|
||||||
|
|
@ -374,6 +377,9 @@ class ServerWriter GRPC_FINAL : public WriterInterface<W> {
|
||||||
CallOpSet<CallOpSendInitialMetadata> ops;
|
CallOpSet<CallOpSendInitialMetadata> ops;
|
||||||
ops.SendInitialMetadata(ctx_->initial_metadata_,
|
ops.SendInitialMetadata(ctx_->initial_metadata_,
|
||||||
ctx_->initial_metadata_flags());
|
ctx_->initial_metadata_flags());
|
||||||
|
if (ctx_->compression_level_set()) {
|
||||||
|
ops.set_compression_level(ctx_->compression_level());
|
||||||
|
}
|
||||||
ctx_->sent_initial_metadata_ = true;
|
ctx_->sent_initial_metadata_ = true;
|
||||||
call_->PerformOps(&ops);
|
call_->PerformOps(&ops);
|
||||||
call_->cq()->Pluck(&ops);
|
call_->cq()->Pluck(&ops);
|
||||||
|
|
@ -388,6 +394,9 @@ class ServerWriter GRPC_FINAL : public WriterInterface<W> {
|
||||||
if (!ctx_->sent_initial_metadata_) {
|
if (!ctx_->sent_initial_metadata_) {
|
||||||
ops.SendInitialMetadata(ctx_->initial_metadata_,
|
ops.SendInitialMetadata(ctx_->initial_metadata_,
|
||||||
ctx_->initial_metadata_flags());
|
ctx_->initial_metadata_flags());
|
||||||
|
if (ctx_->compression_level_set()) {
|
||||||
|
ops.set_compression_level(ctx_->compression_level());
|
||||||
|
}
|
||||||
ctx_->sent_initial_metadata_ = true;
|
ctx_->sent_initial_metadata_ = true;
|
||||||
}
|
}
|
||||||
call_->PerformOps(&ops);
|
call_->PerformOps(&ops);
|
||||||
|
|
@ -412,6 +421,9 @@ class ServerReaderWriter GRPC_FINAL : public WriterInterface<W>,
|
||||||
CallOpSet<CallOpSendInitialMetadata> ops;
|
CallOpSet<CallOpSendInitialMetadata> ops;
|
||||||
ops.SendInitialMetadata(ctx_->initial_metadata_,
|
ops.SendInitialMetadata(ctx_->initial_metadata_,
|
||||||
ctx_->initial_metadata_flags());
|
ctx_->initial_metadata_flags());
|
||||||
|
if (ctx_->compression_level_set()) {
|
||||||
|
ops.set_compression_level(ctx_->compression_level());
|
||||||
|
}
|
||||||
ctx_->sent_initial_metadata_ = true;
|
ctx_->sent_initial_metadata_ = true;
|
||||||
call_->PerformOps(&ops);
|
call_->PerformOps(&ops);
|
||||||
call_->cq()->Pluck(&ops);
|
call_->cq()->Pluck(&ops);
|
||||||
|
|
@ -433,6 +445,9 @@ class ServerReaderWriter GRPC_FINAL : public WriterInterface<W>,
|
||||||
if (!ctx_->sent_initial_metadata_) {
|
if (!ctx_->sent_initial_metadata_) {
|
||||||
ops.SendInitialMetadata(ctx_->initial_metadata_,
|
ops.SendInitialMetadata(ctx_->initial_metadata_,
|
||||||
ctx_->initial_metadata_flags());
|
ctx_->initial_metadata_flags());
|
||||||
|
if (ctx_->compression_level_set()) {
|
||||||
|
ops.set_compression_level(ctx_->compression_level());
|
||||||
|
}
|
||||||
ctx_->sent_initial_metadata_ = true;
|
ctx_->sent_initial_metadata_ = true;
|
||||||
}
|
}
|
||||||
call_->PerformOps(&ops);
|
call_->PerformOps(&ops);
|
||||||
|
|
|
||||||
21
package.xml
21
package.xml
|
|
@ -10,7 +10,7 @@
|
||||||
<email>grpc-packages@google.com</email>
|
<email>grpc-packages@google.com</email>
|
||||||
<active>yes</active>
|
<active>yes</active>
|
||||||
</lead>
|
</lead>
|
||||||
<date>2016-07-21</date>
|
<date>2016-07-28</date>
|
||||||
<time>16:06:07</time>
|
<time>16:06:07</time>
|
||||||
<version>
|
<version>
|
||||||
<release>1.1.0</release>
|
<release>1.1.0</release>
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
</stability>
|
</stability>
|
||||||
<license>BSD</license>
|
<license>BSD</license>
|
||||||
<notes>
|
<notes>
|
||||||
- PHP7 Support #7464
|
- PHP7 Support continued, reduce code duplication #7543
|
||||||
</notes>
|
</notes>
|
||||||
<contents>
|
<contents>
|
||||||
<dir baseinstalldir="/" name="/">
|
<dir baseinstalldir="/" name="/">
|
||||||
|
|
@ -313,6 +313,7 @@
|
||||||
<file baseinstalldir="/" name="src/core/ext/client_config/subchannel_call_holder.h" role="src" />
|
<file baseinstalldir="/" name="src/core/ext/client_config/subchannel_call_holder.h" role="src" />
|
||||||
<file baseinstalldir="/" name="src/core/ext/client_config/subchannel_index.h" role="src" />
|
<file baseinstalldir="/" name="src/core/ext/client_config/subchannel_index.h" role="src" />
|
||||||
<file baseinstalldir="/" name="src/core/ext/client_config/uri_parser.h" role="src" />
|
<file baseinstalldir="/" name="src/core/ext/client_config/uri_parser.h" role="src" />
|
||||||
|
<file baseinstalldir="/" name="src/core/ext/lb_policy/grpclb/grpclb.h" role="src" />
|
||||||
<file baseinstalldir="/" name="src/core/ext/lb_policy/grpclb/load_balancer_api.h" role="src" />
|
<file baseinstalldir="/" name="src/core/ext/lb_policy/grpclb/load_balancer_api.h" role="src" />
|
||||||
<file baseinstalldir="/" name="src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h" role="src" />
|
<file baseinstalldir="/" name="src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h" role="src" />
|
||||||
<file baseinstalldir="/" name="third_party/nanopb/pb.h" role="src" />
|
<file baseinstalldir="/" name="third_party/nanopb/pb.h" role="src" />
|
||||||
|
|
@ -493,6 +494,7 @@
|
||||||
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c" role="src" />
|
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c" role="src" />
|
||||||
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/client/insecure/channel_create.c" role="src" />
|
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/client/insecure/channel_create.c" role="src" />
|
||||||
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c" role="src" />
|
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c" role="src" />
|
||||||
|
<file baseinstalldir="/" name="src/core/ext/lb_policy/grpclb/grpclb.c" role="src" />
|
||||||
<file baseinstalldir="/" name="src/core/ext/lb_policy/grpclb/load_balancer_api.c" role="src" />
|
<file baseinstalldir="/" name="src/core/ext/lb_policy/grpclb/load_balancer_api.c" role="src" />
|
||||||
<file baseinstalldir="/" name="src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c" role="src" />
|
<file baseinstalldir="/" name="src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c" role="src" />
|
||||||
<file baseinstalldir="/" name="third_party/nanopb/pb_common.c" role="src" />
|
<file baseinstalldir="/" name="third_party/nanopb/pb_common.c" role="src" />
|
||||||
|
|
@ -1111,5 +1113,20 @@ Update to wrap gRPC C Core version 0.10.0
|
||||||
- PHP7 Support #7464
|
- PHP7 Support #7464
|
||||||
</notes>
|
</notes>
|
||||||
</release>
|
</release>
|
||||||
|
<release>
|
||||||
|
<version>
|
||||||
|
<release>1.0.0RC3</release>
|
||||||
|
<api>1.0.0RC3</api>
|
||||||
|
</version>
|
||||||
|
<stability>
|
||||||
|
<release>stable</release>
|
||||||
|
<api>stable</api>
|
||||||
|
</stability>
|
||||||
|
<date>2016-07-28</date>
|
||||||
|
<license>BSD</license>
|
||||||
|
<notes>
|
||||||
|
- PHP7 Support continued, reduce code duplication #7543
|
||||||
|
</notes>
|
||||||
|
</release>
|
||||||
</changelog>
|
</changelog>
|
||||||
</package>
|
</package>
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ inline bool ServicesFilename(const grpc::protobuf::FileDescriptor *file,
|
||||||
file->name().find_last_of(".proto") == file->name().size() - 1) {
|
file->name().find_last_of(".proto") == file->name().size() - 1) {
|
||||||
*file_name_or_error =
|
*file_name_or_error =
|
||||||
file->name().substr(0, file->name().size() - proto_suffix_length) +
|
file->name().substr(0, file->name().size() - proto_suffix_length) +
|
||||||
"_services.rb";
|
"_services_pb.rb";
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
*file_name_or_error = "Invalid proto file name: must end with .proto";
|
*file_name_or_error = "Invalid proto file name: must end with .proto";
|
||||||
|
|
@ -58,7 +58,7 @@ inline bool ServicesFilename(const grpc::protobuf::FileDescriptor *file,
|
||||||
|
|
||||||
inline grpc::string MessagesRequireName(
|
inline grpc::string MessagesRequireName(
|
||||||
const grpc::protobuf::FileDescriptor *file) {
|
const grpc::protobuf::FileDescriptor *file) {
|
||||||
return Replace(file->name(), ".proto", "");
|
return Replace(file->name(), ".proto", "_pb");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get leading or trailing comments in a string. Comment lines start with "# ".
|
// Get leading or trailing comments in a string. Comment lines start with "# ".
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ static void client_init_call_elem(grpc_exec_ctx *exec_ctx,
|
||||||
|
|
||||||
static void client_destroy_call_elem(grpc_exec_ctx *exec_ctx,
|
static void client_destroy_call_elem(grpc_exec_ctx *exec_ctx,
|
||||||
grpc_call_element *elem,
|
grpc_call_element *elem,
|
||||||
const grpc_call_stats *stats,
|
const grpc_call_final_info *final_info,
|
||||||
void *ignored) {
|
void *ignored) {
|
||||||
call_data *d = elem->call_data;
|
call_data *d = elem->call_data;
|
||||||
GPR_ASSERT(d != NULL);
|
GPR_ASSERT(d != NULL);
|
||||||
|
|
@ -158,7 +158,7 @@ static void server_init_call_elem(grpc_exec_ctx *exec_ctx,
|
||||||
|
|
||||||
static void server_destroy_call_elem(grpc_exec_ctx *exec_ctx,
|
static void server_destroy_call_elem(grpc_exec_ctx *exec_ctx,
|
||||||
grpc_call_element *elem,
|
grpc_call_element *elem,
|
||||||
const grpc_call_stats *stats,
|
const grpc_call_final_info *final_info,
|
||||||
void *ignored) {
|
void *ignored) {
|
||||||
call_data *d = elem->call_data;
|
call_data *d = elem->call_data;
|
||||||
GPR_ASSERT(d != NULL);
|
GPR_ASSERT(d != NULL);
|
||||||
|
|
|
||||||
|
|
@ -444,7 +444,7 @@ static void init_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
||||||
|
|
||||||
/* Destructor for call_data */
|
/* Destructor for call_data */
|
||||||
static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
||||||
const grpc_call_stats *stats,
|
const grpc_call_final_info *final_info,
|
||||||
void *and_free_memory) {
|
void *and_free_memory) {
|
||||||
grpc_subchannel_call_holder_destroy(exec_ctx, elem->call_data);
|
grpc_subchannel_call_holder_destroy(exec_ctx, elem->call_data);
|
||||||
gpr_free(and_free_memory);
|
gpr_free(and_free_memory);
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ struct grpc_lb_policy_vtable {
|
||||||
void (*ping_one)(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy,
|
void (*ping_one)(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy,
|
||||||
grpc_closure *closure);
|
grpc_closure *closure);
|
||||||
|
|
||||||
/** try to enter a READY connectivity state */
|
/** Try to enter a READY connectivity state */
|
||||||
void (*exit_idle)(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy);
|
void (*exit_idle)(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy);
|
||||||
|
|
||||||
/** check the current connectivity of the lb_policy */
|
/** check the current connectivity of the lb_policy */
|
||||||
|
|
@ -82,7 +82,9 @@ struct grpc_lb_policy_vtable {
|
||||||
grpc_error **connectivity_error);
|
grpc_error **connectivity_error);
|
||||||
|
|
||||||
/** call notify when the connectivity state of a channel changes from *state.
|
/** call notify when the connectivity state of a channel changes from *state.
|
||||||
Updates *state with the new state of the policy */
|
Updates *state with the new state of the policy. Calling with a NULL \a
|
||||||
|
state cancels the subscription.
|
||||||
|
*/
|
||||||
void (*notify_on_state_change)(grpc_exec_ctx *exec_ctx,
|
void (*notify_on_state_change)(grpc_exec_ctx *exec_ctx,
|
||||||
grpc_lb_policy *policy,
|
grpc_lb_policy *policy,
|
||||||
grpc_connectivity_state *state,
|
grpc_connectivity_state *state,
|
||||||
|
|
@ -125,7 +127,7 @@ void grpc_lb_policy_init(grpc_lb_policy *policy,
|
||||||
/** Given initial metadata in \a initial_metadata, find an appropriate
|
/** Given initial metadata in \a initial_metadata, find an appropriate
|
||||||
target for this rpc, and 'return' it by calling \a on_complete after setting
|
target for this rpc, and 'return' it by calling \a on_complete after setting
|
||||||
\a target.
|
\a target.
|
||||||
Picking can be asynchronous. Any IO should be done under \a pollset. */
|
Picking can be asynchronous. Any IO should be done under \a pollent. */
|
||||||
int grpc_lb_policy_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy,
|
int grpc_lb_policy_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy,
|
||||||
grpc_polling_entity *pollent,
|
grpc_polling_entity *pollent,
|
||||||
grpc_metadata_batch *initial_metadata,
|
grpc_metadata_batch *initial_metadata,
|
||||||
|
|
@ -147,8 +149,11 @@ void grpc_lb_policy_cancel_picks(grpc_exec_ctx *exec_ctx,
|
||||||
uint32_t initial_metadata_flags_mask,
|
uint32_t initial_metadata_flags_mask,
|
||||||
uint32_t initial_metadata_flags_eq);
|
uint32_t initial_metadata_flags_eq);
|
||||||
|
|
||||||
|
/** Try to enter a READY connectivity state */
|
||||||
void grpc_lb_policy_exit_idle(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy);
|
void grpc_lb_policy_exit_idle(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy);
|
||||||
|
|
||||||
|
/* Call notify when the connectivity state of a channel changes from \a *state.
|
||||||
|
* Updates \a *state with the new state of the policy */
|
||||||
void grpc_lb_policy_notify_on_state_change(grpc_exec_ctx *exec_ctx,
|
void grpc_lb_policy_notify_on_state_change(grpc_exec_ctx *exec_ctx,
|
||||||
grpc_lb_policy *policy,
|
grpc_lb_policy *policy,
|
||||||
grpc_connectivity_state *state,
|
grpc_connectivity_state *state,
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,44 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* Copyright 2016, Google Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are
|
||||||
|
* met:
|
||||||
|
*
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above
|
||||||
|
* copyright notice, this list of conditions and the following disclaimer
|
||||||
|
* in the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
* * Neither the name of Google Inc. nor the names of its
|
||||||
|
* contributors may be used to endorse or promote products derived from
|
||||||
|
* this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GRPC_CORE_EXT_LB_POLICY_GRPCLB_GRPCLB_H
|
||||||
|
#define GRPC_CORE_EXT_LB_POLICY_GRPCLB_GRPCLB_H
|
||||||
|
|
||||||
|
#include "src/core/ext/client_config/lb_policy_factory.h"
|
||||||
|
|
||||||
|
/** Returns a load balancing factory for the glb policy, which tries to connect
|
||||||
|
* to a load balancing server to decide the next successfully connected
|
||||||
|
* subchannel to pick. */
|
||||||
|
grpc_lb_policy_factory *grpc_glb_lb_factory_create();
|
||||||
|
|
||||||
|
#endif /* GRPC_CORE_EXT_LB_POLICY_GRPCLB_GRPCLB_H */
|
||||||
|
|
@ -38,9 +38,15 @@
|
||||||
#include <grpc/support/alloc.h>
|
#include <grpc/support/alloc.h>
|
||||||
|
|
||||||
typedef struct decode_serverlist_arg {
|
typedef struct decode_serverlist_arg {
|
||||||
int first_pass;
|
/* The first pass counts the number of servers in the server list. The second
|
||||||
int i;
|
* one allocates and decodes. */
|
||||||
|
bool first_pass;
|
||||||
|
/* The decoding callback is invoked once per server in serverlist. Remember
|
||||||
|
* which index of the serverlist are we currently decoding */
|
||||||
|
size_t decoding_idx;
|
||||||
|
/* Populated after the first pass. Number of server in the input serverlist */
|
||||||
size_t num_servers;
|
size_t num_servers;
|
||||||
|
/* The decoded serverlist */
|
||||||
grpc_grpclb_server **servers;
|
grpc_grpclb_server **servers;
|
||||||
} decode_serverlist_arg;
|
} decode_serverlist_arg;
|
||||||
|
|
||||||
|
|
@ -48,23 +54,24 @@ typedef struct decode_serverlist_arg {
|
||||||
static bool decode_serverlist(pb_istream_t *stream, const pb_field_t *field,
|
static bool decode_serverlist(pb_istream_t *stream, const pb_field_t *field,
|
||||||
void **arg) {
|
void **arg) {
|
||||||
decode_serverlist_arg *dec_arg = *arg;
|
decode_serverlist_arg *dec_arg = *arg;
|
||||||
if (dec_arg->first_pass != 0) { /* first pass */
|
if (dec_arg->first_pass) { /* count how many server do we have */
|
||||||
grpc_grpclb_server server;
|
grpc_grpclb_server server;
|
||||||
if (!pb_decode(stream, grpc_lb_v1_Server_fields, &server)) {
|
if (!pb_decode(stream, grpc_lb_v1_Server_fields, &server)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
dec_arg->num_servers++;
|
dec_arg->num_servers++;
|
||||||
} else { /* second pass */
|
} else { /* second pass. Actually decode. */
|
||||||
grpc_grpclb_server *server = gpr_malloc(sizeof(grpc_grpclb_server));
|
grpc_grpclb_server *server = gpr_malloc(sizeof(grpc_grpclb_server));
|
||||||
|
memset(server, 0, sizeof(grpc_grpclb_server));
|
||||||
GPR_ASSERT(dec_arg->num_servers > 0);
|
GPR_ASSERT(dec_arg->num_servers > 0);
|
||||||
if (dec_arg->i == 0) { /* first iteration of second pass */
|
if (dec_arg->decoding_idx == 0) { /* first iteration of second pass */
|
||||||
dec_arg->servers =
|
dec_arg->servers =
|
||||||
gpr_malloc(sizeof(grpc_grpclb_server *) * dec_arg->num_servers);
|
gpr_malloc(sizeof(grpc_grpclb_server *) * dec_arg->num_servers);
|
||||||
}
|
}
|
||||||
if (!pb_decode(stream, grpc_lb_v1_Server_fields, server)) {
|
if (!pb_decode(stream, grpc_lb_v1_Server_fields, server)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
dec_arg->servers[dec_arg->i++] = server;
|
dec_arg->servers[dec_arg->decoding_idx++] = server;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -102,57 +109,59 @@ void grpc_grpclb_request_destroy(grpc_grpclb_request *request) {
|
||||||
gpr_free(request);
|
gpr_free(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
grpc_grpclb_response *grpc_grpclb_response_parse(gpr_slice encoded_response) {
|
typedef grpc_lb_v1_LoadBalanceResponse grpc_grpclb_response;
|
||||||
bool status;
|
grpc_grpclb_initial_response *grpc_grpclb_initial_response_parse(
|
||||||
|
gpr_slice encoded_grpc_grpclb_response) {
|
||||||
pb_istream_t stream =
|
pb_istream_t stream =
|
||||||
pb_istream_from_buffer(GPR_SLICE_START_PTR(encoded_response),
|
pb_istream_from_buffer(GPR_SLICE_START_PTR(encoded_grpc_grpclb_response),
|
||||||
GPR_SLICE_LENGTH(encoded_response));
|
GPR_SLICE_LENGTH(encoded_grpc_grpclb_response));
|
||||||
grpc_grpclb_response *res = gpr_malloc(sizeof(grpc_grpclb_response));
|
grpc_grpclb_response res;
|
||||||
memset(res, 0, sizeof(*res));
|
memset(&res, 0, sizeof(grpc_grpclb_response));
|
||||||
status = pb_decode(&stream, grpc_lb_v1_LoadBalanceResponse_fields, res);
|
if (!pb_decode(&stream, grpc_lb_v1_LoadBalanceResponse_fields, &res)) {
|
||||||
if (!status) {
|
|
||||||
grpc_grpclb_response_destroy(res);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return res;
|
grpc_grpclb_initial_response *initial_res =
|
||||||
|
gpr_malloc(sizeof(grpc_grpclb_initial_response));
|
||||||
|
memcpy(initial_res, &res.initial_response,
|
||||||
|
sizeof(grpc_grpclb_initial_response));
|
||||||
|
|
||||||
|
return initial_res;
|
||||||
}
|
}
|
||||||
|
|
||||||
grpc_grpclb_serverlist *grpc_grpclb_response_parse_serverlist(
|
grpc_grpclb_serverlist *grpc_grpclb_response_parse_serverlist(
|
||||||
gpr_slice encoded_response) {
|
gpr_slice encoded_grpc_grpclb_response) {
|
||||||
bool status;
|
bool status;
|
||||||
decode_serverlist_arg arg;
|
decode_serverlist_arg arg;
|
||||||
pb_istream_t stream =
|
pb_istream_t stream =
|
||||||
pb_istream_from_buffer(GPR_SLICE_START_PTR(encoded_response),
|
pb_istream_from_buffer(GPR_SLICE_START_PTR(encoded_grpc_grpclb_response),
|
||||||
GPR_SLICE_LENGTH(encoded_response));
|
GPR_SLICE_LENGTH(encoded_grpc_grpclb_response));
|
||||||
pb_istream_t stream_at_start = stream;
|
pb_istream_t stream_at_start = stream;
|
||||||
grpc_grpclb_response *res = gpr_malloc(sizeof(grpc_grpclb_response));
|
grpc_grpclb_response res;
|
||||||
memset(res, 0, sizeof(*res));
|
memset(&res, 0, sizeof(grpc_grpclb_response));
|
||||||
memset(&arg, 0, sizeof(decode_serverlist_arg));
|
memset(&arg, 0, sizeof(decode_serverlist_arg));
|
||||||
|
|
||||||
res->server_list.servers.funcs.decode = decode_serverlist;
|
res.server_list.servers.funcs.decode = decode_serverlist;
|
||||||
res->server_list.servers.arg = &arg;
|
res.server_list.servers.arg = &arg;
|
||||||
arg.first_pass = 1;
|
arg.first_pass = true;
|
||||||
status = pb_decode(&stream, grpc_lb_v1_LoadBalanceResponse_fields, res);
|
status = pb_decode(&stream, grpc_lb_v1_LoadBalanceResponse_fields, &res);
|
||||||
if (!status) {
|
if (!status) {
|
||||||
grpc_grpclb_response_destroy(res);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
arg.first_pass = 0;
|
arg.first_pass = false;
|
||||||
status =
|
status =
|
||||||
pb_decode(&stream_at_start, grpc_lb_v1_LoadBalanceResponse_fields, res);
|
pb_decode(&stream_at_start, grpc_lb_v1_LoadBalanceResponse_fields, &res);
|
||||||
if (!status) {
|
if (!status) {
|
||||||
grpc_grpclb_response_destroy(res);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
grpc_grpclb_serverlist *sl = gpr_malloc(sizeof(grpc_grpclb_serverlist));
|
grpc_grpclb_serverlist *sl = gpr_malloc(sizeof(grpc_grpclb_serverlist));
|
||||||
|
memset(sl, 0, sizeof(*sl));
|
||||||
sl->num_servers = arg.num_servers;
|
sl->num_servers = arg.num_servers;
|
||||||
sl->servers = arg.servers;
|
sl->servers = arg.servers;
|
||||||
if (res->server_list.has_expiration_interval) {
|
if (res.server_list.has_expiration_interval) {
|
||||||
sl->expiration_interval = res->server_list.expiration_interval;
|
sl->expiration_interval = res.server_list.expiration_interval;
|
||||||
}
|
}
|
||||||
grpc_grpclb_response_destroy(res);
|
|
||||||
return sl;
|
return sl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -167,6 +176,72 @@ void grpc_grpclb_destroy_serverlist(grpc_grpclb_serverlist *serverlist) {
|
||||||
gpr_free(serverlist);
|
gpr_free(serverlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
void grpc_grpclb_response_destroy(grpc_grpclb_response *response) {
|
grpc_grpclb_serverlist *grpc_grpclb_serverlist_copy(
|
||||||
|
const grpc_grpclb_serverlist *sl) {
|
||||||
|
grpc_grpclb_serverlist *copy = gpr_malloc(sizeof(grpc_grpclb_serverlist));
|
||||||
|
memset(copy, 0, sizeof(grpc_grpclb_serverlist));
|
||||||
|
copy->num_servers = sl->num_servers;
|
||||||
|
memcpy(©->expiration_interval, &sl->expiration_interval,
|
||||||
|
sizeof(grpc_grpclb_duration));
|
||||||
|
copy->servers = gpr_malloc(sizeof(grpc_grpclb_server *) * sl->num_servers);
|
||||||
|
for (size_t i = 0; i < sl->num_servers; i++) {
|
||||||
|
copy->servers[i] = gpr_malloc(sizeof(grpc_grpclb_server));
|
||||||
|
memcpy(copy->servers[i], sl->servers[i], sizeof(grpc_grpclb_server));
|
||||||
|
}
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool grpc_grpclb_serverlist_equals(const grpc_grpclb_serverlist *lhs,
|
||||||
|
const grpc_grpclb_serverlist *rhs) {
|
||||||
|
if ((lhs == NULL) || (rhs == NULL)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (lhs->num_servers != rhs->num_servers) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (grpc_grpclb_duration_compare(&lhs->expiration_interval,
|
||||||
|
&rhs->expiration_interval) != 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (size_t i = 0; i < lhs->num_servers; i++) {
|
||||||
|
if (!grpc_grpclb_server_equals(lhs->servers[i], rhs->servers[i])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool grpc_grpclb_server_equals(const grpc_grpclb_server *lhs,
|
||||||
|
const grpc_grpclb_server *rhs) {
|
||||||
|
return memcmp(lhs, rhs, sizeof(grpc_grpclb_server)) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int grpc_grpclb_duration_compare(const grpc_grpclb_duration *lhs,
|
||||||
|
const grpc_grpclb_duration *rhs) {
|
||||||
|
GPR_ASSERT(lhs && rhs);
|
||||||
|
if (lhs->has_seconds && rhs->has_seconds) {
|
||||||
|
if (lhs->seconds < rhs->seconds) return -1;
|
||||||
|
if (lhs->seconds > rhs->seconds) return 1;
|
||||||
|
} else if (lhs->has_seconds) {
|
||||||
|
return 1;
|
||||||
|
} else if (rhs->has_seconds) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
GPR_ASSERT(lhs->seconds == rhs->seconds);
|
||||||
|
if (lhs->has_nanos && rhs->has_nanos) {
|
||||||
|
if (lhs->nanos < rhs->nanos) return -1;
|
||||||
|
if (lhs->nanos > rhs->nanos) return 1;
|
||||||
|
} else if (lhs->has_nanos) {
|
||||||
|
return 1;
|
||||||
|
} else if (rhs->has_nanos) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void grpc_grpclb_initial_response_destroy(
|
||||||
|
grpc_grpclb_initial_response *response) {
|
||||||
gpr_free(response);
|
gpr_free(response);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ extern "C" {
|
||||||
#define GRPC_GRPCLB_SERVICE_NAME_MAX_LENGTH 128
|
#define GRPC_GRPCLB_SERVICE_NAME_MAX_LENGTH 128
|
||||||
|
|
||||||
typedef grpc_lb_v1_LoadBalanceRequest grpc_grpclb_request;
|
typedef grpc_lb_v1_LoadBalanceRequest grpc_grpclb_request;
|
||||||
typedef grpc_lb_v1_LoadBalanceResponse grpc_grpclb_response;
|
typedef grpc_lb_v1_InitialLoadBalanceResponse grpc_grpclb_initial_response;
|
||||||
typedef grpc_lb_v1_Server grpc_grpclb_server;
|
typedef grpc_lb_v1_Server grpc_grpclb_server;
|
||||||
typedef grpc_lb_v1_Duration grpc_grpclb_duration;
|
typedef grpc_lb_v1_Duration grpc_grpclb_duration;
|
||||||
typedef struct grpc_grpclb_serverlist {
|
typedef struct grpc_grpclb_serverlist {
|
||||||
|
|
@ -64,19 +64,37 @@ gpr_slice grpc_grpclb_request_encode(const grpc_grpclb_request *request);
|
||||||
/** Destroy \a request */
|
/** Destroy \a request */
|
||||||
void grpc_grpclb_request_destroy(grpc_grpclb_request *request);
|
void grpc_grpclb_request_destroy(grpc_grpclb_request *request);
|
||||||
|
|
||||||
/** Parse (ie, decode) the bytes in \a encoded_response as a \a
|
/** Parse (ie, decode) the bytes in \a encoded_grpc_grpclb_response as a \a
|
||||||
* grpc_grpclb_response */
|
* grpc_grpclb_initial_response */
|
||||||
grpc_grpclb_response *grpc_grpclb_response_parse(gpr_slice encoded_response);
|
grpc_grpclb_initial_response *grpc_grpclb_initial_response_parse(
|
||||||
|
gpr_slice encoded_grpc_grpclb_response);
|
||||||
|
|
||||||
|
/** Parse the list of servers from an encoded \a grpc_grpclb_response */
|
||||||
|
grpc_grpclb_serverlist *grpc_grpclb_response_parse_serverlist(
|
||||||
|
gpr_slice encoded_grpc_grpclb_response);
|
||||||
|
|
||||||
|
/** Return a copy of \a sl. The caller is responsible for calling \a
|
||||||
|
* grpc_grpclb_destroy_serverlist on the returned copy. */
|
||||||
|
grpc_grpclb_serverlist *grpc_grpclb_serverlist_copy(
|
||||||
|
const grpc_grpclb_serverlist *sl);
|
||||||
|
|
||||||
|
bool grpc_grpclb_serverlist_equals(const grpc_grpclb_serverlist *lhs,
|
||||||
|
const grpc_grpclb_serverlist *rhs);
|
||||||
|
|
||||||
|
bool grpc_grpclb_server_equals(const grpc_grpclb_server *lhs,
|
||||||
|
const grpc_grpclb_server *rhs);
|
||||||
|
|
||||||
/** Destroy \a serverlist */
|
/** Destroy \a serverlist */
|
||||||
void grpc_grpclb_destroy_serverlist(grpc_grpclb_serverlist *serverlist);
|
void grpc_grpclb_destroy_serverlist(grpc_grpclb_serverlist *serverlist);
|
||||||
|
|
||||||
/** Parse the list of servers from an encoded \a grpc_grpclb_response */
|
/** Compare \a lhs against \a rhs and return 0 if \a lhs and \a rhs are equal,
|
||||||
grpc_grpclb_serverlist *grpc_grpclb_response_parse_serverlist(
|
* < 0 if \a lhs represents a duration shorter than \a rhs and > 0 otherwise */
|
||||||
gpr_slice encoded_response);
|
int grpc_grpclb_duration_compare(const grpc_grpclb_duration *lhs,
|
||||||
|
const grpc_grpclb_duration *rhs);
|
||||||
|
|
||||||
/** Destroy \a response */
|
/** Destroy \a initial_response */
|
||||||
void grpc_grpclb_response_destroy(grpc_grpclb_response *response);
|
void grpc_grpclb_initial_response_destroy(
|
||||||
|
grpc_grpclb_initial_response *response);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,42 +42,12 @@
|
||||||
#include "src/core/lib/channel/channel_stack_builder.h"
|
#include "src/core/lib/channel/channel_stack_builder.h"
|
||||||
#include "src/core/lib/surface/channel_init.h"
|
#include "src/core/lib/surface/channel_init.h"
|
||||||
|
|
||||||
struct grpc_load_reporting_config {
|
|
||||||
grpc_load_reporting_fn fn;
|
|
||||||
void *user_data;
|
|
||||||
};
|
|
||||||
|
|
||||||
grpc_load_reporting_config *grpc_load_reporting_config_create(
|
|
||||||
grpc_load_reporting_fn fn, void *user_data) {
|
|
||||||
GPR_ASSERT(fn != NULL);
|
|
||||||
grpc_load_reporting_config *lrc =
|
|
||||||
gpr_malloc(sizeof(grpc_load_reporting_config));
|
|
||||||
lrc->fn = fn;
|
|
||||||
lrc->user_data = user_data;
|
|
||||||
return lrc;
|
|
||||||
}
|
|
||||||
|
|
||||||
grpc_load_reporting_config *grpc_load_reporting_config_copy(
|
|
||||||
grpc_load_reporting_config *src) {
|
|
||||||
return grpc_load_reporting_config_create(src->fn, src->user_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
void grpc_load_reporting_config_destroy(grpc_load_reporting_config *lrc) {
|
|
||||||
gpr_free(lrc);
|
|
||||||
}
|
|
||||||
|
|
||||||
void grpc_load_reporting_config_call(
|
|
||||||
grpc_load_reporting_config *lrc,
|
|
||||||
const grpc_load_reporting_call_data *call_data) {
|
|
||||||
lrc->fn(call_data, lrc->user_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool is_load_reporting_enabled(const grpc_channel_args *a) {
|
static bool is_load_reporting_enabled(const grpc_channel_args *a) {
|
||||||
if (a == NULL) return false;
|
if (a == NULL) return false;
|
||||||
for (size_t i = 0; i < a->num_args; i++) {
|
for (size_t i = 0; i < a->num_args; i++) {
|
||||||
if (0 == strcmp(a->args[i].key, GRPC_ARG_ENABLE_LOAD_REPORTING)) {
|
if (0 == strcmp(a->args[i].key, GRPC_ARG_ENABLE_LOAD_REPORTING)) {
|
||||||
return a->args[i].type == GRPC_ARG_POINTER &&
|
return a->args[i].type == GRPC_ARG_INTEGER &&
|
||||||
a->args[i].value.pointer.p != NULL;
|
a->args[i].value.integer != 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -94,37 +64,17 @@ static bool maybe_add_load_reporting_filter(grpc_channel_stack_builder *builder,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lrd_arg_destroy(void *p) { grpc_load_reporting_config_destroy(p); }
|
grpc_arg grpc_load_reporting_enable_arg() {
|
||||||
|
|
||||||
static void *lrd_arg_copy(void *p) {
|
|
||||||
return grpc_load_reporting_config_copy(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int lrd_arg_cmp(void *a, void *b) {
|
|
||||||
grpc_load_reporting_config *lhs = a;
|
|
||||||
grpc_load_reporting_config *rhs = b;
|
|
||||||
return !(lhs->fn == rhs->fn && lhs->user_data == rhs->user_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const grpc_arg_pointer_vtable lrd_ptr_vtable = {
|
|
||||||
lrd_arg_copy, lrd_arg_destroy, lrd_arg_cmp};
|
|
||||||
|
|
||||||
grpc_arg grpc_load_reporting_config_create_arg(
|
|
||||||
grpc_load_reporting_config *lrc) {
|
|
||||||
grpc_arg arg;
|
grpc_arg arg;
|
||||||
arg.type = GRPC_ARG_POINTER;
|
arg.type = GRPC_ARG_INTEGER;
|
||||||
arg.key = GRPC_ARG_ENABLE_LOAD_REPORTING;
|
arg.key = GRPC_ARG_ENABLE_LOAD_REPORTING;
|
||||||
arg.value.pointer.p = lrc;
|
arg.value.integer = 1;
|
||||||
arg.value.pointer.vtable = &lrd_ptr_vtable;
|
|
||||||
return arg;
|
return arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Plugin registration */
|
/* Plugin registration */
|
||||||
|
|
||||||
void grpc_load_reporting_plugin_init(void) {
|
void grpc_load_reporting_plugin_init(void) {
|
||||||
grpc_channel_init_register_stage(GRPC_CLIENT_CHANNEL, INT_MAX,
|
|
||||||
maybe_add_load_reporting_filter,
|
|
||||||
(void *)&grpc_load_reporting_filter);
|
|
||||||
grpc_channel_init_register_stage(GRPC_SERVER_CHANNEL, INT_MAX,
|
grpc_channel_init_register_stage(GRPC_SERVER_CHANNEL, INT_MAX,
|
||||||
maybe_add_load_reporting_filter,
|
maybe_add_load_reporting_filter,
|
||||||
(void *)&grpc_load_reporting_filter);
|
(void *)&grpc_load_reporting_filter);
|
||||||
|
|
|
||||||
|
|
@ -34,42 +34,47 @@
|
||||||
#ifndef GRPC_CORE_EXT_LOAD_REPORTING_LOAD_REPORTING_H
|
#ifndef GRPC_CORE_EXT_LOAD_REPORTING_LOAD_REPORTING_H
|
||||||
#define GRPC_CORE_EXT_LOAD_REPORTING_LOAD_REPORTING_H
|
#define GRPC_CORE_EXT_LOAD_REPORTING_LOAD_REPORTING_H
|
||||||
|
|
||||||
#include "src/core/lib/iomgr/closure.h"
|
#include <grpc/impl/codegen/grpc_types.h>
|
||||||
#include "src/core/lib/surface/call.h"
|
#include "src/core/lib/channel/channel_stack.h"
|
||||||
|
|
||||||
typedef struct grpc_load_reporting_config grpc_load_reporting_config;
|
/** Metadata key for initial metadata coming from clients */
|
||||||
|
/* TODO(dgq): change to the final value TBD */
|
||||||
|
#define GRPC_LOAD_REPORTING_INITIAL_MD_KEY "load-reporting-initial"
|
||||||
|
|
||||||
/** Call information to be passed to the provided load reporting function upon
|
/** Metadata key for trailing metadata from servers */
|
||||||
* completion of the call */
|
/* TODO(dgq): change to the final value TBD */
|
||||||
|
#define GRPC_LOAD_REPORTING_TRAILING_MD_KEY "load-reporting-trailing"
|
||||||
|
|
||||||
|
/** Identifiers for the invocation point of the users LR callback */
|
||||||
|
typedef enum grpc_load_reporting_source {
|
||||||
|
GRPC_LR_POINT_UNKNOWN = 0,
|
||||||
|
GRPC_LR_POINT_CHANNEL_CREATION,
|
||||||
|
GRPC_LR_POINT_CHANNEL_DESTRUCTION,
|
||||||
|
GRPC_LR_POINT_CALL_CREATION,
|
||||||
|
GRPC_LR_POINT_CALL_DESTRUCTION
|
||||||
|
} grpc_load_reporting_source;
|
||||||
|
|
||||||
|
/** Call information to be passed to the provided LR callback. */
|
||||||
typedef struct grpc_load_reporting_call_data {
|
typedef struct grpc_load_reporting_call_data {
|
||||||
const grpc_call_stats *stats; /**< Stats for the call */
|
const grpc_load_reporting_source source; /**< point of last data update. */
|
||||||
const char *trailing_md_string; /**< LR trailing metadata info */
|
|
||||||
|
/** Unique identifier for the channel associated with the data */
|
||||||
|
intptr_t channel_id;
|
||||||
|
|
||||||
|
/** Unique identifier for the call associated with the data. If the call
|
||||||
|
* hasn't been created yet, it'll have a value of zero. */
|
||||||
|
intptr_t call_id;
|
||||||
|
|
||||||
|
/** Only valid when \a source is \a GRPC_LR_POINT_CALL_DESTRUCTION, that is,
|
||||||
|
* once the call has completed */
|
||||||
|
const grpc_call_final_info *final_info;
|
||||||
|
|
||||||
|
const char *initial_md_string; /**< value string for LR's initial md key */
|
||||||
|
const char *trailing_md_string; /**< value string for LR's trailing md key */
|
||||||
|
const char *method_name; /**< Corresponds to :path header */
|
||||||
} grpc_load_reporting_call_data;
|
} grpc_load_reporting_call_data;
|
||||||
|
|
||||||
/** Custom function to be called by the load reporting filter. */
|
|
||||||
typedef void (*grpc_load_reporting_fn)(
|
|
||||||
const grpc_load_reporting_call_data *call_data, void *user_data);
|
|
||||||
|
|
||||||
/** Register \a fn as the function to be invoked by the load reporting filter.
|
|
||||||
* \a fn will be invoked at the beginning and at the end of the call.
|
|
||||||
*
|
|
||||||
* For the first invocation, \a fn's first argument
|
|
||||||
* (grpc_load_reporting_call_data*) will be NULL. \a user_data is always passed
|
|
||||||
* as-is. */
|
|
||||||
grpc_load_reporting_config *grpc_load_reporting_config_create(
|
|
||||||
grpc_load_reporting_fn fn, void *user_data);
|
|
||||||
|
|
||||||
grpc_load_reporting_config *grpc_load_reporting_config_copy(
|
|
||||||
grpc_load_reporting_config *src);
|
|
||||||
|
|
||||||
void grpc_load_reporting_config_destroy(grpc_load_reporting_config *lrc);
|
|
||||||
|
|
||||||
/** Invoke the function registered by \a grpc_load_reporting_init. */
|
|
||||||
void grpc_load_reporting_config_call(
|
|
||||||
grpc_load_reporting_config *lrc,
|
|
||||||
const grpc_load_reporting_call_data *call_data);
|
|
||||||
|
|
||||||
/** Return a \a grpc_arg enabling load reporting */
|
/** Return a \a grpc_arg enabling load reporting */
|
||||||
grpc_arg grpc_load_reporting_config_create_arg(grpc_load_reporting_config *lrc);
|
grpc_arg grpc_load_reporting_enable_arg();
|
||||||
|
|
||||||
#endif /* GRPC_CORE_EXT_LOAD_REPORTING_LOAD_REPORTING_H */
|
#endif /* GRPC_CORE_EXT_LOAD_REPORTING_LOAD_REPORTING_H */
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <grpc/support/alloc.h>
|
||||||
#include <grpc/support/log.h>
|
#include <grpc/support/log.h>
|
||||||
#include <grpc/support/string_util.h>
|
#include <grpc/support/string_util.h>
|
||||||
#include <grpc/support/sync.h>
|
#include <grpc/support/sync.h>
|
||||||
|
|
@ -42,17 +43,67 @@
|
||||||
#include "src/core/lib/profiling/timers.h"
|
#include "src/core/lib/profiling/timers.h"
|
||||||
#include "src/core/lib/transport/static_metadata.h"
|
#include "src/core/lib/transport/static_metadata.h"
|
||||||
|
|
||||||
typedef struct call_data { const char *trailing_md_string; } call_data;
|
typedef struct call_data {
|
||||||
|
intptr_t id; /**< an id unique to the call */
|
||||||
|
char *trailing_md_string;
|
||||||
|
char *initial_md_string;
|
||||||
|
const char *service_method;
|
||||||
|
|
||||||
|
/* stores the recv_initial_metadata op's ready closure, which we wrap with our
|
||||||
|
* own (on_initial_md_ready) in order to capture the incoming initial metadata
|
||||||
|
* */
|
||||||
|
grpc_closure *ops_recv_initial_metadata_ready;
|
||||||
|
|
||||||
|
/* to get notified of the availability of the incoming initial metadata. */
|
||||||
|
grpc_closure on_initial_md_ready;
|
||||||
|
grpc_metadata_batch *recv_initial_metadata;
|
||||||
|
} call_data;
|
||||||
|
|
||||||
typedef struct channel_data {
|
typedef struct channel_data {
|
||||||
gpr_mu mu;
|
intptr_t id; /**< an id unique to the channel */
|
||||||
grpc_load_reporting_config *lrc;
|
|
||||||
} channel_data;
|
} channel_data;
|
||||||
|
|
||||||
static void invoke_lr_fn_locked(grpc_load_reporting_config *lrc,
|
typedef struct {
|
||||||
grpc_load_reporting_call_data *lr_call_data) {
|
grpc_call_element *elem;
|
||||||
GPR_TIMER_BEGIN("load_reporting_config_fn", 0);
|
grpc_exec_ctx *exec_ctx;
|
||||||
grpc_load_reporting_config_call(lrc, lr_call_data);
|
} recv_md_filter_args;
|
||||||
GPR_TIMER_END("load_reporting_config_fn", 0);
|
|
||||||
|
static grpc_mdelem *recv_md_filter(void *user_data, grpc_mdelem *md) {
|
||||||
|
recv_md_filter_args *a = user_data;
|
||||||
|
grpc_call_element *elem = a->elem;
|
||||||
|
call_data *calld = elem->call_data;
|
||||||
|
|
||||||
|
if (md->key == GRPC_MDSTR_PATH) {
|
||||||
|
calld->service_method = grpc_mdstr_as_c_string(md->value);
|
||||||
|
} else if (md->key == GRPC_MDSTR_LOAD_REPORTING_INITIAL) {
|
||||||
|
calld->initial_md_string = gpr_strdup(grpc_mdstr_as_c_string(md->value));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return md;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void on_initial_md_ready(grpc_exec_ctx *exec_ctx, void *user_data,
|
||||||
|
grpc_error *err) {
|
||||||
|
grpc_call_element *elem = user_data;
|
||||||
|
call_data *calld = elem->call_data;
|
||||||
|
|
||||||
|
if (err == GRPC_ERROR_NONE) {
|
||||||
|
recv_md_filter_args a;
|
||||||
|
a.elem = elem;
|
||||||
|
a.exec_ctx = exec_ctx;
|
||||||
|
grpc_metadata_batch_filter(calld->recv_initial_metadata, recv_md_filter,
|
||||||
|
&a);
|
||||||
|
if (calld->service_method == NULL) {
|
||||||
|
err =
|
||||||
|
grpc_error_add_child(err, GRPC_ERROR_CREATE("Missing :path header"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
GRPC_ERROR_REF(err);
|
||||||
|
}
|
||||||
|
calld->ops_recv_initial_metadata_ready->cb(
|
||||||
|
exec_ctx, calld->ops_recv_initial_metadata_ready->cb_arg, err);
|
||||||
|
GRPC_ERROR_UNREF(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Constructor for call_data */
|
/* Constructor for call_data */
|
||||||
|
|
@ -60,20 +111,41 @@ static void init_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
||||||
grpc_call_element_args *args) {
|
grpc_call_element_args *args) {
|
||||||
call_data *calld = elem->call_data;
|
call_data *calld = elem->call_data;
|
||||||
memset(calld, 0, sizeof(call_data));
|
memset(calld, 0, sizeof(call_data));
|
||||||
|
|
||||||
|
calld->id = (intptr_t)args->call_stack;
|
||||||
|
grpc_closure_init(&calld->on_initial_md_ready, on_initial_md_ready, elem);
|
||||||
|
|
||||||
|
/* TODO(dgq): do something with the data
|
||||||
|
channel_data *chand = elem->channel_data;
|
||||||
|
grpc_load_reporting_call_data lr_call_data = {GRPC_LR_POINT_CALL_CREATION,
|
||||||
|
(intptr_t)chand->id,
|
||||||
|
(intptr_t)calld->id,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL};
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Destructor for call_data */
|
/* Destructor for call_data */
|
||||||
static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
||||||
const grpc_call_stats *stats, void *ignored) {
|
const grpc_call_final_info *final_info,
|
||||||
channel_data *chand = elem->channel_data;
|
void *ignored) {
|
||||||
call_data *calld = elem->call_data;
|
call_data *calld = elem->call_data;
|
||||||
|
|
||||||
grpc_load_reporting_call_data lr_call_data = {stats,
|
/* TODO(dgq): do something with the data
|
||||||
calld->trailing_md_string};
|
channel_data *chand = elem->channel_data;
|
||||||
|
grpc_load_reporting_call_data lr_call_data = {GRPC_LR_POINT_CALL_DESTRUCTION,
|
||||||
|
(intptr_t)chand->id,
|
||||||
|
(intptr_t)calld->id,
|
||||||
|
final_info,
|
||||||
|
calld->initial_md_string,
|
||||||
|
calld->trailing_md_string,
|
||||||
|
calld->service_method};
|
||||||
|
*/
|
||||||
|
|
||||||
gpr_mu_lock(&chand->mu);
|
gpr_free(calld->initial_md_string);
|
||||||
invoke_lr_fn_locked(chand->lrc, &lr_call_data);
|
gpr_free(calld->trailing_md_string);
|
||||||
gpr_mu_unlock(&chand->mu);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Constructor for channel_data */
|
/* Constructor for channel_data */
|
||||||
|
|
@ -85,37 +157,40 @@ static void init_channel_elem(grpc_exec_ctx *exec_ctx,
|
||||||
channel_data *chand = elem->channel_data;
|
channel_data *chand = elem->channel_data;
|
||||||
memset(chand, 0, sizeof(channel_data));
|
memset(chand, 0, sizeof(channel_data));
|
||||||
|
|
||||||
gpr_mu_init(&chand->mu);
|
chand->id = (intptr_t)args->channel_stack;
|
||||||
for (size_t i = 0; i < args->channel_args->num_args; i++) {
|
|
||||||
if (0 == strcmp(args->channel_args->args[i].key,
|
|
||||||
GRPC_ARG_ENABLE_LOAD_REPORTING)) {
|
|
||||||
grpc_load_reporting_config *arg_lrc =
|
|
||||||
args->channel_args->args[i].value.pointer.p;
|
|
||||||
chand->lrc = grpc_load_reporting_config_copy(arg_lrc);
|
|
||||||
GPR_ASSERT(chand->lrc != NULL);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
GPR_ASSERT(chand->lrc != NULL); /* arg actually found */
|
|
||||||
|
|
||||||
gpr_mu_lock(&chand->mu);
|
/* TODO(dgq): do something with the data
|
||||||
invoke_lr_fn_locked(chand->lrc, NULL);
|
grpc_load_reporting_call_data lr_call_data = {GRPC_LR_POINT_CHANNEL_CREATION,
|
||||||
gpr_mu_unlock(&chand->mu);
|
(intptr_t)chand,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL};
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Destructor for channel data */
|
/* Destructor for channel data */
|
||||||
static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
|
static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
|
||||||
grpc_channel_element *elem) {
|
grpc_channel_element *elem) {
|
||||||
|
/* TODO(dgq): do something with the data
|
||||||
channel_data *chand = elem->channel_data;
|
channel_data *chand = elem->channel_data;
|
||||||
gpr_mu_destroy(&chand->mu);
|
grpc_load_reporting_call_data lr_call_data = {
|
||||||
grpc_load_reporting_config_destroy(chand->lrc);
|
GRPC_LR_POINT_CHANNEL_DESTRUCTION,
|
||||||
|
(intptr_t)chand->id,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL};
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
static grpc_mdelem *lr_trailing_md_filter(void *user_data, grpc_mdelem *md) {
|
static grpc_mdelem *lr_trailing_md_filter(void *user_data, grpc_mdelem *md) {
|
||||||
grpc_call_element *elem = user_data;
|
grpc_call_element *elem = user_data;
|
||||||
call_data *calld = elem->call_data;
|
call_data *calld = elem->call_data;
|
||||||
|
|
||||||
if (md->key == GRPC_MDSTR_LOAD_REPORTING) {
|
if (md->key == GRPC_MDSTR_LOAD_REPORTING_TRAILING) {
|
||||||
calld->trailing_md_string = gpr_strdup(grpc_mdstr_as_c_string(md->value));
|
calld->trailing_md_string = gpr_strdup(grpc_mdstr_as_c_string(md->value));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -127,8 +202,14 @@ static void lr_start_transport_stream_op(grpc_exec_ctx *exec_ctx,
|
||||||
grpc_call_element *elem,
|
grpc_call_element *elem,
|
||||||
grpc_transport_stream_op *op) {
|
grpc_transport_stream_op *op) {
|
||||||
GPR_TIMER_BEGIN("lr_start_transport_stream_op", 0);
|
GPR_TIMER_BEGIN("lr_start_transport_stream_op", 0);
|
||||||
|
call_data *calld = elem->call_data;
|
||||||
|
|
||||||
if (op->send_trailing_metadata) {
|
if (op->recv_initial_metadata) {
|
||||||
|
calld->recv_initial_metadata = op->recv_initial_metadata;
|
||||||
|
/* substitute our callback for the higher callback */
|
||||||
|
calld->ops_recv_initial_metadata_ready = op->recv_initial_metadata_ready;
|
||||||
|
op->recv_initial_metadata_ready = &calld->on_initial_md_ready;
|
||||||
|
} else if (op->send_trailing_metadata) {
|
||||||
grpc_metadata_batch_filter(op->send_trailing_metadata,
|
grpc_metadata_batch_filter(op->send_trailing_metadata,
|
||||||
lr_trailing_md_filter, elem);
|
lr_trailing_md_filter, elem);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@
|
||||||
#ifndef GRPC_CORE_EXT_LOAD_REPORTING_LOAD_REPORTING_FILTER_H
|
#ifndef GRPC_CORE_EXT_LOAD_REPORTING_LOAD_REPORTING_FILTER_H
|
||||||
#define GRPC_CORE_EXT_LOAD_REPORTING_LOAD_REPORTING_FILTER_H
|
#define GRPC_CORE_EXT_LOAD_REPORTING_LOAD_REPORTING_FILTER_H
|
||||||
|
|
||||||
|
#include "src/core/ext/load_reporting/load_reporting.h"
|
||||||
#include "src/core/lib/channel/channel_stack.h"
|
#include "src/core/lib/channel/channel_stack.h"
|
||||||
|
|
||||||
extern const grpc_channel_filter grpc_load_reporting_filter;
|
extern const grpc_channel_filter grpc_load_reporting_filter;
|
||||||
|
|
|
||||||
|
|
@ -202,6 +202,7 @@ static void finalize_outbuf(grpc_exec_ctx *exec_ctx,
|
||||||
|
|
||||||
GPR_TIMER_BEGIN("finalize_outbuf", 0);
|
GPR_TIMER_BEGIN("finalize_outbuf", 0);
|
||||||
|
|
||||||
|
bool is_first_data_frame = true;
|
||||||
while (
|
while (
|
||||||
grpc_chttp2_list_pop_writing_stream(transport_writing, &stream_writing)) {
|
grpc_chttp2_list_pop_writing_stream(transport_writing, &stream_writing)) {
|
||||||
uint32_t max_outgoing =
|
uint32_t max_outgoing =
|
||||||
|
|
@ -266,6 +267,11 @@ static void finalize_outbuf(grpc_exec_ctx *exec_ctx,
|
||||||
stream_writing->id, &stream_writing->flow_controlled_buffer,
|
stream_writing->id, &stream_writing->flow_controlled_buffer,
|
||||||
send_bytes, is_last_frame, &stream_writing->stats,
|
send_bytes, is_last_frame, &stream_writing->stats,
|
||||||
&transport_writing->outbuf);
|
&transport_writing->outbuf);
|
||||||
|
if (is_first_data_frame) {
|
||||||
|
/* TODO(dgq): this is a hack. It'll be fix in a future refactoring */
|
||||||
|
stream_writing->stats.data_bytes -= 5; /* discount grpc framing */
|
||||||
|
is_first_data_frame = false;
|
||||||
|
}
|
||||||
GRPC_CHTTP2_FLOW_DEBIT_STREAM("write", transport_writing,
|
GRPC_CHTTP2_FLOW_DEBIT_STREAM("write", transport_writing,
|
||||||
stream_writing, outgoing_window,
|
stream_writing, outgoing_window,
|
||||||
send_bytes);
|
send_bytes);
|
||||||
|
|
|
||||||
|
|
@ -217,7 +217,7 @@ void grpc_call_stack_ignore_set_pollset_or_pollset_set(
|
||||||
grpc_polling_entity *pollent) {}
|
grpc_polling_entity *pollent) {}
|
||||||
|
|
||||||
void grpc_call_stack_destroy(grpc_exec_ctx *exec_ctx, grpc_call_stack *stack,
|
void grpc_call_stack_destroy(grpc_exec_ctx *exec_ctx, grpc_call_stack *stack,
|
||||||
const grpc_call_stats *call_stats,
|
const grpc_call_final_info *final_info,
|
||||||
void *and_free_memory) {
|
void *and_free_memory) {
|
||||||
grpc_call_element *elems = CALL_ELEMS_FROM_STACK(stack);
|
grpc_call_element *elems = CALL_ELEMS_FROM_STACK(stack);
|
||||||
size_t count = stack->count;
|
size_t count = stack->count;
|
||||||
|
|
@ -225,7 +225,7 @@ void grpc_call_stack_destroy(grpc_exec_ctx *exec_ctx, grpc_call_stack *stack,
|
||||||
|
|
||||||
/* destroy per-filter data */
|
/* destroy per-filter data */
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
elems[i].filter->destroy_call_elem(exec_ctx, &elems[i], call_stats,
|
elems[i].filter->destroy_call_elem(exec_ctx, &elems[i], final_info,
|
||||||
i == count - 1 ? and_free_memory : NULL);
|
i == count - 1 ? and_free_memory : NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -75,9 +75,14 @@ typedef struct {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
grpc_transport_stream_stats transport_stream_stats;
|
grpc_transport_stream_stats transport_stream_stats;
|
||||||
gpr_timespec latency; /* From call creating to enqueing of received status */
|
gpr_timespec latency; /* From call creating to enqueing of received status */
|
||||||
grpc_status_code final_status;
|
|
||||||
} grpc_call_stats;
|
} grpc_call_stats;
|
||||||
|
|
||||||
|
/** Information about the call upon completion. */
|
||||||
|
typedef struct {
|
||||||
|
grpc_call_stats stats;
|
||||||
|
grpc_status_code final_status;
|
||||||
|
} grpc_call_final_info;
|
||||||
|
|
||||||
/* Channel filters specify:
|
/* Channel filters specify:
|
||||||
1. the amount of memory needed in the channel & call (via the sizeof_XXX
|
1. the amount of memory needed in the channel & call (via the sizeof_XXX
|
||||||
members)
|
members)
|
||||||
|
|
@ -119,16 +124,17 @@ typedef struct {
|
||||||
The filter does not need to do any chaining.
|
The filter does not need to do any chaining.
|
||||||
The bottom filter of a stack will be passed a non-NULL pointer to
|
The bottom filter of a stack will be passed a non-NULL pointer to
|
||||||
\a and_free_memory that should be passed to gpr_free when destruction
|
\a and_free_memory that should be passed to gpr_free when destruction
|
||||||
is complete. */
|
is complete. \a final_info contains data about the completed call, mainly
|
||||||
|
for reporting purposes. */
|
||||||
void (*destroy_call_elem)(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
void (*destroy_call_elem)(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
||||||
const grpc_call_stats *stats,
|
const grpc_call_final_info *final_info,
|
||||||
void *and_free_memory);
|
void *and_free_memory);
|
||||||
|
|
||||||
/* sizeof(per channel data) */
|
/* sizeof(per channel data) */
|
||||||
size_t sizeof_channel_data;
|
size_t sizeof_channel_data;
|
||||||
/* Initialize per-channel data.
|
/* Initialize per-channel data.
|
||||||
elem is initialized at the start of the call, and elem->channel_data is
|
elem is initialized at the creating of the channel, and elem->channel_data
|
||||||
what needs initializing.
|
is what needs initializing.
|
||||||
is_first, is_last designate this elements position in the stack, and are
|
is_first, is_last designate this elements position in the stack, and are
|
||||||
useful for asserting correct configuration by upper layer code.
|
useful for asserting correct configuration by upper layer code.
|
||||||
The filter does not need to do any chaining */
|
The filter does not need to do any chaining */
|
||||||
|
|
@ -243,7 +249,7 @@ void grpc_call_stack_set_pollset_or_pollset_set(grpc_exec_ctx *exec_ctx,
|
||||||
|
|
||||||
/* Destroy a call stack */
|
/* Destroy a call stack */
|
||||||
void grpc_call_stack_destroy(grpc_exec_ctx *exec_ctx, grpc_call_stack *stack,
|
void grpc_call_stack_destroy(grpc_exec_ctx *exec_ctx, grpc_call_stack *stack,
|
||||||
const grpc_call_stats *call_stats,
|
const grpc_call_final_info *final_info,
|
||||||
void *and_free_memory);
|
void *and_free_memory);
|
||||||
|
|
||||||
/* Ignore set pollset{_set} - used by filters if they don't care about pollsets
|
/* Ignore set pollset{_set} - used by filters if they don't care about pollsets
|
||||||
|
|
|
||||||
|
|
@ -270,7 +270,8 @@ static void init_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
||||||
|
|
||||||
/* Destructor for call_data */
|
/* Destructor for call_data */
|
||||||
static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
||||||
const grpc_call_stats *stats, void *ignored) {
|
const grpc_call_final_info *final_info,
|
||||||
|
void *ignored) {
|
||||||
/* grab pointers to our data from the call element */
|
/* grab pointers to our data from the call element */
|
||||||
call_data *calld = elem->call_data;
|
call_data *calld = elem->call_data;
|
||||||
gpr_slice_buffer_destroy(&calld->slices);
|
gpr_slice_buffer_destroy(&calld->slices);
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ static void set_pollset_or_pollset_set(grpc_exec_ctx *exec_ctx,
|
||||||
|
|
||||||
/* Destructor for call_data */
|
/* Destructor for call_data */
|
||||||
static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
||||||
const grpc_call_stats *stats,
|
const grpc_call_final_info *final_info,
|
||||||
void *and_free_memory) {
|
void *and_free_memory) {
|
||||||
call_data *calld = elem->call_data;
|
call_data *calld = elem->call_data;
|
||||||
channel_data *chand = elem->channel_data;
|
channel_data *chand = elem->channel_data;
|
||||||
|
|
|
||||||
|
|
@ -184,7 +184,8 @@ static void init_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
||||||
|
|
||||||
/* Destructor for call_data */
|
/* Destructor for call_data */
|
||||||
static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
||||||
const grpc_call_stats *stats, void *ignored) {}
|
const grpc_call_final_info *final_info,
|
||||||
|
void *ignored) {}
|
||||||
|
|
||||||
static grpc_mdelem *scheme_from_args(const grpc_channel_args *args) {
|
static grpc_mdelem *scheme_from_args(const grpc_channel_args *args) {
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
|
||||||
|
|
@ -235,7 +235,8 @@ static void init_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
||||||
|
|
||||||
/* Destructor for call_data */
|
/* Destructor for call_data */
|
||||||
static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
||||||
const grpc_call_stats *stats, void *ignored) {}
|
const grpc_call_final_info *final_info,
|
||||||
|
void *ignored) {}
|
||||||
|
|
||||||
/* Constructor for channel_data */
|
/* Constructor for channel_data */
|
||||||
static void init_channel_elem(grpc_exec_ctx *exec_ctx,
|
static void init_channel_elem(grpc_exec_ctx *exec_ctx,
|
||||||
|
|
|
||||||
|
|
@ -284,7 +284,7 @@ static void tcp_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* returns true if done, false if pending; if returning true, *error is set */
|
/* returns true if done, false if pending; if returning true, *error is set */
|
||||||
#define MAX_WRITE_IOVEC 1024
|
#define MAX_WRITE_IOVEC 1000
|
||||||
static bool tcp_flush(grpc_tcp *tcp, grpc_error **error) {
|
static bool tcp_flush(grpc_tcp *tcp, grpc_error **error) {
|
||||||
struct msghdr msg;
|
struct msghdr msg;
|
||||||
struct iovec iov[MAX_WRITE_IOVEC];
|
struct iovec iov[MAX_WRITE_IOVEC];
|
||||||
|
|
|
||||||
|
|
@ -282,7 +282,8 @@ static void set_pollset_or_pollset_set(grpc_exec_ctx *exec_ctx,
|
||||||
|
|
||||||
/* Destructor for call_data */
|
/* Destructor for call_data */
|
||||||
static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
||||||
const grpc_call_stats *stats, void *ignored) {
|
const grpc_call_final_info *final_info,
|
||||||
|
void *ignored) {
|
||||||
call_data *calld = elem->call_data;
|
call_data *calld = elem->call_data;
|
||||||
grpc_call_credentials_unref(calld->creds);
|
grpc_call_credentials_unref(calld->creds);
|
||||||
if (calld->host != NULL) {
|
if (calld->host != NULL) {
|
||||||
|
|
|
||||||
|
|
@ -226,7 +226,8 @@ static void init_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
||||||
|
|
||||||
/* Destructor for call_data */
|
/* Destructor for call_data */
|
||||||
static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
||||||
const grpc_call_stats *stats, void *ignored) {}
|
const grpc_call_final_info *final_info,
|
||||||
|
void *ignored) {}
|
||||||
|
|
||||||
/* Constructor for channel_data */
|
/* Constructor for channel_data */
|
||||||
static void init_channel_elem(grpc_exec_ctx *exec_ctx,
|
static void init_channel_elem(grpc_exec_ctx *exec_ctx,
|
||||||
|
|
|
||||||
|
|
@ -154,8 +154,9 @@ struct grpc_call {
|
||||||
/* Received call statuses from various sources */
|
/* Received call statuses from various sources */
|
||||||
received_status status[STATUS_SOURCE_COUNT];
|
received_status status[STATUS_SOURCE_COUNT];
|
||||||
|
|
||||||
/* Call stats: only valid after trailing metadata received */
|
/* Call data useful used for reporting. Only valid after the call has
|
||||||
grpc_call_stats stats;
|
* completed */
|
||||||
|
grpc_call_final_info final_info;
|
||||||
|
|
||||||
/* Compression algorithm for *incoming* data */
|
/* Compression algorithm for *incoming* data */
|
||||||
grpc_compression_algorithm incoming_compression_algorithm;
|
grpc_compression_algorithm incoming_compression_algorithm;
|
||||||
|
|
@ -361,6 +362,25 @@ void grpc_call_internal_unref(grpc_exec_ctx *exec_ctx, grpc_call *c REF_ARG) {
|
||||||
GRPC_CALL_STACK_UNREF(exec_ctx, CALL_STACK_FROM_CALL(c), REF_REASON);
|
GRPC_CALL_STACK_UNREF(exec_ctx, CALL_STACK_FROM_CALL(c), REF_REASON);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void get_final_status(grpc_call *call,
|
||||||
|
void (*set_value)(grpc_status_code code,
|
||||||
|
void *user_data),
|
||||||
|
void *set_value_user_data) {
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < STATUS_SOURCE_COUNT; i++) {
|
||||||
|
if (call->status[i].is_set) {
|
||||||
|
set_value(call->status[i].code, set_value_user_data);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (call->is_client) {
|
||||||
|
set_value(GRPC_STATUS_UNKNOWN, set_value_user_data);
|
||||||
|
} else {
|
||||||
|
set_value(GRPC_STATUS_OK, set_value_user_data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void set_status_value_directly(grpc_status_code status, void *dest);
|
||||||
static void destroy_call(grpc_exec_ctx *exec_ctx, void *call,
|
static void destroy_call(grpc_exec_ctx *exec_ctx, void *call,
|
||||||
grpc_error *error) {
|
grpc_error *error) {
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
@ -392,7 +412,11 @@ static void destroy_call(grpc_exec_ctx *exec_ctx, void *call,
|
||||||
GRPC_CQ_INTERNAL_UNREF(c->cq, "bind");
|
GRPC_CQ_INTERNAL_UNREF(c->cq, "bind");
|
||||||
}
|
}
|
||||||
grpc_channel *channel = c->channel;
|
grpc_channel *channel = c->channel;
|
||||||
grpc_call_stack_destroy(exec_ctx, CALL_STACK_FROM_CALL(c), &c->stats, c);
|
|
||||||
|
get_final_status(call, set_status_value_directly,
|
||||||
|
&c->final_info.final_status);
|
||||||
|
|
||||||
|
grpc_call_stack_destroy(exec_ctx, CALL_STACK_FROM_CALL(c), &c->final_info, c);
|
||||||
GRPC_CHANNEL_INTERNAL_UNREF(exec_ctx, channel, "call");
|
GRPC_CHANNEL_INTERNAL_UNREF(exec_ctx, channel, "call");
|
||||||
GPR_TIMER_END("destroy_call", 0);
|
GPR_TIMER_END("destroy_call", 0);
|
||||||
}
|
}
|
||||||
|
|
@ -414,24 +438,6 @@ static void set_status_details(grpc_call *call, status_source source,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void get_final_status(grpc_call *call,
|
|
||||||
void (*set_value)(grpc_status_code code,
|
|
||||||
void *user_data),
|
|
||||||
void *set_value_user_data) {
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < STATUS_SOURCE_COUNT; i++) {
|
|
||||||
if (call->status[i].is_set) {
|
|
||||||
set_value(call->status[i].code, set_value_user_data);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (call->is_client) {
|
|
||||||
set_value(GRPC_STATUS_UNKNOWN, set_value_user_data);
|
|
||||||
} else {
|
|
||||||
set_value(GRPC_STATUS_OK, set_value_user_data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void set_status_from_error(grpc_call *call, status_source source,
|
static void set_status_from_error(grpc_call *call, status_source source,
|
||||||
grpc_error *error) {
|
grpc_error *error) {
|
||||||
intptr_t status;
|
intptr_t status;
|
||||||
|
|
@ -1361,6 +1367,9 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx,
|
||||||
int num_completion_callbacks_needed = 1;
|
int num_completion_callbacks_needed = 1;
|
||||||
grpc_call_error error = GRPC_CALL_OK;
|
grpc_call_error error = GRPC_CALL_OK;
|
||||||
|
|
||||||
|
// sent_initial_metadata guards against variable reuse.
|
||||||
|
grpc_metadata compression_md;
|
||||||
|
|
||||||
GPR_TIMER_BEGIN("grpc_call_start_batch", 0);
|
GPR_TIMER_BEGIN("grpc_call_start_batch", 0);
|
||||||
|
|
||||||
GRPC_CALL_LOG_BATCH(GPR_INFO, call, ops, nops, notify_tag);
|
GRPC_CALL_LOG_BATCH(GPR_INFO, call, ops, nops, notify_tag);
|
||||||
|
|
@ -1406,8 +1415,7 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx,
|
||||||
goto done_with_error;
|
goto done_with_error;
|
||||||
}
|
}
|
||||||
/* process compression level */
|
/* process compression level */
|
||||||
grpc_metadata compression_md;
|
memset(&compression_md, 0, sizeof(compression_md));
|
||||||
memset(&compression_md, 0, sizeof(grpc_metadata));
|
|
||||||
size_t additional_metadata_count = 0;
|
size_t additional_metadata_count = 0;
|
||||||
grpc_compression_level effective_compression_level;
|
grpc_compression_level effective_compression_level;
|
||||||
bool level_set = false;
|
bool level_set = false;
|
||||||
|
|
@ -1608,7 +1616,8 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx,
|
||||||
bctl->recv_final_op = 1;
|
bctl->recv_final_op = 1;
|
||||||
stream_op.recv_trailing_metadata =
|
stream_op.recv_trailing_metadata =
|
||||||
&call->metadata_batch[1 /* is_receiving */][1 /* is_trailing */];
|
&call->metadata_batch[1 /* is_receiving */][1 /* is_trailing */];
|
||||||
stream_op.collect_stats = &call->stats.transport_stream_stats;
|
stream_op.collect_stats =
|
||||||
|
&call->final_info.stats.transport_stream_stats;
|
||||||
break;
|
break;
|
||||||
case GRPC_OP_RECV_CLOSE_ON_SERVER:
|
case GRPC_OP_RECV_CLOSE_ON_SERVER:
|
||||||
/* Flag validation: currently allow no flags */
|
/* Flag validation: currently allow no flags */
|
||||||
|
|
@ -1630,7 +1639,8 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx,
|
||||||
bctl->recv_final_op = 1;
|
bctl->recv_final_op = 1;
|
||||||
stream_op.recv_trailing_metadata =
|
stream_op.recv_trailing_metadata =
|
||||||
&call->metadata_batch[1 /* is_receiving */][1 /* is_trailing */];
|
&call->metadata_batch[1 /* is_receiving */][1 /* is_trailing */];
|
||||||
stream_op.collect_stats = &call->stats.transport_stream_stats;
|
stream_op.collect_stats =
|
||||||
|
&call->final_info.stats.transport_stream_stats;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ static void init_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
||||||
grpc_call_element_args *args) {}
|
grpc_call_element_args *args) {}
|
||||||
|
|
||||||
static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
||||||
const grpc_call_stats *stats,
|
const grpc_call_final_info *final_info,
|
||||||
void *and_free_memory) {
|
void *and_free_memory) {
|
||||||
gpr_free(and_free_memory);
|
gpr_free(and_free_memory);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -872,7 +872,8 @@ static void init_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
|
||||||
const grpc_call_stats *stats, void *ignored) {
|
const grpc_call_final_info *final_info,
|
||||||
|
void *ignored) {
|
||||||
channel_data *chand = elem->channel_data;
|
channel_data *chand = elem->channel_data;
|
||||||
call_data *calld = elem->call_data;
|
call_data *calld = elem->call_data;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,10 +45,10 @@ grpc_mdstr grpc_static_mdstr_table[GRPC_STATIC_MDSTR_COUNT];
|
||||||
|
|
||||||
grpc_mdelem grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT];
|
grpc_mdelem grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT];
|
||||||
uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = {
|
uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = {
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 4, 8, 6, 2, 4, 8, 6, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 4, 8, 6, 2, 4, 8, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
|
|
||||||
const uint8_t grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT * 2] =
|
const uint8_t grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT * 2] =
|
||||||
{11, 35, 10, 35, 12, 35, 12, 49, 13, 35, 14, 35, 15, 35, 16, 35, 17, 35,
|
{11, 35, 10, 35, 12, 35, 12, 49, 13, 35, 14, 35, 15, 35, 16, 35, 17, 35,
|
||||||
|
|
@ -56,10 +56,10 @@ const uint8_t grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT * 2] =
|
||||||
30, 18, 30, 35, 31, 35, 32, 35, 36, 35, 37, 35, 38, 35, 39, 35, 42, 33,
|
30, 18, 30, 35, 31, 35, 32, 35, 36, 35, 37, 35, 38, 35, 39, 35, 42, 33,
|
||||||
42, 34, 42, 48, 42, 53, 42, 54, 42, 55, 42, 56, 43, 33, 43, 48, 43, 53,
|
42, 34, 42, 48, 42, 53, 42, 54, 42, 55, 42, 56, 43, 33, 43, 48, 43, 53,
|
||||||
46, 0, 46, 1, 46, 2, 50, 35, 57, 35, 58, 35, 59, 35, 60, 35, 61, 35,
|
46, 0, 46, 1, 46, 2, 50, 35, 57, 35, 58, 35, 59, 35, 60, 35, 61, 35,
|
||||||
62, 35, 63, 35, 64, 35, 65, 35, 66, 35, 67, 40, 67, 69, 67, 72, 68, 80,
|
62, 35, 63, 35, 64, 35, 65, 35, 66, 35, 67, 35, 68, 40, 68, 70, 68, 73,
|
||||||
68, 81, 70, 35, 71, 35, 73, 35, 74, 35, 75, 35, 76, 35, 77, 41, 77, 51,
|
69, 81, 69, 82, 71, 35, 72, 35, 74, 35, 75, 35, 76, 35, 77, 35, 78, 41,
|
||||||
77, 52, 78, 35, 79, 35, 82, 3, 82, 4, 82, 5, 82, 6, 82, 7, 82, 8,
|
78, 51, 78, 52, 79, 35, 80, 35, 83, 3, 83, 4, 83, 5, 83, 6, 83, 7,
|
||||||
82, 9, 83, 35, 84, 85, 86, 35, 87, 35, 88, 35, 89, 35, 90, 35};
|
83, 8, 83, 9, 84, 35, 85, 86, 87, 35, 88, 35, 89, 35, 90, 35, 91, 35};
|
||||||
|
|
||||||
const char *const grpc_static_metadata_strings[GRPC_STATIC_MDSTR_COUNT] = {
|
const char *const grpc_static_metadata_strings[GRPC_STATIC_MDSTR_COUNT] = {
|
||||||
"0",
|
"0",
|
||||||
|
|
@ -126,7 +126,8 @@ const char *const grpc_static_metadata_strings[GRPC_STATIC_MDSTR_COUNT] = {
|
||||||
"if-unmodified-since",
|
"if-unmodified-since",
|
||||||
"last-modified",
|
"last-modified",
|
||||||
"link",
|
"link",
|
||||||
"load-reporting",
|
"load-reporting-initial",
|
||||||
|
"load-reporting-trailing",
|
||||||
"location",
|
"location",
|
||||||
"max-forwards",
|
"max-forwards",
|
||||||
":method",
|
":method",
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@
|
||||||
|
|
||||||
#include "src/core/lib/transport/metadata.h"
|
#include "src/core/lib/transport/metadata.h"
|
||||||
|
|
||||||
#define GRPC_STATIC_MDSTR_COUNT 91
|
#define GRPC_STATIC_MDSTR_COUNT 92
|
||||||
extern grpc_mdstr grpc_static_mdstr_table[GRPC_STATIC_MDSTR_COUNT];
|
extern grpc_mdstr grpc_static_mdstr_table[GRPC_STATIC_MDSTR_COUNT];
|
||||||
/* "0" */
|
/* "0" */
|
||||||
#define GRPC_MDSTR_0 (&grpc_static_mdstr_table[0])
|
#define GRPC_MDSTR_0 (&grpc_static_mdstr_table[0])
|
||||||
|
|
@ -175,62 +175,64 @@ extern grpc_mdstr grpc_static_mdstr_table[GRPC_STATIC_MDSTR_COUNT];
|
||||||
#define GRPC_MDSTR_LAST_MODIFIED (&grpc_static_mdstr_table[62])
|
#define GRPC_MDSTR_LAST_MODIFIED (&grpc_static_mdstr_table[62])
|
||||||
/* "link" */
|
/* "link" */
|
||||||
#define GRPC_MDSTR_LINK (&grpc_static_mdstr_table[63])
|
#define GRPC_MDSTR_LINK (&grpc_static_mdstr_table[63])
|
||||||
/* "load-reporting" */
|
/* "load-reporting-initial" */
|
||||||
#define GRPC_MDSTR_LOAD_REPORTING (&grpc_static_mdstr_table[64])
|
#define GRPC_MDSTR_LOAD_REPORTING_INITIAL (&grpc_static_mdstr_table[64])
|
||||||
|
/* "load-reporting-trailing" */
|
||||||
|
#define GRPC_MDSTR_LOAD_REPORTING_TRAILING (&grpc_static_mdstr_table[65])
|
||||||
/* "location" */
|
/* "location" */
|
||||||
#define GRPC_MDSTR_LOCATION (&grpc_static_mdstr_table[65])
|
#define GRPC_MDSTR_LOCATION (&grpc_static_mdstr_table[66])
|
||||||
/* "max-forwards" */
|
/* "max-forwards" */
|
||||||
#define GRPC_MDSTR_MAX_FORWARDS (&grpc_static_mdstr_table[66])
|
#define GRPC_MDSTR_MAX_FORWARDS (&grpc_static_mdstr_table[67])
|
||||||
/* ":method" */
|
/* ":method" */
|
||||||
#define GRPC_MDSTR_METHOD (&grpc_static_mdstr_table[67])
|
#define GRPC_MDSTR_METHOD (&grpc_static_mdstr_table[68])
|
||||||
/* ":path" */
|
/* ":path" */
|
||||||
#define GRPC_MDSTR_PATH (&grpc_static_mdstr_table[68])
|
#define GRPC_MDSTR_PATH (&grpc_static_mdstr_table[69])
|
||||||
/* "POST" */
|
/* "POST" */
|
||||||
#define GRPC_MDSTR_POST (&grpc_static_mdstr_table[69])
|
#define GRPC_MDSTR_POST (&grpc_static_mdstr_table[70])
|
||||||
/* "proxy-authenticate" */
|
/* "proxy-authenticate" */
|
||||||
#define GRPC_MDSTR_PROXY_AUTHENTICATE (&grpc_static_mdstr_table[70])
|
#define GRPC_MDSTR_PROXY_AUTHENTICATE (&grpc_static_mdstr_table[71])
|
||||||
/* "proxy-authorization" */
|
/* "proxy-authorization" */
|
||||||
#define GRPC_MDSTR_PROXY_AUTHORIZATION (&grpc_static_mdstr_table[71])
|
#define GRPC_MDSTR_PROXY_AUTHORIZATION (&grpc_static_mdstr_table[72])
|
||||||
/* "PUT" */
|
/* "PUT" */
|
||||||
#define GRPC_MDSTR_PUT (&grpc_static_mdstr_table[72])
|
#define GRPC_MDSTR_PUT (&grpc_static_mdstr_table[73])
|
||||||
/* "range" */
|
/* "range" */
|
||||||
#define GRPC_MDSTR_RANGE (&grpc_static_mdstr_table[73])
|
#define GRPC_MDSTR_RANGE (&grpc_static_mdstr_table[74])
|
||||||
/* "referer" */
|
/* "referer" */
|
||||||
#define GRPC_MDSTR_REFERER (&grpc_static_mdstr_table[74])
|
#define GRPC_MDSTR_REFERER (&grpc_static_mdstr_table[75])
|
||||||
/* "refresh" */
|
/* "refresh" */
|
||||||
#define GRPC_MDSTR_REFRESH (&grpc_static_mdstr_table[75])
|
#define GRPC_MDSTR_REFRESH (&grpc_static_mdstr_table[76])
|
||||||
/* "retry-after" */
|
/* "retry-after" */
|
||||||
#define GRPC_MDSTR_RETRY_AFTER (&grpc_static_mdstr_table[76])
|
#define GRPC_MDSTR_RETRY_AFTER (&grpc_static_mdstr_table[77])
|
||||||
/* ":scheme" */
|
/* ":scheme" */
|
||||||
#define GRPC_MDSTR_SCHEME (&grpc_static_mdstr_table[77])
|
#define GRPC_MDSTR_SCHEME (&grpc_static_mdstr_table[78])
|
||||||
/* "server" */
|
/* "server" */
|
||||||
#define GRPC_MDSTR_SERVER (&grpc_static_mdstr_table[78])
|
#define GRPC_MDSTR_SERVER (&grpc_static_mdstr_table[79])
|
||||||
/* "set-cookie" */
|
/* "set-cookie" */
|
||||||
#define GRPC_MDSTR_SET_COOKIE (&grpc_static_mdstr_table[79])
|
#define GRPC_MDSTR_SET_COOKIE (&grpc_static_mdstr_table[80])
|
||||||
/* "/" */
|
/* "/" */
|
||||||
#define GRPC_MDSTR_SLASH (&grpc_static_mdstr_table[80])
|
#define GRPC_MDSTR_SLASH (&grpc_static_mdstr_table[81])
|
||||||
/* "/index.html" */
|
/* "/index.html" */
|
||||||
#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (&grpc_static_mdstr_table[81])
|
#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (&grpc_static_mdstr_table[82])
|
||||||
/* ":status" */
|
/* ":status" */
|
||||||
#define GRPC_MDSTR_STATUS (&grpc_static_mdstr_table[82])
|
#define GRPC_MDSTR_STATUS (&grpc_static_mdstr_table[83])
|
||||||
/* "strict-transport-security" */
|
/* "strict-transport-security" */
|
||||||
#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (&grpc_static_mdstr_table[83])
|
#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (&grpc_static_mdstr_table[84])
|
||||||
/* "te" */
|
/* "te" */
|
||||||
#define GRPC_MDSTR_TE (&grpc_static_mdstr_table[84])
|
#define GRPC_MDSTR_TE (&grpc_static_mdstr_table[85])
|
||||||
/* "trailers" */
|
/* "trailers" */
|
||||||
#define GRPC_MDSTR_TRAILERS (&grpc_static_mdstr_table[85])
|
#define GRPC_MDSTR_TRAILERS (&grpc_static_mdstr_table[86])
|
||||||
/* "transfer-encoding" */
|
/* "transfer-encoding" */
|
||||||
#define GRPC_MDSTR_TRANSFER_ENCODING (&grpc_static_mdstr_table[86])
|
#define GRPC_MDSTR_TRANSFER_ENCODING (&grpc_static_mdstr_table[87])
|
||||||
/* "user-agent" */
|
/* "user-agent" */
|
||||||
#define GRPC_MDSTR_USER_AGENT (&grpc_static_mdstr_table[87])
|
#define GRPC_MDSTR_USER_AGENT (&grpc_static_mdstr_table[88])
|
||||||
/* "vary" */
|
/* "vary" */
|
||||||
#define GRPC_MDSTR_VARY (&grpc_static_mdstr_table[88])
|
#define GRPC_MDSTR_VARY (&grpc_static_mdstr_table[89])
|
||||||
/* "via" */
|
/* "via" */
|
||||||
#define GRPC_MDSTR_VIA (&grpc_static_mdstr_table[89])
|
#define GRPC_MDSTR_VIA (&grpc_static_mdstr_table[90])
|
||||||
/* "www-authenticate" */
|
/* "www-authenticate" */
|
||||||
#define GRPC_MDSTR_WWW_AUTHENTICATE (&grpc_static_mdstr_table[90])
|
#define GRPC_MDSTR_WWW_AUTHENTICATE (&grpc_static_mdstr_table[91])
|
||||||
|
|
||||||
#define GRPC_STATIC_MDELEM_COUNT 80
|
#define GRPC_STATIC_MDELEM_COUNT 81
|
||||||
extern grpc_mdelem grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT];
|
extern grpc_mdelem grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT];
|
||||||
extern uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT];
|
extern uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT];
|
||||||
/* "accept-charset": "" */
|
/* "accept-charset": "" */
|
||||||
|
|
@ -335,73 +337,76 @@ extern uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT];
|
||||||
#define GRPC_MDELEM_LAST_MODIFIED_EMPTY (&grpc_static_mdelem_table[45])
|
#define GRPC_MDELEM_LAST_MODIFIED_EMPTY (&grpc_static_mdelem_table[45])
|
||||||
/* "link": "" */
|
/* "link": "" */
|
||||||
#define GRPC_MDELEM_LINK_EMPTY (&grpc_static_mdelem_table[46])
|
#define GRPC_MDELEM_LINK_EMPTY (&grpc_static_mdelem_table[46])
|
||||||
/* "load-reporting": "" */
|
/* "load-reporting-initial": "" */
|
||||||
#define GRPC_MDELEM_LOAD_REPORTING_EMPTY (&grpc_static_mdelem_table[47])
|
#define GRPC_MDELEM_LOAD_REPORTING_INITIAL_EMPTY (&grpc_static_mdelem_table[47])
|
||||||
|
/* "load-reporting-trailing": "" */
|
||||||
|
#define GRPC_MDELEM_LOAD_REPORTING_TRAILING_EMPTY \
|
||||||
|
(&grpc_static_mdelem_table[48])
|
||||||
/* "location": "" */
|
/* "location": "" */
|
||||||
#define GRPC_MDELEM_LOCATION_EMPTY (&grpc_static_mdelem_table[48])
|
#define GRPC_MDELEM_LOCATION_EMPTY (&grpc_static_mdelem_table[49])
|
||||||
/* "max-forwards": "" */
|
/* "max-forwards": "" */
|
||||||
#define GRPC_MDELEM_MAX_FORWARDS_EMPTY (&grpc_static_mdelem_table[49])
|
#define GRPC_MDELEM_MAX_FORWARDS_EMPTY (&grpc_static_mdelem_table[50])
|
||||||
/* ":method": "GET" */
|
/* ":method": "GET" */
|
||||||
#define GRPC_MDELEM_METHOD_GET (&grpc_static_mdelem_table[50])
|
#define GRPC_MDELEM_METHOD_GET (&grpc_static_mdelem_table[51])
|
||||||
/* ":method": "POST" */
|
/* ":method": "POST" */
|
||||||
#define GRPC_MDELEM_METHOD_POST (&grpc_static_mdelem_table[51])
|
#define GRPC_MDELEM_METHOD_POST (&grpc_static_mdelem_table[52])
|
||||||
/* ":method": "PUT" */
|
/* ":method": "PUT" */
|
||||||
#define GRPC_MDELEM_METHOD_PUT (&grpc_static_mdelem_table[52])
|
#define GRPC_MDELEM_METHOD_PUT (&grpc_static_mdelem_table[53])
|
||||||
/* ":path": "/" */
|
/* ":path": "/" */
|
||||||
#define GRPC_MDELEM_PATH_SLASH (&grpc_static_mdelem_table[53])
|
#define GRPC_MDELEM_PATH_SLASH (&grpc_static_mdelem_table[54])
|
||||||
/* ":path": "/index.html" */
|
/* ":path": "/index.html" */
|
||||||
#define GRPC_MDELEM_PATH_SLASH_INDEX_DOT_HTML (&grpc_static_mdelem_table[54])
|
#define GRPC_MDELEM_PATH_SLASH_INDEX_DOT_HTML (&grpc_static_mdelem_table[55])
|
||||||
/* "proxy-authenticate": "" */
|
/* "proxy-authenticate": "" */
|
||||||
#define GRPC_MDELEM_PROXY_AUTHENTICATE_EMPTY (&grpc_static_mdelem_table[55])
|
#define GRPC_MDELEM_PROXY_AUTHENTICATE_EMPTY (&grpc_static_mdelem_table[56])
|
||||||
/* "proxy-authorization": "" */
|
/* "proxy-authorization": "" */
|
||||||
#define GRPC_MDELEM_PROXY_AUTHORIZATION_EMPTY (&grpc_static_mdelem_table[56])
|
#define GRPC_MDELEM_PROXY_AUTHORIZATION_EMPTY (&grpc_static_mdelem_table[57])
|
||||||
/* "range": "" */
|
/* "range": "" */
|
||||||
#define GRPC_MDELEM_RANGE_EMPTY (&grpc_static_mdelem_table[57])
|
#define GRPC_MDELEM_RANGE_EMPTY (&grpc_static_mdelem_table[58])
|
||||||
/* "referer": "" */
|
/* "referer": "" */
|
||||||
#define GRPC_MDELEM_REFERER_EMPTY (&grpc_static_mdelem_table[58])
|
#define GRPC_MDELEM_REFERER_EMPTY (&grpc_static_mdelem_table[59])
|
||||||
/* "refresh": "" */
|
/* "refresh": "" */
|
||||||
#define GRPC_MDELEM_REFRESH_EMPTY (&grpc_static_mdelem_table[59])
|
#define GRPC_MDELEM_REFRESH_EMPTY (&grpc_static_mdelem_table[60])
|
||||||
/* "retry-after": "" */
|
/* "retry-after": "" */
|
||||||
#define GRPC_MDELEM_RETRY_AFTER_EMPTY (&grpc_static_mdelem_table[60])
|
#define GRPC_MDELEM_RETRY_AFTER_EMPTY (&grpc_static_mdelem_table[61])
|
||||||
/* ":scheme": "grpc" */
|
/* ":scheme": "grpc" */
|
||||||
#define GRPC_MDELEM_SCHEME_GRPC (&grpc_static_mdelem_table[61])
|
#define GRPC_MDELEM_SCHEME_GRPC (&grpc_static_mdelem_table[62])
|
||||||
/* ":scheme": "http" */
|
/* ":scheme": "http" */
|
||||||
#define GRPC_MDELEM_SCHEME_HTTP (&grpc_static_mdelem_table[62])
|
#define GRPC_MDELEM_SCHEME_HTTP (&grpc_static_mdelem_table[63])
|
||||||
/* ":scheme": "https" */
|
/* ":scheme": "https" */
|
||||||
#define GRPC_MDELEM_SCHEME_HTTPS (&grpc_static_mdelem_table[63])
|
#define GRPC_MDELEM_SCHEME_HTTPS (&grpc_static_mdelem_table[64])
|
||||||
/* "server": "" */
|
/* "server": "" */
|
||||||
#define GRPC_MDELEM_SERVER_EMPTY (&grpc_static_mdelem_table[64])
|
#define GRPC_MDELEM_SERVER_EMPTY (&grpc_static_mdelem_table[65])
|
||||||
/* "set-cookie": "" */
|
/* "set-cookie": "" */
|
||||||
#define GRPC_MDELEM_SET_COOKIE_EMPTY (&grpc_static_mdelem_table[65])
|
#define GRPC_MDELEM_SET_COOKIE_EMPTY (&grpc_static_mdelem_table[66])
|
||||||
/* ":status": "200" */
|
/* ":status": "200" */
|
||||||
#define GRPC_MDELEM_STATUS_200 (&grpc_static_mdelem_table[66])
|
#define GRPC_MDELEM_STATUS_200 (&grpc_static_mdelem_table[67])
|
||||||
/* ":status": "204" */
|
/* ":status": "204" */
|
||||||
#define GRPC_MDELEM_STATUS_204 (&grpc_static_mdelem_table[67])
|
#define GRPC_MDELEM_STATUS_204 (&grpc_static_mdelem_table[68])
|
||||||
/* ":status": "206" */
|
/* ":status": "206" */
|
||||||
#define GRPC_MDELEM_STATUS_206 (&grpc_static_mdelem_table[68])
|
#define GRPC_MDELEM_STATUS_206 (&grpc_static_mdelem_table[69])
|
||||||
/* ":status": "304" */
|
/* ":status": "304" */
|
||||||
#define GRPC_MDELEM_STATUS_304 (&grpc_static_mdelem_table[69])
|
#define GRPC_MDELEM_STATUS_304 (&grpc_static_mdelem_table[70])
|
||||||
/* ":status": "400" */
|
/* ":status": "400" */
|
||||||
#define GRPC_MDELEM_STATUS_400 (&grpc_static_mdelem_table[70])
|
#define GRPC_MDELEM_STATUS_400 (&grpc_static_mdelem_table[71])
|
||||||
/* ":status": "404" */
|
/* ":status": "404" */
|
||||||
#define GRPC_MDELEM_STATUS_404 (&grpc_static_mdelem_table[71])
|
#define GRPC_MDELEM_STATUS_404 (&grpc_static_mdelem_table[72])
|
||||||
/* ":status": "500" */
|
/* ":status": "500" */
|
||||||
#define GRPC_MDELEM_STATUS_500 (&grpc_static_mdelem_table[72])
|
#define GRPC_MDELEM_STATUS_500 (&grpc_static_mdelem_table[73])
|
||||||
/* "strict-transport-security": "" */
|
/* "strict-transport-security": "" */
|
||||||
#define GRPC_MDELEM_STRICT_TRANSPORT_SECURITY_EMPTY \
|
#define GRPC_MDELEM_STRICT_TRANSPORT_SECURITY_EMPTY \
|
||||||
(&grpc_static_mdelem_table[73])
|
(&grpc_static_mdelem_table[74])
|
||||||
/* "te": "trailers" */
|
/* "te": "trailers" */
|
||||||
#define GRPC_MDELEM_TE_TRAILERS (&grpc_static_mdelem_table[74])
|
#define GRPC_MDELEM_TE_TRAILERS (&grpc_static_mdelem_table[75])
|
||||||
/* "transfer-encoding": "" */
|
/* "transfer-encoding": "" */
|
||||||
#define GRPC_MDELEM_TRANSFER_ENCODING_EMPTY (&grpc_static_mdelem_table[75])
|
#define GRPC_MDELEM_TRANSFER_ENCODING_EMPTY (&grpc_static_mdelem_table[76])
|
||||||
/* "user-agent": "" */
|
/* "user-agent": "" */
|
||||||
#define GRPC_MDELEM_USER_AGENT_EMPTY (&grpc_static_mdelem_table[76])
|
#define GRPC_MDELEM_USER_AGENT_EMPTY (&grpc_static_mdelem_table[77])
|
||||||
/* "vary": "" */
|
/* "vary": "" */
|
||||||
#define GRPC_MDELEM_VARY_EMPTY (&grpc_static_mdelem_table[77])
|
#define GRPC_MDELEM_VARY_EMPTY (&grpc_static_mdelem_table[78])
|
||||||
/* "via": "" */
|
/* "via": "" */
|
||||||
#define GRPC_MDELEM_VIA_EMPTY (&grpc_static_mdelem_table[78])
|
#define GRPC_MDELEM_VIA_EMPTY (&grpc_static_mdelem_table[79])
|
||||||
/* "www-authenticate": "" */
|
/* "www-authenticate": "" */
|
||||||
#define GRPC_MDELEM_WWW_AUTHENTICATE_EMPTY (&grpc_static_mdelem_table[79])
|
#define GRPC_MDELEM_WWW_AUTHENTICATE_EMPTY (&grpc_static_mdelem_table[80])
|
||||||
|
|
||||||
extern const uint8_t
|
extern const uint8_t
|
||||||
grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT * 2];
|
grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT * 2];
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,8 @@ extern void grpc_chttp2_plugin_init(void);
|
||||||
extern void grpc_chttp2_plugin_shutdown(void);
|
extern void grpc_chttp2_plugin_shutdown(void);
|
||||||
extern void grpc_client_config_init(void);
|
extern void grpc_client_config_init(void);
|
||||||
extern void grpc_client_config_shutdown(void);
|
extern void grpc_client_config_shutdown(void);
|
||||||
|
extern void grpc_lb_policy_grpclb_init(void);
|
||||||
|
extern void grpc_lb_policy_grpclb_shutdown(void);
|
||||||
extern void grpc_lb_policy_pick_first_init(void);
|
extern void grpc_lb_policy_pick_first_init(void);
|
||||||
extern void grpc_lb_policy_pick_first_shutdown(void);
|
extern void grpc_lb_policy_pick_first_shutdown(void);
|
||||||
extern void grpc_lb_policy_round_robin_init(void);
|
extern void grpc_lb_policy_round_robin_init(void);
|
||||||
|
|
@ -55,6 +57,8 @@ void grpc_register_built_in_plugins(void) {
|
||||||
grpc_chttp2_plugin_shutdown);
|
grpc_chttp2_plugin_shutdown);
|
||||||
grpc_register_plugin(grpc_client_config_init,
|
grpc_register_plugin(grpc_client_config_init,
|
||||||
grpc_client_config_shutdown);
|
grpc_client_config_shutdown);
|
||||||
|
grpc_register_plugin(grpc_lb_policy_grpclb_init,
|
||||||
|
grpc_lb_policy_grpclb_shutdown);
|
||||||
grpc_register_plugin(grpc_lb_policy_pick_first_init,
|
grpc_register_plugin(grpc_lb_policy_pick_first_init,
|
||||||
grpc_lb_policy_pick_first_shutdown);
|
grpc_lb_policy_pick_first_shutdown);
|
||||||
grpc_register_plugin(grpc_lb_policy_round_robin_init,
|
grpc_register_plugin(grpc_lb_policy_round_robin_init,
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,8 @@ extern void grpc_resolver_sockaddr_init(void);
|
||||||
extern void grpc_resolver_sockaddr_shutdown(void);
|
extern void grpc_resolver_sockaddr_shutdown(void);
|
||||||
extern void grpc_load_reporting_plugin_init(void);
|
extern void grpc_load_reporting_plugin_init(void);
|
||||||
extern void grpc_load_reporting_plugin_shutdown(void);
|
extern void grpc_load_reporting_plugin_shutdown(void);
|
||||||
|
extern void grpc_lb_policy_grpclb_init(void);
|
||||||
|
extern void grpc_lb_policy_grpclb_shutdown(void);
|
||||||
extern void grpc_lb_policy_pick_first_init(void);
|
extern void grpc_lb_policy_pick_first_init(void);
|
||||||
extern void grpc_lb_policy_pick_first_shutdown(void);
|
extern void grpc_lb_policy_pick_first_shutdown(void);
|
||||||
extern void grpc_lb_policy_round_robin_init(void);
|
extern void grpc_lb_policy_round_robin_init(void);
|
||||||
|
|
@ -61,6 +63,8 @@ void grpc_register_built_in_plugins(void) {
|
||||||
grpc_resolver_sockaddr_shutdown);
|
grpc_resolver_sockaddr_shutdown);
|
||||||
grpc_register_plugin(grpc_load_reporting_plugin_init,
|
grpc_register_plugin(grpc_load_reporting_plugin_init,
|
||||||
grpc_load_reporting_plugin_shutdown);
|
grpc_load_reporting_plugin_shutdown);
|
||||||
|
grpc_register_plugin(grpc_lb_policy_grpclb_init,
|
||||||
|
grpc_lb_policy_grpclb_shutdown);
|
||||||
grpc_register_plugin(grpc_lb_policy_pick_first_init,
|
grpc_register_plugin(grpc_lb_policy_pick_first_init,
|
||||||
grpc_lb_policy_pick_first_shutdown);
|
grpc_lb_policy_pick_first_shutdown);
|
||||||
grpc_register_plugin(grpc_lb_policy_round_robin_init,
|
grpc_register_plugin(grpc_lb_policy_round_robin_init,
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,8 @@ ServerContext::ServerContext()
|
||||||
deadline_(gpr_inf_future(GPR_CLOCK_REALTIME)),
|
deadline_(gpr_inf_future(GPR_CLOCK_REALTIME)),
|
||||||
call_(nullptr),
|
call_(nullptr),
|
||||||
cq_(nullptr),
|
cq_(nullptr),
|
||||||
sent_initial_metadata_(false) {}
|
sent_initial_metadata_(false),
|
||||||
|
compression_level_set_(false) {}
|
||||||
|
|
||||||
ServerContext::ServerContext(gpr_timespec deadline, grpc_metadata* metadata,
|
ServerContext::ServerContext(gpr_timespec deadline, grpc_metadata* metadata,
|
||||||
size_t metadata_count)
|
size_t metadata_count)
|
||||||
|
|
@ -139,7 +140,8 @@ ServerContext::ServerContext(gpr_timespec deadline, grpc_metadata* metadata,
|
||||||
deadline_(deadline),
|
deadline_(deadline),
|
||||||
call_(nullptr),
|
call_(nullptr),
|
||||||
cq_(nullptr),
|
cq_(nullptr),
|
||||||
sent_initial_metadata_(false) {
|
sent_initial_metadata_(false),
|
||||||
|
compression_level_set_(false) {
|
||||||
for (size_t i = 0; i < metadata_count; i++) {
|
for (size_t i = 0; i < metadata_count; i++) {
|
||||||
client_metadata_.insert(std::pair<grpc::string_ref, grpc::string_ref>(
|
client_metadata_.insert(std::pair<grpc::string_ref, grpc::string_ref>(
|
||||||
metadata[i].key,
|
metadata[i].key,
|
||||||
|
|
@ -194,15 +196,6 @@ bool ServerContext::IsCancelled() const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServerContext::set_compression_level(grpc_compression_level level) {
|
|
||||||
// TODO(dgq): get rid of grpc_call_compression_for_level and propagate the
|
|
||||||
// compression level by adding a new argument to
|
|
||||||
// CallOpSendInitialMetadata::SendInitialMetadata.
|
|
||||||
const grpc_compression_algorithm algorithm_for_level =
|
|
||||||
grpc_call_compression_for_level(call_, level);
|
|
||||||
set_compression_algorithm(algorithm_for_level);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ServerContext::set_compression_algorithm(
|
void ServerContext::set_compression_algorithm(
|
||||||
grpc_compression_algorithm algorithm) {
|
grpc_compression_algorithm algorithm) {
|
||||||
char* algorithm_name = NULL;
|
char* algorithm_name = NULL;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<packages>
|
|
||||||
<package id="NUnit.ConsoleRunner" version="3.2.0" />
|
|
||||||
<package id="OpenCover" version="4.6.519" />
|
|
||||||
<package id="ReportGenerator" version="2.4.4.0" />
|
|
||||||
</packages>
|
|
||||||
|
|
@ -58,10 +58,11 @@ namespace Grpc.Core.Tests
|
||||||
[Test]
|
[Test]
|
||||||
public void TestsJsonUpToDate()
|
public void TestsJsonUpToDate()
|
||||||
{
|
{
|
||||||
var discoveredTests = DiscoverAllTestClasses();
|
Dictionary<string, List<string>> discoveredTests = DiscoverAllTestClasses();
|
||||||
string discoveredTestsJson = JsonConvert.SerializeObject(discoveredTests, Formatting.Indented);
|
Dictionary<string, List<string>> testsFromFile
|
||||||
|
= JsonConvert.DeserializeObject<Dictionary<string, List<string>>>(ReadTestsJson());
|
||||||
|
|
||||||
Assert.AreEqual(discoveredTestsJson, ReadTestsJson());
|
Assert.AreEqual(discoveredTests, testsFromFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -4,4 +4,7 @@
|
||||||
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
|
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
|
||||||
<package id="NUnit" version="3.2.0" targetFramework="net45" />
|
<package id="NUnit" version="3.2.0" targetFramework="net45" />
|
||||||
<package id="NUnitLite" version="3.2.0" targetFramework="net45" />
|
<package id="NUnitLite" version="3.2.0" targetFramework="net45" />
|
||||||
</packages>
|
<package id="NUnit.ConsoleRunner" version="3.2.0" />
|
||||||
|
<package id="OpenCover" version="4.6.519" />
|
||||||
|
<package id="ReportGenerator" version="2.4.4.0" />
|
||||||
|
</packages>
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,10 @@
|
||||||
},
|
},
|
||||||
"Newtonsoft.Json": "8.0.3",
|
"Newtonsoft.Json": "8.0.3",
|
||||||
"NUnit": "3.2.0",
|
"NUnit": "3.2.0",
|
||||||
"NUnitLite": "3.2.0-*"
|
"NUnitLite": "3.2.0-*",
|
||||||
|
"NUnit.ConsoleRunner": "3.2.0",
|
||||||
|
"OpenCover": "4.6.519",
|
||||||
|
"ReportGenerator": "2.4.4.0"
|
||||||
},
|
},
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"net45": { },
|
"net45": { },
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
</packages>
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
</packages>
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
</packages>
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<packages>
|
||||||
|
</packages>
|
||||||
|
|
@ -68,6 +68,8 @@ using v8::Value;
|
||||||
Nan::Callback *CallCredentials::constructor;
|
Nan::Callback *CallCredentials::constructor;
|
||||||
Persistent<FunctionTemplate> CallCredentials::fun_tpl;
|
Persistent<FunctionTemplate> CallCredentials::fun_tpl;
|
||||||
|
|
||||||
|
static Callback *plugin_callback;
|
||||||
|
|
||||||
CallCredentials::CallCredentials(grpc_call_credentials *credentials)
|
CallCredentials::CallCredentials(grpc_call_credentials *credentials)
|
||||||
: wrapped_credentials(credentials) {}
|
: wrapped_credentials(credentials) {}
|
||||||
|
|
||||||
|
|
@ -88,6 +90,11 @@ void CallCredentials::Init(Local<Object> exports) {
|
||||||
Nan::New<FunctionTemplate>(CreateFromPlugin)).ToLocalChecked());
|
Nan::New<FunctionTemplate>(CreateFromPlugin)).ToLocalChecked());
|
||||||
Nan::Set(exports, Nan::New("CallCredentials").ToLocalChecked(), ctr);
|
Nan::Set(exports, Nan::New("CallCredentials").ToLocalChecked(), ctr);
|
||||||
constructor = new Nan::Callback(ctr);
|
constructor = new Nan::Callback(ctr);
|
||||||
|
|
||||||
|
Local<FunctionTemplate> callback_tpl =
|
||||||
|
Nan::New<FunctionTemplate>(PluginCallback);
|
||||||
|
plugin_callback = new Callback(
|
||||||
|
Nan::GetFunction(callback_tpl).ToLocalChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CallCredentials::HasInstance(Local<Value> val) {
|
bool CallCredentials::HasInstance(Local<Value> val) {
|
||||||
|
|
@ -195,23 +202,28 @@ NAN_METHOD(PluginCallback) {
|
||||||
return Nan::ThrowTypeError(
|
return Nan::ThrowTypeError(
|
||||||
"The callback's third argument must be an object");
|
"The callback's third argument must be an object");
|
||||||
}
|
}
|
||||||
|
if (!info[3]->IsObject()) {
|
||||||
|
return Nan::ThrowTypeError(
|
||||||
|
"The callback's fourth argument must be an object");
|
||||||
|
}
|
||||||
shared_ptr<Resources> resources(new Resources);
|
shared_ptr<Resources> resources(new Resources);
|
||||||
grpc_status_code code = static_cast<grpc_status_code>(
|
grpc_status_code code = static_cast<grpc_status_code>(
|
||||||
Nan::To<uint32_t>(info[0]).FromJust());
|
Nan::To<uint32_t>(info[0]).FromJust());
|
||||||
Utf8String details_utf8_str(info[1]);
|
Utf8String details_utf8_str(info[1]);
|
||||||
char *details = *details_utf8_str;
|
char *details = *details_utf8_str;
|
||||||
grpc_metadata_array array;
|
grpc_metadata_array array;
|
||||||
|
Local<Object> callback_data = Nan::To<Object>(info[3]).ToLocalChecked();
|
||||||
if (!CreateMetadataArray(Nan::To<Object>(info[2]).ToLocalChecked(),
|
if (!CreateMetadataArray(Nan::To<Object>(info[2]).ToLocalChecked(),
|
||||||
&array, resources)){
|
&array, resources)){
|
||||||
return Nan::ThrowError("Failed to parse metadata");
|
return Nan::ThrowError("Failed to parse metadata");
|
||||||
}
|
}
|
||||||
grpc_credentials_plugin_metadata_cb cb =
|
grpc_credentials_plugin_metadata_cb cb =
|
||||||
reinterpret_cast<grpc_credentials_plugin_metadata_cb>(
|
reinterpret_cast<grpc_credentials_plugin_metadata_cb>(
|
||||||
Nan::Get(info.Callee(),
|
Nan::Get(callback_data,
|
||||||
Nan::New("cb").ToLocalChecked()
|
Nan::New("cb").ToLocalChecked()
|
||||||
).ToLocalChecked().As<External>()->Value());
|
).ToLocalChecked().As<External>()->Value());
|
||||||
void *user_data =
|
void *user_data =
|
||||||
Nan::Get(info.Callee(),
|
Nan::Get(callback_data,
|
||||||
Nan::New("user_data").ToLocalChecked()
|
Nan::New("user_data").ToLocalChecked()
|
||||||
).ToLocalChecked().As<External>()->Value();
|
).ToLocalChecked().As<External>()->Value();
|
||||||
cb(user_data, array.metadata, array.count, code, details);
|
cb(user_data, array.metadata, array.count, code, details);
|
||||||
|
|
@ -227,17 +239,17 @@ NAUV_WORK_CB(SendPluginCallback) {
|
||||||
while (!callbacks.empty()) {
|
while (!callbacks.empty()) {
|
||||||
plugin_callback_data *data = callbacks.front();
|
plugin_callback_data *data = callbacks.front();
|
||||||
callbacks.pop_front();
|
callbacks.pop_front();
|
||||||
// Attach cb and user_data to plugin_callback so that it can access them later
|
Local<Object> callback_data = Nan::New<Object>();
|
||||||
v8::Local<v8::Function> plugin_callback = Nan::GetFunction(
|
Nan::Set(callback_data, Nan::New("cb").ToLocalChecked(),
|
||||||
Nan::New<v8::FunctionTemplate>(PluginCallback)).ToLocalChecked();
|
|
||||||
Nan::Set(plugin_callback, Nan::New("cb").ToLocalChecked(),
|
|
||||||
Nan::New<v8::External>(reinterpret_cast<void*>(data->cb)));
|
Nan::New<v8::External>(reinterpret_cast<void*>(data->cb)));
|
||||||
Nan::Set(plugin_callback, Nan::New("user_data").ToLocalChecked(),
|
Nan::Set(callback_data, Nan::New("user_data").ToLocalChecked(),
|
||||||
Nan::New<v8::External>(data->user_data));
|
Nan::New<v8::External>(data->user_data));
|
||||||
const int argc = 2;
|
const int argc = 3;
|
||||||
v8::Local<v8::Value> argv[argc] = {
|
v8::Local<v8::Value> argv[argc] = {
|
||||||
Nan::New(data->service_url).ToLocalChecked(),
|
Nan::New(data->service_url).ToLocalChecked(),
|
||||||
plugin_callback
|
callback_data,
|
||||||
|
// Get Local<Function> from Nan::Callback*
|
||||||
|
**plugin_callback
|
||||||
};
|
};
|
||||||
Nan::Callback *callback = state->callback;
|
Nan::Callback *callback = state->callback;
|
||||||
callback->Call(argc, argv);
|
callback->Call(argc, argv);
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,11 @@
|
||||||
"lodash": "^3.9.3",
|
"lodash": "^3.9.3",
|
||||||
"google-protobuf": "^3.0.0-alpha.5"
|
"google-protobuf": "^3.0.0-alpha.5"
|
||||||
},
|
},
|
||||||
"files": {
|
"files": [
|
||||||
"LICENSE",
|
"LICENSE",
|
||||||
"health.js",
|
"health.js",
|
||||||
"v1"
|
"v1"
|
||||||
},
|
],
|
||||||
"main": "src/node/index.js",
|
"main": "src/node/index.js",
|
||||||
"license": "BSD-3-Clause"
|
"license": "BSD-3-Clause"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,8 @@ exports.createSsl = ChannelCredentials.createSsl;
|
||||||
* @return {CallCredentials} The credentials object
|
* @return {CallCredentials} The credentials object
|
||||||
*/
|
*/
|
||||||
exports.createFromMetadataGenerator = function(metadata_generator) {
|
exports.createFromMetadataGenerator = function(metadata_generator) {
|
||||||
return CallCredentials.createFromPlugin(function(service_url, callback) {
|
return CallCredentials.createFromPlugin(function(service_url, cb_data,
|
||||||
|
callback) {
|
||||||
metadata_generator({service_url: service_url}, function(error, metadata) {
|
metadata_generator({service_url: service_url}, function(error, metadata) {
|
||||||
var code = grpc.status.OK;
|
var code = grpc.status.OK;
|
||||||
var message = '';
|
var message = '';
|
||||||
|
|
@ -107,7 +108,7 @@ exports.createFromMetadataGenerator = function(metadata_generator) {
|
||||||
metadata = new Metadata();
|
metadata = new Metadata();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
callback(code, message, metadata._getCoreRepresentation());
|
callback(code, message, metadata._getCoreRepresentation(), cb_data);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -58,65 +58,27 @@
|
||||||
#include "byte_buffer.h"
|
#include "byte_buffer.h"
|
||||||
|
|
||||||
zend_class_entry *grpc_ce_call;
|
zend_class_entry *grpc_ce_call;
|
||||||
|
#if PHP_MAJOR_VERSION >= 7
|
||||||
#if PHP_MAJOR_VERSION < 7
|
static zend_object_handlers call_ce_handlers;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Frees and destroys an instance of wrapped_grpc_call */
|
/* Frees and destroys an instance of wrapped_grpc_call */
|
||||||
void free_wrapped_grpc_call(void *object TSRMLS_DC) {
|
PHP_GRPC_FREE_WRAPPED_FUNC_START(wrapped_grpc_call)
|
||||||
wrapped_grpc_call *call = (wrapped_grpc_call *)object;
|
if (p->owned && p->wrapped != NULL) {
|
||||||
if (call->owned && call->wrapped != NULL) {
|
grpc_call_destroy(p->wrapped);
|
||||||
grpc_call_destroy(call->wrapped);
|
|
||||||
}
|
}
|
||||||
zend_object_std_dtor(&call->std TSRMLS_CC);
|
PHP_GRPC_FREE_WRAPPED_FUNC_END()
|
||||||
efree(call);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initializes an instance of wrapped_grpc_call to be associated with an object
|
/* Initializes an instance of wrapped_grpc_call to be associated with an object
|
||||||
* of a class specified by class_type */
|
* of a class specified by class_type */
|
||||||
zend_object_value create_wrapped_grpc_call(zend_class_entry *class_type
|
php_grpc_zend_object create_wrapped_grpc_call(zend_class_entry *class_type
|
||||||
TSRMLS_DC) {
|
TSRMLS_DC) {
|
||||||
zend_object_value retval;
|
PHP_GRPC_ALLOC_CLASS_OBJECT(wrapped_grpc_call);
|
||||||
wrapped_grpc_call *intern;
|
|
||||||
|
|
||||||
intern = (wrapped_grpc_call *)emalloc(sizeof(wrapped_grpc_call));
|
|
||||||
memset(intern, 0, sizeof(wrapped_grpc_call));
|
|
||||||
|
|
||||||
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
|
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
|
||||||
object_properties_init(&intern->std, class_type);
|
object_properties_init(&intern->std, class_type);
|
||||||
retval.handle = zend_objects_store_put(
|
PHP_GRPC_FREE_CLASS_OBJECT(wrapped_grpc_call, call_ce_handlers);
|
||||||
intern, (zend_objects_store_dtor_t)zend_objects_destroy_object,
|
|
||||||
free_wrapped_grpc_call, NULL TSRMLS_CC);
|
|
||||||
retval.handlers = zend_get_std_object_handlers();
|
|
||||||
return retval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
static zend_object_handlers call_ce_handlers;
|
|
||||||
|
|
||||||
/* Frees and destroys an instance of wrapped_grpc_call */
|
|
||||||
static void free_wrapped_grpc_call(zend_object *object) {
|
|
||||||
wrapped_grpc_call *call = wrapped_grpc_call_from_obj(object);
|
|
||||||
if (call->owned && call->wrapped != NULL) {
|
|
||||||
grpc_call_destroy(call->wrapped);
|
|
||||||
}
|
|
||||||
zend_object_std_dtor(&call->std);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initializes an instance of wrapped_grpc_call to be associated with an
|
|
||||||
* object of a class specified by class_type */
|
|
||||||
zend_object *create_wrapped_grpc_call(zend_class_entry *class_type) {
|
|
||||||
wrapped_grpc_call *intern;
|
|
||||||
intern = ecalloc(1, sizeof(wrapped_grpc_call) +
|
|
||||||
zend_object_properties_size(class_type));
|
|
||||||
zend_object_std_init(&intern->std, class_type);
|
|
||||||
object_properties_init(&intern->std, class_type);
|
|
||||||
intern->std.handlers = &call_ce_handlers;
|
|
||||||
return &intern->std;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Creates and returns a PHP array object with the data in a
|
/* Creates and returns a PHP array object with the data in a
|
||||||
* grpc_metadata_array. Returns NULL on failure */
|
* grpc_metadata_array. Returns NULL on failure */
|
||||||
zval *grpc_parse_metadata_array(grpc_metadata_array
|
zval *grpc_parse_metadata_array(grpc_metadata_array
|
||||||
|
|
@ -132,11 +94,7 @@ zval *grpc_parse_metadata_array(grpc_metadata_array
|
||||||
char *str_key;
|
char *str_key;
|
||||||
char *str_val;
|
char *str_val;
|
||||||
size_t key_len;
|
size_t key_len;
|
||||||
#if PHP_MAJOR_VERSION < 7
|
zval *data = NULL;
|
||||||
zval **data = NULL;
|
|
||||||
#else
|
|
||||||
zval *data;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
array_hash = Z_ARRVAL_P(array);
|
array_hash = Z_ARRVAL_P(array);
|
||||||
grpc_metadata *elem;
|
grpc_metadata *elem;
|
||||||
|
|
@ -147,14 +105,9 @@ zval *grpc_parse_metadata_array(grpc_metadata_array
|
||||||
memcpy(str_key, elem->key, key_len);
|
memcpy(str_key, elem->key, key_len);
|
||||||
str_val = ecalloc(elem->value_length + 1, sizeof(char));
|
str_val = ecalloc(elem->value_length + 1, sizeof(char));
|
||||||
memcpy(str_val, elem->value, elem->value_length);
|
memcpy(str_val, elem->value, elem->value_length);
|
||||||
#if PHP_MAJOR_VERSION < 7
|
if (php_grpc_zend_hash_find(array_hash, str_key, key_len, (void **)&data)
|
||||||
if (zend_hash_find(array_hash, str_key, key_len, (void **)data) ==
|
== SUCCESS) {
|
||||||
SUCCESS) {
|
|
||||||
if (Z_TYPE_P(*data) != IS_ARRAY) {
|
|
||||||
#else
|
|
||||||
if ((data = zend_hash_str_find(array_hash, str_key, key_len)) != NULL) {
|
|
||||||
if (Z_TYPE_P(data) != IS_ARRAY) {
|
if (Z_TYPE_P(data) != IS_ARRAY) {
|
||||||
#endif
|
|
||||||
zend_throw_exception(zend_exception_get_default(TSRMLS_C),
|
zend_throw_exception(zend_exception_get_default(TSRMLS_C),
|
||||||
"Metadata hash somehow contains wrong types.",
|
"Metadata hash somehow contains wrong types.",
|
||||||
1 TSRMLS_CC);
|
1 TSRMLS_CC);
|
||||||
|
|
@ -162,13 +115,8 @@ zval *grpc_parse_metadata_array(grpc_metadata_array
|
||||||
efree(str_val);
|
efree(str_val);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#if PHP_MAJOR_VERSION < 7
|
|
||||||
php_grpc_add_next_index_stringl(*data, str_val, elem->value_length,
|
|
||||||
false);
|
|
||||||
#else
|
|
||||||
php_grpc_add_next_index_stringl(data, str_val, elem->value_length,
|
php_grpc_add_next_index_stringl(data, str_val, elem->value_length,
|
||||||
false);
|
false);
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
PHP_GRPC_MAKE_STD_ZVAL(inner_array);
|
PHP_GRPC_MAKE_STD_ZVAL(inner_array);
|
||||||
array_init(inner_array);
|
array_init(inner_array);
|
||||||
|
|
@ -185,96 +133,48 @@ zval *grpc_parse_metadata_array(grpc_metadata_array
|
||||||
bool create_metadata_array(zval *array, grpc_metadata_array *metadata) {
|
bool create_metadata_array(zval *array, grpc_metadata_array *metadata) {
|
||||||
HashTable *array_hash;
|
HashTable *array_hash;
|
||||||
HashTable *inner_array_hash;
|
HashTable *inner_array_hash;
|
||||||
#if PHP_MAJOR_VERSION < 7
|
|
||||||
zval **inner_array;
|
|
||||||
zval **value;
|
|
||||||
HashPosition array_pointer;
|
|
||||||
HashPosition inner_array_pointer;
|
|
||||||
char *key;
|
|
||||||
uint key_len;
|
|
||||||
ulong index;
|
|
||||||
#else
|
|
||||||
zval *inner_array;
|
|
||||||
zval *value;
|
zval *value;
|
||||||
zend_string *key;
|
zval *inner_array;
|
||||||
#endif
|
|
||||||
if (Z_TYPE_P(array) != IS_ARRAY) {
|
if (Z_TYPE_P(array) != IS_ARRAY) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
grpc_metadata_array_init(metadata);
|
grpc_metadata_array_init(metadata);
|
||||||
array_hash = Z_ARRVAL_P(array);
|
array_hash = Z_ARRVAL_P(array);
|
||||||
#if PHP_MAJOR_VERSION < 7
|
|
||||||
for (zend_hash_internal_pointer_reset_ex(array_hash, &array_pointer);
|
char *key;
|
||||||
zend_hash_get_current_data_ex(array_hash, (void**)&inner_array,
|
int key_type;
|
||||||
&array_pointer) == SUCCESS;
|
PHP_GRPC_HASH_FOREACH_STR_KEY_VAL_START(array_hash, key, key_type,
|
||||||
zend_hash_move_forward_ex(array_hash, &array_pointer)) {
|
inner_array)
|
||||||
if (zend_hash_get_current_key_ex(array_hash, &key, &key_len, &index, 0,
|
if (key_type != HASH_KEY_IS_STRING || key == NULL) {
|
||||||
&array_pointer) != HASH_KEY_IS_STRING) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (Z_TYPE_P(*inner_array) != IS_ARRAY) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
inner_array_hash = Z_ARRVAL_P(*inner_array);
|
|
||||||
metadata->capacity += zend_hash_num_elements(inner_array_hash);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
ZEND_HASH_FOREACH_STR_KEY_VAL(array_hash, key, inner_array) {
|
|
||||||
if (key == NULL) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (Z_TYPE_P(inner_array) != IS_ARRAY) {
|
if (Z_TYPE_P(inner_array) != IS_ARRAY) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
inner_array_hash = HASH_OF(inner_array);
|
inner_array_hash = Z_ARRVAL_P(inner_array);
|
||||||
metadata->capacity += zend_hash_num_elements(inner_array_hash);
|
metadata->capacity += zend_hash_num_elements(inner_array_hash);
|
||||||
} ZEND_HASH_FOREACH_END();
|
PHP_GRPC_HASH_FOREACH_END()
|
||||||
#endif
|
|
||||||
|
|
||||||
metadata->metadata = gpr_malloc(metadata->capacity * sizeof(grpc_metadata));
|
metadata->metadata = gpr_malloc(metadata->capacity * sizeof(grpc_metadata));
|
||||||
|
|
||||||
#if PHP_MAJOR_VERSION < 7
|
char *key1 = NULL;
|
||||||
for (zend_hash_internal_pointer_reset_ex(array_hash, &array_pointer);
|
int key_type1;
|
||||||
zend_hash_get_current_data_ex(array_hash, (void**)&inner_array,
|
PHP_GRPC_HASH_FOREACH_STR_KEY_VAL_START(array_hash, key1, key_type1,
|
||||||
&array_pointer) == SUCCESS;
|
inner_array)
|
||||||
zend_hash_move_forward_ex(array_hash, &array_pointer)) {
|
if (key_type1 != HASH_KEY_IS_STRING) {
|
||||||
if (zend_hash_get_current_key_ex(array_hash, &key, &key_len, &index, 0,
|
|
||||||
&array_pointer) != HASH_KEY_IS_STRING) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
inner_array_hash = Z_ARRVAL_P(*inner_array);
|
inner_array_hash = Z_ARRVAL_P(inner_array);
|
||||||
for (zend_hash_internal_pointer_reset_ex(inner_array_hash,
|
PHP_GRPC_HASH_FOREACH_VAL_START(inner_array_hash, value)
|
||||||
&inner_array_pointer);
|
|
||||||
zend_hash_get_current_data_ex(inner_array_hash, (void**)&value,
|
|
||||||
&inner_array_pointer) == SUCCESS;
|
|
||||||
zend_hash_move_forward_ex(inner_array_hash, &inner_array_pointer)) {
|
|
||||||
if (Z_TYPE_P(*value) != IS_STRING) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
metadata->metadata[metadata->count].key = key;
|
|
||||||
metadata->metadata[metadata->count].value = Z_STRVAL_P(*value);
|
|
||||||
metadata->metadata[metadata->count].value_length = Z_STRLEN_P(*value);
|
|
||||||
metadata->count += 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
ZEND_HASH_FOREACH_STR_KEY_VAL(array_hash, key, inner_array) {
|
|
||||||
if (key == NULL) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
inner_array_hash = HASH_OF(inner_array);
|
|
||||||
|
|
||||||
ZEND_HASH_FOREACH_VAL(inner_array_hash, value) {
|
|
||||||
if (Z_TYPE_P(value) != IS_STRING) {
|
if (Z_TYPE_P(value) != IS_STRING) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
metadata->metadata[metadata->count].key = ZSTR_VAL(key);
|
metadata->metadata[metadata->count].key = key1;
|
||||||
metadata->metadata[metadata->count].value = Z_STRVAL_P(value);
|
metadata->metadata[metadata->count].value = Z_STRVAL_P(value);
|
||||||
metadata->metadata[metadata->count].value_length = Z_STRLEN_P(value);
|
metadata->metadata[metadata->count].value_length = Z_STRLEN_P(value);
|
||||||
metadata->count += 1;
|
metadata->count += 1;
|
||||||
} ZEND_HASH_FOREACH_END();
|
PHP_GRPC_HASH_FOREACH_END()
|
||||||
} ZEND_HASH_FOREACH_END();
|
PHP_GRPC_HASH_FOREACH_END()
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -342,23 +242,13 @@ PHP_METHOD(Call, startBatch) {
|
||||||
PHP_GRPC_MAKE_STD_ZVAL(result);
|
PHP_GRPC_MAKE_STD_ZVAL(result);
|
||||||
object_init(result);
|
object_init(result);
|
||||||
php_grpc_ulong index;
|
php_grpc_ulong index;
|
||||||
#if PHP_MAJOR_VERSION < 7
|
|
||||||
zval **value;
|
|
||||||
zval **inner_value;
|
|
||||||
HashPosition array_pointer;
|
|
||||||
zval **message_value;
|
|
||||||
zval **message_flags;
|
|
||||||
char *key;
|
|
||||||
uint key_len;
|
|
||||||
zval *recv_status;
|
zval *recv_status;
|
||||||
#else
|
PHP_GRPC_MAKE_STD_ZVAL(recv_status);
|
||||||
|
object_init(recv_status);
|
||||||
zval *value;
|
zval *value;
|
||||||
zval *inner_value;
|
zval *inner_value;
|
||||||
zval *message_value;
|
zval *message_value;
|
||||||
zval *message_flags;
|
zval *message_flags;
|
||||||
zend_string *key;
|
|
||||||
zval recv_status;
|
|
||||||
#endif
|
|
||||||
wrapped_grpc_call *call = Z_WRAPPED_GRPC_CALL_P(getThis());
|
wrapped_grpc_call *call = Z_WRAPPED_GRPC_CALL_P(getThis());
|
||||||
|
|
||||||
grpc_op ops[8];
|
grpc_op ops[8];
|
||||||
|
|
@ -381,7 +271,6 @@ PHP_METHOD(Call, startBatch) {
|
||||||
char *message_str;
|
char *message_str;
|
||||||
size_t message_len;
|
size_t message_len;
|
||||||
|
|
||||||
|
|
||||||
grpc_metadata_array_init(&metadata);
|
grpc_metadata_array_init(&metadata);
|
||||||
grpc_metadata_array_init(&trailing_metadata);
|
grpc_metadata_array_init(&trailing_metadata);
|
||||||
grpc_metadata_array_init(&recv_metadata);
|
grpc_metadata_array_init(&recv_metadata);
|
||||||
|
|
@ -396,67 +285,63 @@ PHP_METHOD(Call, startBatch) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if PHP_MAJOR_VERSION < 7
|
|
||||||
|
|
||||||
array_hash = Z_ARRVAL_P(array);
|
array_hash = Z_ARRVAL_P(array);
|
||||||
for (zend_hash_internal_pointer_reset_ex(array_hash, &array_pointer);
|
|
||||||
zend_hash_get_current_data_ex(array_hash, (void**)&value,
|
char *key = NULL;
|
||||||
&array_pointer) == SUCCESS;
|
int key_type;
|
||||||
zend_hash_move_forward_ex(array_hash, &array_pointer)) {
|
PHP_GRPC_HASH_FOREACH_LONG_KEY_VAL_START(array_hash, key, key_type, index,
|
||||||
if (zend_hash_get_current_key_ex(array_hash, &key, &key_len, &index, 0,
|
value)
|
||||||
&array_pointer) != HASH_KEY_IS_LONG) {
|
if (key_type != HASH_KEY_IS_LONG || key != NULL) {
|
||||||
zend_throw_exception(spl_ce_InvalidArgumentException,
|
zend_throw_exception(spl_ce_InvalidArgumentException,
|
||||||
"batch keys must be integers", 1 TSRMLS_CC);
|
"batch keys must be integers", 1 TSRMLS_CC);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
switch(index) {
|
switch(index) {
|
||||||
case GRPC_OP_SEND_INITIAL_METADATA:
|
case GRPC_OP_SEND_INITIAL_METADATA:
|
||||||
if (!create_metadata_array(*value, &metadata)) {
|
if (!create_metadata_array(value, &metadata)) {
|
||||||
zend_throw_exception(spl_ce_InvalidArgumentException,
|
zend_throw_exception(spl_ce_InvalidArgumentException,
|
||||||
"Bad metadata value given", 1 TSRMLS_CC);
|
"Bad metadata value given", 1 TSRMLS_CC);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
ops[op_num].data.send_initial_metadata.count =
|
ops[op_num].data.send_initial_metadata.count = metadata.count;
|
||||||
metadata.count;
|
ops[op_num].data.send_initial_metadata.metadata = metadata.metadata;
|
||||||
ops[op_num].data.send_initial_metadata.metadata =
|
|
||||||
metadata.metadata;
|
|
||||||
break;
|
break;
|
||||||
case GRPC_OP_SEND_MESSAGE:
|
case GRPC_OP_SEND_MESSAGE:
|
||||||
if (Z_TYPE_PP(value) != IS_ARRAY) {
|
if (Z_TYPE_P(value) != IS_ARRAY) {
|
||||||
zend_throw_exception(spl_ce_InvalidArgumentException,
|
zend_throw_exception(spl_ce_InvalidArgumentException,
|
||||||
"Expected an array for send message",
|
"Expected an array for send message",
|
||||||
1 TSRMLS_CC);
|
1 TSRMLS_CC);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
message_hash = Z_ARRVAL_PP(value);
|
message_hash = Z_ARRVAL_P(value);
|
||||||
if (zend_hash_find(message_hash, "flags", sizeof("flags"),
|
if (php_grpc_zend_hash_find(message_hash, "flags", sizeof("flags"),
|
||||||
(void **)&message_flags) == SUCCESS) {
|
(void **)&message_flags) == SUCCESS) {
|
||||||
if (Z_TYPE_PP(message_flags) != IS_LONG) {
|
if (Z_TYPE_P(message_flags) != IS_LONG) {
|
||||||
zend_throw_exception(spl_ce_InvalidArgumentException,
|
zend_throw_exception(spl_ce_InvalidArgumentException,
|
||||||
"Expected an int for message flags",
|
"Expected an int for message flags",
|
||||||
1 TSRMLS_CC);
|
1 TSRMLS_CC);
|
||||||
}
|
}
|
||||||
ops[op_num].flags = Z_LVAL_PP(message_flags) & GRPC_WRITE_USED_MASK;
|
ops[op_num].flags = Z_LVAL_P(message_flags) & GRPC_WRITE_USED_MASK;
|
||||||
}
|
}
|
||||||
if (zend_hash_find(message_hash, "message", sizeof("message"),
|
if (php_grpc_zend_hash_find(message_hash, "message", sizeof("message"),
|
||||||
(void **)&message_value) != SUCCESS ||
|
(void **)&message_value) != SUCCESS ||
|
||||||
Z_TYPE_PP(message_value) != IS_STRING) {
|
Z_TYPE_P(message_value) != IS_STRING) {
|
||||||
zend_throw_exception(spl_ce_InvalidArgumentException,
|
zend_throw_exception(spl_ce_InvalidArgumentException,
|
||||||
"Expected a string for send message",
|
"Expected a string for send message",
|
||||||
1 TSRMLS_CC);
|
1 TSRMLS_CC);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
ops[op_num].data.send_message =
|
ops[op_num].data.send_message =
|
||||||
string_to_byte_buffer(Z_STRVAL_PP(message_value),
|
string_to_byte_buffer(Z_STRVAL_P(message_value),
|
||||||
Z_STRLEN_PP(message_value));
|
Z_STRLEN_P(message_value));
|
||||||
break;
|
break;
|
||||||
case GRPC_OP_SEND_CLOSE_FROM_CLIENT:
|
case GRPC_OP_SEND_CLOSE_FROM_CLIENT:
|
||||||
break;
|
break;
|
||||||
case GRPC_OP_SEND_STATUS_FROM_SERVER:
|
case GRPC_OP_SEND_STATUS_FROM_SERVER:
|
||||||
status_hash = Z_ARRVAL_PP(value);
|
status_hash = Z_ARRVAL_P(value);
|
||||||
if (zend_hash_find(status_hash, "metadata", sizeof("metadata"),
|
if (php_grpc_zend_hash_find(status_hash, "metadata", sizeof("metadata"),
|
||||||
(void **)&inner_value) == SUCCESS) {
|
(void **)&inner_value) == SUCCESS) {
|
||||||
if (!create_metadata_array(*inner_value, &trailing_metadata)) {
|
if (!create_metadata_array(inner_value, &trailing_metadata)) {
|
||||||
zend_throw_exception(spl_ce_InvalidArgumentException,
|
zend_throw_exception(spl_ce_InvalidArgumentException,
|
||||||
"Bad trailing metadata value given",
|
"Bad trailing metadata value given",
|
||||||
1 TSRMLS_CC);
|
1 TSRMLS_CC);
|
||||||
|
|
@ -467,32 +352,32 @@ PHP_METHOD(Call, startBatch) {
|
||||||
ops[op_num].data.send_status_from_server.trailing_metadata_count =
|
ops[op_num].data.send_status_from_server.trailing_metadata_count =
|
||||||
trailing_metadata.count;
|
trailing_metadata.count;
|
||||||
}
|
}
|
||||||
if (zend_hash_find(status_hash, "code", sizeof("code"),
|
if (php_grpc_zend_hash_find(status_hash, "code", sizeof("code"),
|
||||||
(void**)&inner_value) == SUCCESS) {
|
(void**)&inner_value) == SUCCESS) {
|
||||||
if (Z_TYPE_PP(inner_value) != IS_LONG) {
|
if (Z_TYPE_P(inner_value) != IS_LONG) {
|
||||||
zend_throw_exception(spl_ce_InvalidArgumentException,
|
zend_throw_exception(spl_ce_InvalidArgumentException,
|
||||||
"Status code must be an integer",
|
"Status code must be an integer",
|
||||||
1 TSRMLS_CC);
|
1 TSRMLS_CC);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
ops[op_num].data.send_status_from_server.status =
|
ops[op_num].data.send_status_from_server.status =
|
||||||
Z_LVAL_PP(inner_value);
|
Z_LVAL_P(inner_value);
|
||||||
} else {
|
} else {
|
||||||
zend_throw_exception(spl_ce_InvalidArgumentException,
|
zend_throw_exception(spl_ce_InvalidArgumentException,
|
||||||
"Integer status code is required",
|
"Integer status code is required",
|
||||||
1 TSRMLS_CC);
|
1 TSRMLS_CC);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (zend_hash_find(status_hash, "details", sizeof("details"),
|
if (php_grpc_zend_hash_find(status_hash, "details", sizeof("details"),
|
||||||
(void**)&inner_value) == SUCCESS) {
|
(void**)&inner_value) == SUCCESS) {
|
||||||
if (Z_TYPE_PP(inner_value) != IS_STRING) {
|
if (Z_TYPE_P(inner_value) != IS_STRING) {
|
||||||
zend_throw_exception(spl_ce_InvalidArgumentException,
|
zend_throw_exception(spl_ce_InvalidArgumentException,
|
||||||
"Status details must be a string",
|
"Status details must be a string",
|
||||||
1 TSRMLS_CC);
|
1 TSRMLS_CC);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
ops[op_num].data.send_status_from_server.status_details =
|
ops[op_num].data.send_status_from_server.status_details =
|
||||||
Z_STRVAL_PP(inner_value);
|
Z_STRVAL_P(inner_value);
|
||||||
} else {
|
} else {
|
||||||
zend_throw_exception(spl_ce_InvalidArgumentException,
|
zend_throw_exception(spl_ce_InvalidArgumentException,
|
||||||
"String status details is required",
|
"String status details is required",
|
||||||
|
|
@ -527,131 +412,7 @@ PHP_METHOD(Call, startBatch) {
|
||||||
ops[op_num].flags = 0;
|
ops[op_num].flags = 0;
|
||||||
ops[op_num].reserved = NULL;
|
ops[op_num].reserved = NULL;
|
||||||
op_num++;
|
op_num++;
|
||||||
}
|
PHP_GRPC_HASH_FOREACH_END()
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
array_hash = HASH_OF(array);
|
|
||||||
ZEND_HASH_FOREACH_KEY_VAL(array_hash, index, key, value) {
|
|
||||||
if (key) {
|
|
||||||
zend_throw_exception(spl_ce_InvalidArgumentException,
|
|
||||||
"batch keys must be integers", 1);
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(index) {
|
|
||||||
case GRPC_OP_SEND_INITIAL_METADATA:
|
|
||||||
if (!create_metadata_array(value, &metadata)) {
|
|
||||||
zend_throw_exception(spl_ce_InvalidArgumentException,
|
|
||||||
"Bad metadata value given", 1);
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
ops[op_num].data.send_initial_metadata.count = metadata.count;
|
|
||||||
ops[op_num].data.send_initial_metadata.metadata = metadata.metadata;
|
|
||||||
break;
|
|
||||||
case GRPC_OP_SEND_MESSAGE:
|
|
||||||
if (Z_TYPE_P(value) != IS_ARRAY) {
|
|
||||||
zend_throw_exception(spl_ce_InvalidArgumentException,
|
|
||||||
"Expected an array for send message", 1);
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
message_hash = HASH_OF(value);
|
|
||||||
if ((message_flags =
|
|
||||||
zend_hash_str_find(message_hash, "flags",
|
|
||||||
sizeof("flags") - 1)) != NULL) {
|
|
||||||
if (Z_TYPE_P(message_flags) != IS_LONG) {
|
|
||||||
zend_throw_exception(spl_ce_InvalidArgumentException,
|
|
||||||
"Expected an int for message flags", 1);
|
|
||||||
}
|
|
||||||
ops[op_num].flags = Z_LVAL_P(message_flags) & GRPC_WRITE_USED_MASK;
|
|
||||||
}
|
|
||||||
if ((message_value = zend_hash_str_find(message_hash, "message",
|
|
||||||
sizeof("message") - 1))
|
|
||||||
== NULL || Z_TYPE_P(message_value) != IS_STRING) {
|
|
||||||
zend_throw_exception(spl_ce_InvalidArgumentException,
|
|
||||||
"Expected a string for send message", 1);
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
ops[op_num].data.send_message =
|
|
||||||
string_to_byte_buffer(Z_STRVAL_P(message_value),
|
|
||||||
Z_STRLEN_P(message_value));
|
|
||||||
break;
|
|
||||||
case GRPC_OP_SEND_CLOSE_FROM_CLIENT:
|
|
||||||
break;
|
|
||||||
case GRPC_OP_SEND_STATUS_FROM_SERVER:
|
|
||||||
status_hash = HASH_OF(value);
|
|
||||||
if ((inner_value = zend_hash_str_find(status_hash, "metadata",
|
|
||||||
sizeof("metadata") - 1))
|
|
||||||
!= NULL) {
|
|
||||||
if (!create_metadata_array(inner_value, &trailing_metadata)) {
|
|
||||||
zend_throw_exception(spl_ce_InvalidArgumentException,
|
|
||||||
"Bad trailing metadata value given", 1);
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
ops[op_num].data.send_status_from_server.trailing_metadata =
|
|
||||||
trailing_metadata.metadata;
|
|
||||||
ops[op_num].data.send_status_from_server.trailing_metadata_count =
|
|
||||||
trailing_metadata.count;
|
|
||||||
}
|
|
||||||
if ((inner_value = zend_hash_str_find(status_hash, "code",
|
|
||||||
sizeof("code") - 1)) != NULL) {
|
|
||||||
if (Z_TYPE_P(inner_value) != IS_LONG) {
|
|
||||||
zend_throw_exception(spl_ce_InvalidArgumentException,
|
|
||||||
"Status code must be an integer", 1);
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
ops[op_num].data.send_status_from_server.status =
|
|
||||||
Z_LVAL_P(inner_value);
|
|
||||||
} else {
|
|
||||||
zend_throw_exception(spl_ce_InvalidArgumentException,
|
|
||||||
"Integer status code is required", 1);
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
if ((inner_value = zend_hash_str_find(status_hash, "details",
|
|
||||||
sizeof("details") - 1)) != NULL) {
|
|
||||||
if (Z_TYPE_P(inner_value) != IS_STRING) {
|
|
||||||
zend_throw_exception(spl_ce_InvalidArgumentException,
|
|
||||||
"Status details must be a string", 1);
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
ops[op_num].data.send_status_from_server.status_details =
|
|
||||||
Z_STRVAL_P(inner_value);
|
|
||||||
} else {
|
|
||||||
zend_throw_exception(spl_ce_InvalidArgumentException,
|
|
||||||
"String status details is required", 1);
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case GRPC_OP_RECV_INITIAL_METADATA:
|
|
||||||
ops[op_num].data.recv_initial_metadata = &recv_metadata;
|
|
||||||
break;
|
|
||||||
case GRPC_OP_RECV_MESSAGE:
|
|
||||||
ops[op_num].data.recv_message = &message;
|
|
||||||
break;
|
|
||||||
case GRPC_OP_RECV_STATUS_ON_CLIENT:
|
|
||||||
ops[op_num].data.recv_status_on_client.trailing_metadata =
|
|
||||||
&recv_trailing_metadata;
|
|
||||||
ops[op_num].data.recv_status_on_client.status = &status;
|
|
||||||
ops[op_num].data.recv_status_on_client.status_details =
|
|
||||||
&status_details;
|
|
||||||
ops[op_num].data.recv_status_on_client.status_details_capacity =
|
|
||||||
&status_details_capacity;
|
|
||||||
break;
|
|
||||||
case GRPC_OP_RECV_CLOSE_ON_SERVER:
|
|
||||||
ops[op_num].data.recv_close_on_server.cancelled = &cancelled;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
zend_throw_exception(spl_ce_InvalidArgumentException,
|
|
||||||
"Unrecognized key in batch", 1);
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
ops[op_num].op = (grpc_op_type)index;
|
|
||||||
ops[op_num].flags = 0;
|
|
||||||
ops[op_num].reserved = NULL;
|
|
||||||
op_num++;
|
|
||||||
} ZEND_HASH_FOREACH_END();
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
error = grpc_call_start_batch(call->wrapped, ops, op_num, call->wrapped,
|
error = grpc_call_start_batch(call->wrapped, ops, op_num, call->wrapped,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
@ -663,7 +424,9 @@ PHP_METHOD(Call, startBatch) {
|
||||||
}
|
}
|
||||||
grpc_completion_queue_pluck(completion_queue, call->wrapped,
|
grpc_completion_queue_pluck(completion_queue, call->wrapped,
|
||||||
gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
|
gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
|
||||||
#if PHP_MAJOR_VERSION < 7
|
#if PHP_MAJOR_VERSION >= 7
|
||||||
|
zval recv_md;
|
||||||
|
#endif
|
||||||
for (int i = 0; i < op_num; i++) {
|
for (int i = 0; i < op_num; i++) {
|
||||||
switch(ops[i].op) {
|
switch(ops[i].op) {
|
||||||
case GRPC_OP_SEND_INITIAL_METADATA:
|
case GRPC_OP_SEND_INITIAL_METADATA:
|
||||||
|
|
@ -679,73 +442,38 @@ PHP_METHOD(Call, startBatch) {
|
||||||
add_property_bool(result, "send_status", true);
|
add_property_bool(result, "send_status", true);
|
||||||
break;
|
break;
|
||||||
case GRPC_OP_RECV_INITIAL_METADATA:
|
case GRPC_OP_RECV_INITIAL_METADATA:
|
||||||
|
#if PHP_MAJOR_VERSION < 7
|
||||||
array = grpc_parse_metadata_array(&recv_metadata TSRMLS_CC);
|
array = grpc_parse_metadata_array(&recv_metadata TSRMLS_CC);
|
||||||
add_property_zval(result, "metadata", array);
|
add_property_zval(result, "metadata", array);
|
||||||
Z_DELREF_P(array);
|
|
||||||
break;
|
|
||||||
case GRPC_OP_RECV_MESSAGE:
|
|
||||||
byte_buffer_to_string(message, &message_str, &message_len);
|
|
||||||
if (message_str == NULL) {
|
|
||||||
add_property_null(result, "message");
|
|
||||||
} else {
|
|
||||||
add_property_stringl(result, "message", message_str, message_len,
|
|
||||||
false);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case GRPC_OP_RECV_STATUS_ON_CLIENT:
|
|
||||||
MAKE_STD_ZVAL(recv_status);
|
|
||||||
object_init(recv_status);
|
|
||||||
array = grpc_parse_metadata_array(&recv_trailing_metadata TSRMLS_CC);
|
|
||||||
add_property_zval(recv_status, "metadata", array);
|
|
||||||
Z_DELREF_P(array);
|
|
||||||
add_property_long(recv_status, "code", status);
|
|
||||||
add_property_string(recv_status, "details", status_details, true);
|
|
||||||
add_property_zval(result, "status", recv_status);
|
|
||||||
Z_DELREF_P(recv_status);
|
|
||||||
break;
|
|
||||||
case GRPC_OP_RECV_CLOSE_ON_SERVER:
|
|
||||||
add_property_bool(result, "cancelled", cancelled);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
zval recv_md;
|
|
||||||
for (int i = 0; i < op_num; i++) {
|
|
||||||
switch(ops[i].op) {
|
|
||||||
case GRPC_OP_SEND_INITIAL_METADATA:
|
|
||||||
add_property_bool(result, "send_metadata", true);
|
|
||||||
break;
|
|
||||||
case GRPC_OP_SEND_MESSAGE:
|
|
||||||
add_property_bool(result, "send_message", true);
|
|
||||||
break;
|
|
||||||
case GRPC_OP_SEND_CLOSE_FROM_CLIENT:
|
|
||||||
add_property_bool(result, "send_close", true);
|
|
||||||
break;
|
|
||||||
case GRPC_OP_SEND_STATUS_FROM_SERVER:
|
|
||||||
add_property_bool(result, "send_status", true);
|
|
||||||
break;
|
|
||||||
case GRPC_OP_RECV_INITIAL_METADATA:
|
|
||||||
recv_md = *grpc_parse_metadata_array(&recv_metadata);
|
recv_md = *grpc_parse_metadata_array(&recv_metadata);
|
||||||
add_property_zval(result, "metadata", &recv_md);
|
add_property_zval(result, "metadata", &recv_md);
|
||||||
|
#endif
|
||||||
|
PHP_GRPC_DELREF(array);
|
||||||
break;
|
break;
|
||||||
case GRPC_OP_RECV_MESSAGE:
|
case GRPC_OP_RECV_MESSAGE:
|
||||||
byte_buffer_to_string(message, &message_str, &message_len);
|
byte_buffer_to_string(message, &message_str, &message_len);
|
||||||
if (message_str == NULL) {
|
if (message_str == NULL) {
|
||||||
add_property_null(result, "message");
|
add_property_null(result, "message");
|
||||||
} else {
|
} else {
|
||||||
add_property_stringl(result, "message", message_str,
|
php_grpc_add_property_stringl(result, "message", message_str,
|
||||||
message_len);
|
message_len, false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GRPC_OP_RECV_STATUS_ON_CLIENT:
|
case GRPC_OP_RECV_STATUS_ON_CLIENT:
|
||||||
object_init(&recv_status);
|
#if PHP_MAJOR_VERSION < 7
|
||||||
|
array = grpc_parse_metadata_array(&recv_trailing_metadata TSRMLS_CC);
|
||||||
|
add_property_zval(recv_status, "metadata", array);
|
||||||
|
#else
|
||||||
recv_md = *grpc_parse_metadata_array(&recv_trailing_metadata);
|
recv_md = *grpc_parse_metadata_array(&recv_trailing_metadata);
|
||||||
add_property_zval(&recv_status, "metadata", &recv_md);
|
add_property_zval(recv_status, "metadata", &recv_md);
|
||||||
add_property_long(&recv_status, "code", status);
|
#endif
|
||||||
add_property_string(&recv_status, "details", status_details);
|
PHP_GRPC_DELREF(array);
|
||||||
add_property_zval(result, "status", &recv_status);
|
add_property_long(recv_status, "code", status);
|
||||||
|
php_grpc_add_property_string(recv_status, "details", status_details,
|
||||||
|
true);
|
||||||
|
add_property_zval(result, "status", recv_status);
|
||||||
|
PHP_GRPC_DELREF(recv_status);
|
||||||
break;
|
break;
|
||||||
case GRPC_OP_RECV_CLOSE_ON_SERVER:
|
case GRPC_OP_RECV_CLOSE_ON_SERVER:
|
||||||
add_property_bool(result, "cancelled", cancelled);
|
add_property_bool(result, "cancelled", cancelled);
|
||||||
|
|
@ -754,7 +482,6 @@ PHP_METHOD(Call, startBatch) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
grpc_metadata_array_destroy(&metadata);
|
grpc_metadata_array_destroy(&metadata);
|
||||||
|
|
@ -833,10 +560,5 @@ void grpc_init_call(TSRMLS_D) {
|
||||||
INIT_CLASS_ENTRY(ce, "Grpc\\Call", call_methods);
|
INIT_CLASS_ENTRY(ce, "Grpc\\Call", call_methods);
|
||||||
ce.create_object = create_wrapped_grpc_call;
|
ce.create_object = create_wrapped_grpc_call;
|
||||||
grpc_ce_call = zend_register_internal_class(&ce TSRMLS_CC);
|
grpc_ce_call = zend_register_internal_class(&ce TSRMLS_CC);
|
||||||
#if PHP_MAJOR_VERSION >= 7
|
PHP_GRPC_INIT_HANDLER(wrapped_grpc_call, call_ce_handlers);
|
||||||
memcpy(&call_ce_handlers, zend_get_std_object_handlers(),
|
|
||||||
sizeof(zend_object_handlers));
|
|
||||||
call_ce_handlers.offset = XtOffsetOf(wrapped_grpc_call, std);
|
|
||||||
call_ce_handlers.free_obj = free_wrapped_grpc_call;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,69 +52,28 @@
|
||||||
#include <grpc/grpc_security.h>
|
#include <grpc/grpc_security.h>
|
||||||
|
|
||||||
zend_class_entry *grpc_ce_call_credentials;
|
zend_class_entry *grpc_ce_call_credentials;
|
||||||
|
#if PHP_MAJOR_VERSION >= 7
|
||||||
#if PHP_MAJOR_VERSION < 7
|
static zend_object_handlers call_credentials_ce_handlers;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Frees and destroys an instance of wrapped_grpc_call_credentials */
|
/* Frees and destroys an instance of wrapped_grpc_call_credentials */
|
||||||
void free_wrapped_grpc_call_credentials(void *object TSRMLS_DC) {
|
PHP_GRPC_FREE_WRAPPED_FUNC_START(wrapped_grpc_call_credentials)
|
||||||
wrapped_grpc_call_credentials *creds =
|
if (p->wrapped != NULL) {
|
||||||
(wrapped_grpc_call_credentials *)object;
|
grpc_call_credentials_release(p->wrapped);
|
||||||
if (creds->wrapped != NULL) {
|
|
||||||
grpc_call_credentials_release(creds->wrapped);
|
|
||||||
}
|
}
|
||||||
zend_object_std_dtor(&creds->std TSRMLS_CC);
|
PHP_GRPC_FREE_WRAPPED_FUNC_END()
|
||||||
efree(creds);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initializes an instance of wrapped_grpc_call_credentials to be
|
/* Initializes an instance of wrapped_grpc_call_credentials to be
|
||||||
* associated with an object of a class specified by class_type */
|
* associated with an object of a class specified by class_type */
|
||||||
zend_object_value create_wrapped_grpc_call_credentials(
|
php_grpc_zend_object create_wrapped_grpc_call_credentials(
|
||||||
zend_class_entry *class_type TSRMLS_DC) {
|
zend_class_entry *class_type TSRMLS_DC) {
|
||||||
zend_object_value retval;
|
PHP_GRPC_ALLOC_CLASS_OBJECT(wrapped_grpc_call_credentials);
|
||||||
wrapped_grpc_call_credentials *intern;
|
|
||||||
|
|
||||||
intern = (wrapped_grpc_call_credentials *)emalloc(
|
|
||||||
sizeof(wrapped_grpc_call_credentials));
|
|
||||||
memset(intern, 0, sizeof(wrapped_grpc_call_credentials));
|
|
||||||
|
|
||||||
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
|
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
|
||||||
object_properties_init(&intern->std, class_type);
|
object_properties_init(&intern->std, class_type);
|
||||||
retval.handle = zend_objects_store_put(
|
PHP_GRPC_FREE_CLASS_OBJECT(wrapped_grpc_call_credentials,
|
||||||
intern, (zend_objects_store_dtor_t)zend_objects_destroy_object,
|
call_credentials_ce_handlers);
|
||||||
free_wrapped_grpc_call_credentials, NULL TSRMLS_CC);
|
|
||||||
retval.handlers = zend_get_std_object_handlers();
|
|
||||||
return retval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
static zend_object_handlers call_credentials_ce_handlers;
|
|
||||||
|
|
||||||
/* Frees and destroys an instance of wrapped_grpc_call_credentials */
|
|
||||||
static void free_wrapped_grpc_call_credentials(zend_object *object) {
|
|
||||||
wrapped_grpc_call_credentials *creds =
|
|
||||||
wrapped_grpc_call_creds_from_obj(object);
|
|
||||||
if (creds->wrapped != NULL) {
|
|
||||||
grpc_call_credentials_release(creds->wrapped);
|
|
||||||
}
|
|
||||||
zend_object_std_dtor(&creds->std);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initializes an instance of wrapped_grpc_call_credentials to be
|
|
||||||
* associated with an object of a class specified by class_type */
|
|
||||||
zend_object *create_wrapped_grpc_call_credentials(zend_class_entry
|
|
||||||
*class_type) {
|
|
||||||
wrapped_grpc_call_credentials *intern;
|
|
||||||
intern = ecalloc(1, sizeof(wrapped_grpc_call_credentials) +
|
|
||||||
zend_object_properties_size(class_type));
|
|
||||||
zend_object_std_init(&intern->std, class_type);
|
|
||||||
object_properties_init(&intern->std, class_type);
|
|
||||||
intern->std.handlers = &call_credentials_ce_handlers;
|
|
||||||
return &intern->std;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
zval *grpc_php_wrap_call_credentials(grpc_call_credentials
|
zval *grpc_php_wrap_call_credentials(grpc_call_credentials
|
||||||
*wrapped TSRMLS_DC) {
|
*wrapped TSRMLS_DC) {
|
||||||
zval *credentials_object;
|
zval *credentials_object;
|
||||||
|
|
@ -276,13 +235,6 @@ void grpc_init_call_credentials(TSRMLS_D) {
|
||||||
INIT_CLASS_ENTRY(ce, "Grpc\\CallCredentials", call_credentials_methods);
|
INIT_CLASS_ENTRY(ce, "Grpc\\CallCredentials", call_credentials_methods);
|
||||||
ce.create_object = create_wrapped_grpc_call_credentials;
|
ce.create_object = create_wrapped_grpc_call_credentials;
|
||||||
grpc_ce_call_credentials = zend_register_internal_class(&ce TSRMLS_CC);
|
grpc_ce_call_credentials = zend_register_internal_class(&ce TSRMLS_CC);
|
||||||
#if PHP_MAJOR_VERSION >= 7
|
PHP_GRPC_INIT_HANDLER(wrapped_grpc_call_credentials,
|
||||||
memcpy(&call_credentials_ce_handlers,
|
call_credentials_ce_handlers);
|
||||||
zend_get_std_object_handlers(),
|
|
||||||
sizeof(zend_object_handlers));
|
|
||||||
call_credentials_ce_handlers.offset =
|
|
||||||
XtOffsetOf(wrapped_grpc_call_credentials, std);
|
|
||||||
call_credentials_ce_handlers.free_obj =
|
|
||||||
free_wrapped_grpc_call_credentials;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,15 +63,13 @@ PHP_GRPC_WRAP_OBJECT_END(wrapped_grpc_call_credentials)
|
||||||
#else
|
#else
|
||||||
|
|
||||||
static inline wrapped_grpc_call_credentials
|
static inline wrapped_grpc_call_credentials
|
||||||
*wrapped_grpc_call_creds_from_obj(zend_object *obj) {
|
*wrapped_grpc_call_credentials_from_obj(zend_object *obj) {
|
||||||
return
|
return (wrapped_grpc_call_credentials*)(
|
||||||
(wrapped_grpc_call_credentials*)((char*)(obj) -
|
(char*)(obj) - XtOffsetOf(wrapped_grpc_call_credentials, std));
|
||||||
XtOffsetOf(wrapped_grpc_call_credentials,
|
|
||||||
std));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define Z_WRAPPED_GRPC_CALL_CREDS_P(zv) \
|
#define Z_WRAPPED_GRPC_CALL_CREDS_P(zv) \
|
||||||
wrapped_grpc_call_creds_from_obj(Z_OBJ_P((zv)))
|
wrapped_grpc_call_credentials_from_obj(Z_OBJ_P((zv)))
|
||||||
|
|
||||||
#endif /* PHP_MAJOR_VERSION */
|
#endif /* PHP_MAJOR_VERSION */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,122 +56,52 @@
|
||||||
#include "timeval.h"
|
#include "timeval.h"
|
||||||
|
|
||||||
zend_class_entry *grpc_ce_channel;
|
zend_class_entry *grpc_ce_channel;
|
||||||
|
#if PHP_MAJOR_VERSION >= 7
|
||||||
#if PHP_MAJOR_VERSION < 7
|
static zend_object_handlers channel_ce_handlers;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Frees and destroys an instance of wrapped_grpc_channel */
|
/* Frees and destroys an instance of wrapped_grpc_channel */
|
||||||
void free_wrapped_grpc_channel(void *object TSRMLS_DC) {
|
PHP_GRPC_FREE_WRAPPED_FUNC_START(wrapped_grpc_channel)
|
||||||
wrapped_grpc_channel *channel = (wrapped_grpc_channel *)object;
|
if (p->wrapped != NULL) {
|
||||||
if (channel->wrapped != NULL) {
|
grpc_channel_destroy(p->wrapped);
|
||||||
grpc_channel_destroy(channel->wrapped);
|
|
||||||
}
|
}
|
||||||
zend_object_std_dtor(&channel->std TSRMLS_CC);
|
PHP_GRPC_FREE_WRAPPED_FUNC_END()
|
||||||
efree(channel);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initializes an instance of wrapped_grpc_channel to be associated with an
|
/* Initializes an instance of wrapped_grpc_channel to be associated with an
|
||||||
* object of a class specified by class_type */
|
* object of a class specified by class_type */
|
||||||
zend_object_value create_wrapped_grpc_channel(zend_class_entry *class_type
|
php_grpc_zend_object create_wrapped_grpc_channel(zend_class_entry *class_type
|
||||||
TSRMLS_DC) {
|
TSRMLS_DC) {
|
||||||
zend_object_value retval;
|
PHP_GRPC_ALLOC_CLASS_OBJECT(wrapped_grpc_channel);
|
||||||
wrapped_grpc_channel *intern;
|
|
||||||
intern = (wrapped_grpc_channel *)emalloc(sizeof(wrapped_grpc_channel));
|
|
||||||
memset(intern, 0, sizeof(wrapped_grpc_channel));
|
|
||||||
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
|
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
|
||||||
object_properties_init(&intern->std, class_type);
|
object_properties_init(&intern->std, class_type);
|
||||||
retval.handle = zend_objects_store_put(
|
PHP_GRPC_FREE_CLASS_OBJECT(wrapped_grpc_channel, channel_ce_handlers);
|
||||||
intern, (zend_objects_store_dtor_t)zend_objects_destroy_object,
|
|
||||||
free_wrapped_grpc_channel, NULL TSRMLS_CC);
|
|
||||||
retval.handlers = zend_get_std_object_handlers();
|
|
||||||
return retval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
static zend_object_handlers channel_ce_handlers;
|
|
||||||
|
|
||||||
/* Frees and destroys an instance of wrapped_grpc_channel */
|
|
||||||
static void free_wrapped_grpc_channel(zend_object *object) {
|
|
||||||
wrapped_grpc_channel *channel = wrapped_grpc_channel_from_obj(object);
|
|
||||||
if (channel->wrapped != NULL) {
|
|
||||||
grpc_channel_destroy(channel->wrapped);
|
|
||||||
}
|
|
||||||
zend_object_std_dtor(&channel->std);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initializes an instance of wrapped_grpc_channel to be associated with an
|
|
||||||
* object of a class specified by class_type */
|
|
||||||
zend_object *create_wrapped_grpc_channel(zend_class_entry *class_type) {
|
|
||||||
wrapped_grpc_channel *intern;
|
|
||||||
intern = ecalloc(1, sizeof(wrapped_grpc_channel) +
|
|
||||||
zend_object_properties_size(class_type));
|
|
||||||
zend_object_std_init(&intern->std, class_type);
|
|
||||||
object_properties_init(&intern->std, class_type);
|
|
||||||
intern->std.handlers = &channel_ce_handlers;
|
|
||||||
return &intern->std;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void php_grpc_read_args_array(zval *args_array,
|
void php_grpc_read_args_array(zval *args_array,
|
||||||
grpc_channel_args *args TSRMLS_DC) {
|
grpc_channel_args *args TSRMLS_DC) {
|
||||||
HashTable *array_hash;
|
HashTable *array_hash;
|
||||||
int args_index;
|
int args_index;
|
||||||
#if PHP_MAJOR_VERSION < 7
|
|
||||||
HashPosition array_pointer;
|
|
||||||
zval **data;
|
|
||||||
char *key;
|
|
||||||
uint key_len;
|
|
||||||
ulong index;
|
|
||||||
#else
|
|
||||||
zval *data;
|
|
||||||
zend_string *key;
|
|
||||||
#endif
|
|
||||||
array_hash = Z_ARRVAL_P(args_array);
|
array_hash = Z_ARRVAL_P(args_array);
|
||||||
if (!array_hash) {
|
if (!array_hash) {
|
||||||
zend_throw_exception(spl_ce_InvalidArgumentException,
|
zend_throw_exception(spl_ce_InvalidArgumentException,
|
||||||
"array_hash is NULL", 1);
|
"array_hash is NULL", 1 TSRMLS_CC);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
args->num_args = zend_hash_num_elements(array_hash);
|
args->num_args = zend_hash_num_elements(array_hash);
|
||||||
args->args = ecalloc(args->num_args, sizeof(grpc_arg));
|
args->args = ecalloc(args->num_args, sizeof(grpc_arg));
|
||||||
args_index = 0;
|
args_index = 0;
|
||||||
|
|
||||||
#if PHP_MAJOR_VERSION < 7
|
char *key = NULL;
|
||||||
for (zend_hash_internal_pointer_reset_ex(array_hash, &array_pointer);
|
zval *data;
|
||||||
zend_hash_get_current_data_ex(array_hash, (void **)&data,
|
int key_type;
|
||||||
&array_pointer) == SUCCESS;
|
|
||||||
zend_hash_move_forward_ex(array_hash, &array_pointer)) {
|
PHP_GRPC_HASH_FOREACH_STR_KEY_VAL_START(array_hash, key, key_type, data)
|
||||||
if (zend_hash_get_current_key_ex(array_hash, &key, &key_len, &index, 0,
|
if (key_type != HASH_KEY_IS_STRING) {
|
||||||
&array_pointer) != HASH_KEY_IS_STRING) {
|
|
||||||
zend_throw_exception(spl_ce_InvalidArgumentException,
|
zend_throw_exception(spl_ce_InvalidArgumentException,
|
||||||
"args keys must be strings", 1 TSRMLS_CC);
|
"args keys must be strings", 1 TSRMLS_CC);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
args->args[args_index].key = key;
|
args->args[args_index].key = key;
|
||||||
switch (Z_TYPE_P(*data)) {
|
|
||||||
case IS_LONG:
|
|
||||||
args->args[args_index].value.integer = (int)Z_LVAL_P(*data);
|
|
||||||
args->args[args_index].type = GRPC_ARG_INTEGER;
|
|
||||||
break;
|
|
||||||
case IS_STRING:
|
|
||||||
args->args[args_index].value.string = Z_STRVAL_P(*data);
|
|
||||||
args->args[args_index].type = GRPC_ARG_STRING;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
zend_throw_exception(spl_ce_InvalidArgumentException,
|
|
||||||
"args values must be int or string", 1 TSRMLS_CC);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
args_index++;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
ZEND_HASH_FOREACH_STR_KEY_VAL(array_hash, key, data) {
|
|
||||||
if (key == NULL) {
|
|
||||||
zend_throw_exception(spl_ce_InvalidArgumentException,
|
|
||||||
"args keys must be strings", 1);
|
|
||||||
}
|
|
||||||
args->args[args_index].key = ZSTR_VAL(key);
|
|
||||||
switch (Z_TYPE_P(data)) {
|
switch (Z_TYPE_P(data)) {
|
||||||
case IS_LONG:
|
case IS_LONG:
|
||||||
args->args[args_index].value.integer = (int)Z_LVAL_P(data);
|
args->args[args_index].value.integer = (int)Z_LVAL_P(data);
|
||||||
|
|
@ -183,12 +113,11 @@ void php_grpc_read_args_array(zval *args_array,
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
zend_throw_exception(spl_ce_InvalidArgumentException,
|
zend_throw_exception(spl_ce_InvalidArgumentException,
|
||||||
"args values must be int or string", 1);
|
"args values must be int or string", 1 TSRMLS_CC);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
args_index++;
|
args_index++;
|
||||||
} ZEND_HASH_FOREACH_END();
|
PHP_GRPC_HASH_FOREACH_END()
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -200,11 +129,7 @@ void php_grpc_read_args_array(zval *args_array,
|
||||||
*/
|
*/
|
||||||
PHP_METHOD(Channel, __construct) {
|
PHP_METHOD(Channel, __construct) {
|
||||||
wrapped_grpc_channel *channel = Z_WRAPPED_GRPC_CHANNEL_P(getThis());
|
wrapped_grpc_channel *channel = Z_WRAPPED_GRPC_CHANNEL_P(getThis());
|
||||||
#if PHP_MAJOR_VERSION < 7
|
|
||||||
zval **creds_obj = NULL;
|
|
||||||
#else
|
|
||||||
zval *creds_obj = NULL;
|
zval *creds_obj = NULL;
|
||||||
#endif
|
|
||||||
char *target;
|
char *target;
|
||||||
php_grpc_int target_length;
|
php_grpc_int target_length;
|
||||||
zval *args_array = NULL;
|
zval *args_array = NULL;
|
||||||
|
|
@ -219,43 +144,23 @@ PHP_METHOD(Channel, __construct) {
|
||||||
"Channel expects a string and an array", 1 TSRMLS_CC);
|
"Channel expects a string and an array", 1 TSRMLS_CC);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if PHP_MAJOR_VERSION < 7
|
|
||||||
array_hash = Z_ARRVAL_P(args_array);
|
array_hash = Z_ARRVAL_P(args_array);
|
||||||
if (zend_hash_find(array_hash, "credentials", sizeof("credentials"),
|
if (php_grpc_zend_hash_find(array_hash, "credentials", sizeof("credentials"),
|
||||||
(void **)&creds_obj) == SUCCESS) {
|
(void **)&creds_obj) == SUCCESS) {
|
||||||
if (Z_TYPE_P(*creds_obj) == IS_NULL) {
|
if (Z_TYPE_P(creds_obj) == IS_NULL) {
|
||||||
creds = NULL;
|
creds = NULL;
|
||||||
zend_hash_del(array_hash, "credentials", 12);
|
php_grpc_zend_hash_del(array_hash, "credentials", sizeof("credentials"));
|
||||||
} else if (zend_get_class_entry(*creds_obj TSRMLS_CC) !=
|
} else if (PHP_GRPC_GET_CLASS_ENTRY(creds_obj) !=
|
||||||
grpc_ce_channel_credentials) {
|
grpc_ce_channel_credentials) {
|
||||||
zend_throw_exception(spl_ce_InvalidArgumentException,
|
zend_throw_exception(spl_ce_InvalidArgumentException,
|
||||||
"credentials must be a ChannelCredentials object",
|
"credentials must be a ChannelCredentials object",
|
||||||
1 TSRMLS_CC);
|
1 TSRMLS_CC);
|
||||||
return;
|
return;
|
||||||
} else {
|
|
||||||
creds = (wrapped_grpc_channel_credentials *)zend_object_store_get_object(
|
|
||||||
*creds_obj TSRMLS_CC);
|
|
||||||
zend_hash_del(array_hash, "credentials", 12);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
array_hash = HASH_OF(args_array);
|
|
||||||
if ((creds_obj = zend_hash_str_find(array_hash, "credentials",
|
|
||||||
sizeof("credentials") - 1)) != NULL) {
|
|
||||||
if (Z_TYPE_P(creds_obj) == IS_NULL) {
|
|
||||||
creds = NULL;
|
|
||||||
zend_hash_str_del(array_hash, "credentials", sizeof("credentials") - 1);
|
|
||||||
} else if (Z_OBJ_P(creds_obj)->ce != grpc_ce_channel_credentials) {
|
|
||||||
zend_throw_exception(spl_ce_InvalidArgumentException,
|
|
||||||
"credentials must be a ChannelCredentials object",
|
|
||||||
1);
|
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
creds = Z_WRAPPED_GRPC_CHANNEL_CREDS_P(creds_obj);
|
creds = Z_WRAPPED_GRPC_CHANNEL_CREDS_P(creds_obj);
|
||||||
zend_hash_str_del(array_hash, "credentials", sizeof("credentials") - 1);
|
php_grpc_zend_hash_del(array_hash, "credentials", sizeof("credentials"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
php_grpc_read_args_array(args_array, &args TSRMLS_CC);
|
php_grpc_read_args_array(args_array, &args TSRMLS_CC);
|
||||||
if (creds == NULL) {
|
if (creds == NULL) {
|
||||||
channel->wrapped = grpc_insecure_channel_create(target, &args, NULL);
|
channel->wrapped = grpc_insecure_channel_create(target, &args, NULL);
|
||||||
|
|
@ -311,8 +216,7 @@ PHP_METHOD(Channel, watchConnectivityState) {
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lO",
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lO",
|
||||||
&last_state, &deadline_obj, grpc_ce_timeval) == FAILURE) {
|
&last_state, &deadline_obj, grpc_ce_timeval) == FAILURE) {
|
||||||
zend_throw_exception(spl_ce_InvalidArgumentException,
|
zend_throw_exception(spl_ce_InvalidArgumentException,
|
||||||
"watchConnectivityState expects 1 long 1 timeval",
|
"watchConnectivityState expects 1 long 1 timeval", 1 TSRMLS_CC);
|
||||||
1 TSRMLS_CC);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -352,11 +256,5 @@ void grpc_init_channel(TSRMLS_D) {
|
||||||
INIT_CLASS_ENTRY(ce, "Grpc\\Channel", channel_methods);
|
INIT_CLASS_ENTRY(ce, "Grpc\\Channel", channel_methods);
|
||||||
ce.create_object = create_wrapped_grpc_channel;
|
ce.create_object = create_wrapped_grpc_channel;
|
||||||
grpc_ce_channel = zend_register_internal_class(&ce TSRMLS_CC);
|
grpc_ce_channel = zend_register_internal_class(&ce TSRMLS_CC);
|
||||||
#if PHP_MAJOR_VERSION >= 7
|
PHP_GRPC_INIT_HANDLER(wrapped_grpc_channel, channel_ce_handlers);
|
||||||
memcpy(&channel_ce_handlers, zend_get_std_object_handlers(),
|
|
||||||
sizeof(zend_object_handlers));
|
|
||||||
channel_ce_handlers.offset =
|
|
||||||
XtOffsetOf(wrapped_grpc_channel, std);
|
|
||||||
channel_ce_handlers.free_obj = free_wrapped_grpc_channel;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,9 @@
|
||||||
#include <grpc/grpc_security.h>
|
#include <grpc/grpc_security.h>
|
||||||
|
|
||||||
zend_class_entry *grpc_ce_channel_credentials;
|
zend_class_entry *grpc_ce_channel_credentials;
|
||||||
|
#if PHP_MAJOR_VERSION >= 7
|
||||||
|
static zend_object_handlers channel_credentials_ce_handlers;
|
||||||
|
#endif
|
||||||
static char *default_pem_root_certs = NULL;
|
static char *default_pem_root_certs = NULL;
|
||||||
|
|
||||||
static grpc_ssl_roots_override_result get_ssl_roots_override(
|
static grpc_ssl_roots_override_result get_ssl_roots_override(
|
||||||
|
|
@ -63,68 +66,24 @@ static grpc_ssl_roots_override_result get_ssl_roots_override(
|
||||||
return GRPC_SSL_ROOTS_OVERRIDE_OK;
|
return GRPC_SSL_ROOTS_OVERRIDE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if PHP_MAJOR_VERSION < 7
|
|
||||||
|
|
||||||
/* Frees and destroys an instance of wrapped_grpc_channel_credentials */
|
/* Frees and destroys an instance of wrapped_grpc_channel_credentials */
|
||||||
void free_wrapped_grpc_channel_credentials(void *object TSRMLS_DC) {
|
PHP_GRPC_FREE_WRAPPED_FUNC_START(wrapped_grpc_channel_credentials)
|
||||||
wrapped_grpc_channel_credentials *creds =
|
if (p->wrapped != NULL) {
|
||||||
(wrapped_grpc_channel_credentials *)object;
|
grpc_channel_credentials_release(p->wrapped);
|
||||||
if (creds->wrapped != NULL) {
|
|
||||||
grpc_channel_credentials_release(creds->wrapped);
|
|
||||||
}
|
}
|
||||||
zend_object_std_dtor(&creds->std TSRMLS_CC);
|
PHP_GRPC_FREE_WRAPPED_FUNC_END()
|
||||||
efree(creds);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initializes an instance of wrapped_grpc_channel_credentials to be
|
/* Initializes an instance of wrapped_grpc_channel_credentials to be
|
||||||
* associated with an object of a class specified by class_type */
|
* associated with an object of a class specified by class_type */
|
||||||
zend_object_value create_wrapped_grpc_channel_credentials(
|
php_grpc_zend_object create_wrapped_grpc_channel_credentials(
|
||||||
zend_class_entry *class_type TSRMLS_DC) {
|
zend_class_entry *class_type TSRMLS_DC) {
|
||||||
zend_object_value retval;
|
PHP_GRPC_ALLOC_CLASS_OBJECT(wrapped_grpc_channel_credentials);
|
||||||
wrapped_grpc_channel_credentials *intern;
|
|
||||||
|
|
||||||
intern = (wrapped_grpc_channel_credentials *)emalloc(
|
|
||||||
sizeof(wrapped_grpc_channel_credentials));
|
|
||||||
memset(intern, 0, sizeof(wrapped_grpc_channel_credentials));
|
|
||||||
|
|
||||||
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
|
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
|
||||||
object_properties_init(&intern->std, class_type);
|
object_properties_init(&intern->std, class_type);
|
||||||
retval.handle = zend_objects_store_put(
|
PHP_GRPC_FREE_CLASS_OBJECT(wrapped_grpc_channel_credentials,
|
||||||
intern, (zend_objects_store_dtor_t)zend_objects_destroy_object,
|
channel_credentials_ce_handlers);
|
||||||
free_wrapped_grpc_channel_credentials, NULL TSRMLS_CC);
|
|
||||||
retval.handlers = zend_get_std_object_handlers();
|
|
||||||
return retval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
static zend_object_handlers channel_credentials_ce_handlers;
|
|
||||||
|
|
||||||
/* Frees and destroys an instance of wrapped_grpc_channel_credentials */
|
|
||||||
static void free_wrapped_grpc_channel_credentials(zend_object *object) {
|
|
||||||
wrapped_grpc_channel_credentials *creds =
|
|
||||||
wrapped_grpc_channel_creds_from_obj(object);
|
|
||||||
if (creds->wrapped != NULL) {
|
|
||||||
grpc_channel_credentials_release(creds->wrapped);
|
|
||||||
}
|
|
||||||
zend_object_std_dtor(&creds->std);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initializes an instance of wrapped_grpc_channel_credentials to be
|
|
||||||
* associated with an object of a class specified by class_type */
|
|
||||||
zend_object *create_wrapped_grpc_channel_credentials(zend_class_entry
|
|
||||||
*class_type) {
|
|
||||||
wrapped_grpc_channel_credentials *intern;
|
|
||||||
intern = ecalloc(1, sizeof(wrapped_grpc_channel_credentials) +
|
|
||||||
zend_object_properties_size(class_type));
|
|
||||||
zend_object_std_init(&intern->std, class_type);
|
|
||||||
object_properties_init(&intern->std, class_type);
|
|
||||||
intern->std.handlers = &channel_credentials_ce_handlers;
|
|
||||||
return &intern->std;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
zval *grpc_php_wrap_channel_credentials(grpc_channel_credentials
|
zval *grpc_php_wrap_channel_credentials(grpc_channel_credentials
|
||||||
*wrapped TSRMLS_DC) {
|
*wrapped TSRMLS_DC) {
|
||||||
zval *credentials_object;
|
zval *credentials_object;
|
||||||
|
|
@ -267,13 +226,6 @@ void grpc_init_channel_credentials(TSRMLS_D) {
|
||||||
grpc_set_ssl_roots_override_callback(get_ssl_roots_override);
|
grpc_set_ssl_roots_override_callback(get_ssl_roots_override);
|
||||||
ce.create_object = create_wrapped_grpc_channel_credentials;
|
ce.create_object = create_wrapped_grpc_channel_credentials;
|
||||||
grpc_ce_channel_credentials = zend_register_internal_class(&ce TSRMLS_CC);
|
grpc_ce_channel_credentials = zend_register_internal_class(&ce TSRMLS_CC);
|
||||||
#if PHP_MAJOR_VERSION >= 7
|
PHP_GRPC_INIT_HANDLER(wrapped_grpc_channel_credentials,
|
||||||
memcpy(&channel_credentials_ce_handlers,
|
channel_credentials_ce_handlers);
|
||||||
zend_get_std_object_handlers(),
|
|
||||||
sizeof(zend_object_handlers));
|
|
||||||
channel_credentials_ce_handlers.offset =
|
|
||||||
XtOffsetOf(wrapped_grpc_channel_credentials, std);
|
|
||||||
channel_credentials_ce_handlers.free_obj =
|
|
||||||
free_wrapped_grpc_channel_credentials;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,15 +63,13 @@ PHP_GRPC_WRAP_OBJECT_END(wrapped_grpc_channel_credentials)
|
||||||
#else
|
#else
|
||||||
|
|
||||||
static inline wrapped_grpc_channel_credentials
|
static inline wrapped_grpc_channel_credentials
|
||||||
*wrapped_grpc_channel_creds_from_obj(zend_object *obj) {
|
*wrapped_grpc_channel_credentials_from_obj(zend_object *obj) {
|
||||||
return
|
return (wrapped_grpc_channel_credentials *)(
|
||||||
(wrapped_grpc_channel_credentials *)
|
(char*)(obj) - XtOffsetOf(wrapped_grpc_channel_credentials, std));
|
||||||
((char*)(obj) -
|
|
||||||
XtOffsetOf(wrapped_grpc_channel_credentials, std));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define Z_WRAPPED_GRPC_CHANNEL_CREDS_P(zv) \
|
#define Z_WRAPPED_GRPC_CHANNEL_CREDS_P(zv) \
|
||||||
wrapped_grpc_channel_creds_from_obj(Z_OBJ_P((zv)))
|
wrapped_grpc_channel_credentials_from_obj(Z_OBJ_P((zv)))
|
||||||
|
|
||||||
#endif /* PHP_MAJOR_VERSION */
|
#endif /* PHP_MAJOR_VERSION */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,156 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<package packagerversion="1.9.5" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
|
|
||||||
<name>grpc</name>
|
|
||||||
<channel>pecl.php.net</channel>
|
|
||||||
<summary>A high performance, open source, general RPC framework that puts mobile and HTTP/2 first.</summary>
|
|
||||||
<description>Remote Procedure Calls (RPCs) provide a useful abstraction for building distributed applications and services. The libraries in this repository provide a concrete implementation of the gRPC protocol, layered over HTTP/2. These libraries enable communication between clients and servers using any combination of the supported languages.</description>
|
|
||||||
<lead>
|
|
||||||
<name>Stanley Cheung</name>
|
|
||||||
<user>stanleycheung</user>
|
|
||||||
<email>grpc-packages@google.com</email>
|
|
||||||
<active>yes</active>
|
|
||||||
</lead>
|
|
||||||
<date>2016-01-13</date>
|
|
||||||
<time>16:06:07</time>
|
|
||||||
<version>
|
|
||||||
<release>0.7.0</release>
|
|
||||||
<api>0.7.0</api>
|
|
||||||
</version>
|
|
||||||
<stability>
|
|
||||||
<release>beta</release>
|
|
||||||
<api>beta</api>
|
|
||||||
</stability>
|
|
||||||
<license>BSD</license>
|
|
||||||
<notes>
|
|
||||||
- Breaking change to Credentials class (removed) #3765
|
|
||||||
- Replaced by ChannelCredentials and CallCredentials class #3765
|
|
||||||
- New plugin based metadata auth API #4394
|
|
||||||
- Explicit ChannelCredentials::createInsecure() call
|
|
||||||
</notes>
|
|
||||||
<contents>
|
|
||||||
<dir baseinstalldir="/" name="/">
|
|
||||||
<file baseinstalldir="/" md5sum="f201d644fdbd8228ffd1d4a69cc44f1f" name="tests/grpc-basic.phpt" role="test" />
|
|
||||||
<file baseinstalldir="/" md5sum="6f19828fb869b7b8a590cbb76b4f996d" name="byte_buffer.c" role="src" />
|
|
||||||
<file baseinstalldir="/" md5sum="c8de0f819499c48adfc8d7f472c0196b" name="byte_buffer.h" role="src" />
|
|
||||||
<file baseinstalldir="/" md5sum="ee7eb7757f9e6f0e36f8f616b6bd0af5" name="call.c" role="src" />
|
|
||||||
<file baseinstalldir="/" md5sum="44c56bd9912d2538cbd6059e3e0452b6" name="call.h" role="src" />
|
|
||||||
<file baseinstalldir="/" md5sum="ff90f6c03ed44b5f4170bf3259a6704e" name="call_credentials.c" role="src" />
|
|
||||||
<file baseinstalldir="/" md5sum="3c3860e1d84f43cb6b2fbaa8d2ae1ab7" name="call_credentials.h" role="src" />
|
|
||||||
<file baseinstalldir="/" md5sum="aee9b63f790522aec2c682055240cc61" name="channel.c" role="src" />
|
|
||||||
<file baseinstalldir="/" md5sum="ed4b00c0cf3702b115d0cfa87450dc09" name="channel.h" role="src" />
|
|
||||||
<file baseinstalldir="/" md5sum="1a51c76d0b7b7d3ab570ed7d60c2ea46" name="channel_credentials.c" role="src" />
|
|
||||||
<file baseinstalldir="/" md5sum="a86250e03f610ce6c2c7595a84e08821" name="channel_credentials.h" role="src" />
|
|
||||||
<file baseinstalldir="/" md5sum="55ab7a42f9dd9bfc7e28a61cfc5fca63" name="completion_queue.c" role="src" />
|
|
||||||
<file baseinstalldir="/" md5sum="f10b5bb232d74a6878e829e2e76cdaa2" name="completion_queue.h" role="src" />
|
|
||||||
<file baseinstalldir="/" md5sum="cafed254127007ff2271dad7d56a06c8" name="config.m4" role="src" />
|
|
||||||
<file baseinstalldir="/" md5sum="38a1bc979d810c36ebc2a52d4b7b5319" name="CREDITS" role="doc" />
|
|
||||||
<file baseinstalldir="/" md5sum="8847cf67b1b54c981d47ecbb0d139a0c" name="LICENSE" role="doc" />
|
|
||||||
<file baseinstalldir="/" md5sum="3131a8af38fe5918e5409016b89d6cdb" name="php_grpc.c" role="src" />
|
|
||||||
<file baseinstalldir="/" md5sum="673b07859d9f69232f8a754c56780686" name="php_grpc.h" role="src" />
|
|
||||||
<file baseinstalldir="/" md5sum="7533a6d3ea02c78cad23a9651de0825d" name="README.md" role="doc" />
|
|
||||||
<file baseinstalldir="/" md5sum="3e4e960454ebb2fc7b78a840493f5315" name="server.c" role="src" />
|
|
||||||
<file baseinstalldir="/" md5sum="4b730f06d14cbbb0642bdbd194749595" name="server.h" role="src" />
|
|
||||||
<file baseinstalldir="/" md5sum="34ea881f1fe960d190d0713422cf8916" name="server_credentials.c" role="src" />
|
|
||||||
<file baseinstalldir="/" md5sum="9c4b4cc06356a8a39a16a085a9b85996" name="server_credentials.h" role="src" />
|
|
||||||
<file baseinstalldir="/" md5sum="7646ec78cb133f66ba59e03c6f451e39" name="timeval.c" role="src" />
|
|
||||||
<file baseinstalldir="/" md5sum="496e27a100b4d93ca3fb35c924c5e163" name="timeval.h" role="src" />
|
|
||||||
</dir>
|
|
||||||
</contents>
|
|
||||||
<dependencies>
|
|
||||||
<required>
|
|
||||||
<php>
|
|
||||||
<min>5.5.0</min>
|
|
||||||
</php>
|
|
||||||
<pearinstaller>
|
|
||||||
<min>1.4.0</min>
|
|
||||||
</pearinstaller>
|
|
||||||
</required>
|
|
||||||
</dependencies>
|
|
||||||
<providesextension>grpc</providesextension>
|
|
||||||
<extsrcrelease />
|
|
||||||
<changelog>
|
|
||||||
<release>
|
|
||||||
<version>
|
|
||||||
<release>0.5.0</release>
|
|
||||||
<api>0.5.0</api>
|
|
||||||
</version>
|
|
||||||
<stability>
|
|
||||||
<release>alpha</release>
|
|
||||||
<api>alpha</api>
|
|
||||||
</stability>
|
|
||||||
<date>2015-06-16</date>
|
|
||||||
<license>BSD</license>
|
|
||||||
<notes>
|
|
||||||
First alpha release
|
|
||||||
</notes>
|
|
||||||
</release>
|
|
||||||
<release>
|
|
||||||
<version>
|
|
||||||
<release>0.5.1</release>
|
|
||||||
<api>0.5.1</api>
|
|
||||||
</version>
|
|
||||||
<stability>
|
|
||||||
<release>alpha</release>
|
|
||||||
<api>alpha</api>
|
|
||||||
</stability>
|
|
||||||
<date>2015-07-09</date>
|
|
||||||
<license>BSD</license>
|
|
||||||
<notes>
|
|
||||||
Update to wrap gRPC C Core version 0.10.0
|
|
||||||
</notes>
|
|
||||||
</release>
|
|
||||||
<release>
|
|
||||||
<version>
|
|
||||||
<release>0.6.0</release>
|
|
||||||
<api>0.6.0</api>
|
|
||||||
</version>
|
|
||||||
<stability>
|
|
||||||
<release>beta</release>
|
|
||||||
<api>beta</api>
|
|
||||||
</stability>
|
|
||||||
<date>2015-09-24</date>
|
|
||||||
<license>BSD</license>
|
|
||||||
<notes>
|
|
||||||
- support per message compression disable
|
|
||||||
- expose per-call host override option
|
|
||||||
- expose connectivity API
|
|
||||||
- expose channel target and call peer
|
|
||||||
- add user-agent
|
|
||||||
- update to wrap gRPC C core library beta version 0.11.0
|
|
||||||
</notes>
|
|
||||||
</release>
|
|
||||||
<release>
|
|
||||||
<version>
|
|
||||||
<release>0.6.1</release>
|
|
||||||
<api>0.6.0</api>
|
|
||||||
</version>
|
|
||||||
<stability>
|
|
||||||
<release>beta</release>
|
|
||||||
<api>beta</api>
|
|
||||||
</stability>
|
|
||||||
<date>2015-10-21</date>
|
|
||||||
<license>BSD</license>
|
|
||||||
<notes>
|
|
||||||
- fixed undefined constant fatal error when run with apache/nginx #2275
|
|
||||||
</notes>
|
|
||||||
</release>
|
|
||||||
<release>
|
|
||||||
<version>
|
|
||||||
<release>0.7.0</release>
|
|
||||||
<api>0.7.0</api>
|
|
||||||
</version>
|
|
||||||
<stability>
|
|
||||||
<release>beta</release>
|
|
||||||
<api>beta</api>
|
|
||||||
</stability>
|
|
||||||
<date>2016-01-13</date>
|
|
||||||
<license>BSD</license>
|
|
||||||
<notes>
|
|
||||||
- Breaking change to Credentials class (removed) #3765
|
|
||||||
- Replaced by ChannelCredentials and CallCredentials class #3765
|
|
||||||
- New plugin based metadata auth API #4394
|
|
||||||
- Explicit ChannelCredentials::createInsecure() call
|
|
||||||
</notes>
|
|
||||||
</release>
|
|
||||||
</changelog>
|
|
||||||
</package>
|
|
||||||
|
|
@ -40,6 +40,7 @@
|
||||||
#define php_grpc_int int
|
#define php_grpc_int int
|
||||||
#define php_grpc_long long
|
#define php_grpc_long long
|
||||||
#define php_grpc_ulong ulong
|
#define php_grpc_ulong ulong
|
||||||
|
#define php_grpc_zend_object zend_object_value
|
||||||
#define php_grpc_add_property_string(arg, name, context, b) \
|
#define php_grpc_add_property_string(arg, name, context, b) \
|
||||||
add_property_string(arg, name, context, b)
|
add_property_string(arg, name, context, b)
|
||||||
#define php_grpc_add_property_stringl(res, name, str, len, b) \
|
#define php_grpc_add_property_stringl(res, name, str, len, b) \
|
||||||
|
|
@ -49,6 +50,7 @@
|
||||||
|
|
||||||
#define PHP_GRPC_RETURN_STRING(val, dup) RETURN_STRING(val, dup)
|
#define PHP_GRPC_RETURN_STRING(val, dup) RETURN_STRING(val, dup)
|
||||||
#define PHP_GRPC_MAKE_STD_ZVAL(pzv) MAKE_STD_ZVAL(pzv)
|
#define PHP_GRPC_MAKE_STD_ZVAL(pzv) MAKE_STD_ZVAL(pzv)
|
||||||
|
#define PHP_GRPC_DELREF(zv) Z_DELREF_P(zv)
|
||||||
|
|
||||||
#define PHP_GRPC_WRAP_OBJECT_START(name) \
|
#define PHP_GRPC_WRAP_OBJECT_START(name) \
|
||||||
typedef struct name { \
|
typedef struct name { \
|
||||||
|
|
@ -56,11 +58,82 @@
|
||||||
#define PHP_GRPC_WRAP_OBJECT_END(name) \
|
#define PHP_GRPC_WRAP_OBJECT_END(name) \
|
||||||
} name;
|
} name;
|
||||||
|
|
||||||
|
#define PHP_GRPC_FREE_WRAPPED_FUNC_START(class_object) \
|
||||||
|
void free_##class_object(void *object TSRMLS_DC) { \
|
||||||
|
class_object *p = (class_object *)object;
|
||||||
|
#define PHP_GRPC_FREE_WRAPPED_FUNC_END() \
|
||||||
|
zend_object_std_dtor(&p->std TSRMLS_CC); \
|
||||||
|
efree(p); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define PHP_GRPC_ALLOC_CLASS_OBJECT(class_object) \
|
||||||
|
class_object *intern; \
|
||||||
|
zend_object_value retval; \
|
||||||
|
intern = (class_object *)emalloc(sizeof(class_object)); \
|
||||||
|
memset(intern, 0, sizeof(class_object));
|
||||||
|
|
||||||
|
#define PHP_GRPC_FREE_CLASS_OBJECT(class_object, handler) \
|
||||||
|
retval.handle = zend_objects_store_put( \
|
||||||
|
intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, \
|
||||||
|
free_##class_object, NULL TSRMLS_CC); \
|
||||||
|
retval.handlers = zend_get_std_object_handlers(); \
|
||||||
|
return retval;
|
||||||
|
|
||||||
|
#define PHP_GRPC_HASH_FOREACH_VAL_START(ht, data) \
|
||||||
|
zval **tmp_data = NULL; \
|
||||||
|
for (zend_hash_internal_pointer_reset(ht); \
|
||||||
|
zend_hash_get_current_data(ht, (void**)&tmp_data) == SUCCESS; \
|
||||||
|
zend_hash_move_forward(ht)) { \
|
||||||
|
data = *tmp_data;
|
||||||
|
|
||||||
|
#define PHP_GRPC_HASH_FOREACH_STR_KEY_VAL_START(ht, key, key_type, data) \
|
||||||
|
zval **tmp##key = NULL; \
|
||||||
|
ulong index##key; \
|
||||||
|
uint len##key; \
|
||||||
|
for (zend_hash_internal_pointer_reset(ht); \
|
||||||
|
zend_hash_get_current_data(ht, (void**)&tmp##key) == SUCCESS; \
|
||||||
|
zend_hash_move_forward(ht)) { \
|
||||||
|
key_type = zend_hash_get_current_key_ex(ht, &key, &len##key, &index##key,\
|
||||||
|
0, NULL); \
|
||||||
|
data = *tmp##key;
|
||||||
|
|
||||||
|
#define PHP_GRPC_HASH_FOREACH_LONG_KEY_VAL_START(ht, key, key_type, index,\
|
||||||
|
data) \
|
||||||
|
zval **tmp##key = NULL; \
|
||||||
|
uint len##key; \
|
||||||
|
for (zend_hash_internal_pointer_reset(ht); \
|
||||||
|
zend_hash_get_current_data(ht, (void**)&tmp##key) == SUCCESS; \
|
||||||
|
zend_hash_move_forward(ht)) { \
|
||||||
|
key_type = zend_hash_get_current_key_ex(ht, &key, &len##key, &index,\
|
||||||
|
0, NULL); \
|
||||||
|
data = *tmp##key;
|
||||||
|
|
||||||
|
#define PHP_GRPC_HASH_FOREACH_END() }
|
||||||
|
|
||||||
|
static inline int php_grpc_zend_hash_find(HashTable *ht, char *key, int len,
|
||||||
|
void **value) {
|
||||||
|
zval **data = NULL;
|
||||||
|
if (zend_hash_find(ht, key, len, (void **)&data) == SUCCESS) {
|
||||||
|
*value = *data;
|
||||||
|
return SUCCESS;
|
||||||
|
} else {
|
||||||
|
*value = NULL;
|
||||||
|
return FAILURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define php_grpc_zend_hash_del zend_hash_del
|
||||||
|
|
||||||
|
#define PHP_GRPC_GET_CLASS_ENTRY(object) zend_get_class_entry(object TSRMLS_CC)
|
||||||
|
|
||||||
|
#define PHP_GRPC_INIT_HANDLER(class_object, handler_name)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define php_grpc_int size_t
|
#define php_grpc_int size_t
|
||||||
#define php_grpc_long zend_long
|
#define php_grpc_long zend_long
|
||||||
#define php_grpc_ulong zend_ulong
|
#define php_grpc_ulong zend_ulong
|
||||||
|
#define php_grpc_zend_object zend_object*
|
||||||
#define php_grpc_add_property_string(arg, name, context, b) \
|
#define php_grpc_add_property_string(arg, name, context, b) \
|
||||||
add_property_string(arg, name, context)
|
add_property_string(arg, name, context)
|
||||||
#define php_grpc_add_property_stringl(res, name, str, len, b) \
|
#define php_grpc_add_property_stringl(res, name, str, len, b) \
|
||||||
|
|
@ -72,6 +145,7 @@
|
||||||
#define PHP_GRPC_MAKE_STD_ZVAL(pzv) \
|
#define PHP_GRPC_MAKE_STD_ZVAL(pzv) \
|
||||||
zval _stack_zval_##pzv; \
|
zval _stack_zval_##pzv; \
|
||||||
pzv = &(_stack_zval_##pzv)
|
pzv = &(_stack_zval_##pzv)
|
||||||
|
#define PHP_GRPC_DELREF(zv)
|
||||||
|
|
||||||
#define PHP_GRPC_WRAP_OBJECT_START(name) \
|
#define PHP_GRPC_WRAP_OBJECT_START(name) \
|
||||||
typedef struct name {
|
typedef struct name {
|
||||||
|
|
@ -79,6 +153,66 @@
|
||||||
zend_object std; \
|
zend_object std; \
|
||||||
} name;
|
} name;
|
||||||
|
|
||||||
|
#define WRAPPED_OBJECT_FROM_OBJ(class_object, obj) \
|
||||||
|
class_object##_from_obj(obj);
|
||||||
|
|
||||||
|
#define PHP_GRPC_FREE_WRAPPED_FUNC_START(class_object) \
|
||||||
|
static void free_##class_object(zend_object *object) { \
|
||||||
|
class_object *p = WRAPPED_OBJECT_FROM_OBJ(class_object, object)
|
||||||
|
#define PHP_GRPC_FREE_WRAPPED_FUNC_END() \
|
||||||
|
zend_object_std_dtor(&p->std); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define PHP_GRPC_ALLOC_CLASS_OBJECT(class_object) \
|
||||||
|
class_object *intern; \
|
||||||
|
intern = ecalloc(1, sizeof(class_object) + \
|
||||||
|
zend_object_properties_size(class_type));
|
||||||
|
|
||||||
|
#define PHP_GRPC_FREE_CLASS_OBJECT(class_object, handler) \
|
||||||
|
intern->std.handlers = &handler; \
|
||||||
|
return &intern->std;
|
||||||
|
|
||||||
|
#define PHP_GRPC_HASH_FOREACH_VAL_START(ht, data) \
|
||||||
|
ZEND_HASH_FOREACH_VAL(ht, data) {
|
||||||
|
|
||||||
|
#define PHP_GRPC_HASH_FOREACH_STR_KEY_VAL_START(ht, key, key_type, data) \
|
||||||
|
zend_string *(zs_##key); \
|
||||||
|
ZEND_HASH_FOREACH_STR_KEY_VAL(ht, (zs_##key), data) { \
|
||||||
|
if ((zs_##key) == NULL) {key = NULL; key_type = HASH_KEY_IS_LONG;} \
|
||||||
|
else {key = (zs_##key)->val; key_type = HASH_KEY_IS_STRING;}
|
||||||
|
|
||||||
|
#define PHP_GRPC_HASH_FOREACH_LONG_KEY_VAL_START(ht, key, key_type, index, \
|
||||||
|
data) \
|
||||||
|
zend_string *(zs_##key); \
|
||||||
|
ZEND_HASH_FOREACH_KEY_VAL(ht, index, zs_##key, data) { \
|
||||||
|
if ((zs_##key) == NULL) {key = NULL; key_type = HASH_KEY_IS_LONG;} \
|
||||||
|
else {key = (zs_##key)->val; key_type = HASH_KEY_IS_STRING;}
|
||||||
|
|
||||||
|
#define PHP_GRPC_HASH_FOREACH_END() } ZEND_HASH_FOREACH_END();
|
||||||
|
|
||||||
|
static inline int php_grpc_zend_hash_find(HashTable *ht, char *key, int len,
|
||||||
|
void **value) {
|
||||||
|
zval *value_tmp = zend_hash_str_find(ht, key, len -1);
|
||||||
|
if (value_tmp == NULL) {
|
||||||
|
return FAILURE;
|
||||||
|
} else {
|
||||||
|
*value = (void *)value_tmp;
|
||||||
|
return SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int php_grpc_zend_hash_del(HashTable *ht, char *key, int len) {
|
||||||
|
return zend_hash_str_del(ht, key, len - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define PHP_GRPC_GET_CLASS_ENTRY(object) Z_OBJ_P(object)->ce
|
||||||
|
|
||||||
|
#define PHP_GRPC_INIT_HANDLER(class_object, handler_name) \
|
||||||
|
memcpy(&handler_name, zend_get_std_object_handlers(), \
|
||||||
|
sizeof(zend_object_handlers)); \
|
||||||
|
handler_name.offset = XtOffsetOf(class_object, std); \
|
||||||
|
handler_name.free_obj = free_##class_object
|
||||||
|
|
||||||
#endif /* PHP_MAJOR_VERSION */
|
#endif /* PHP_MAJOR_VERSION */
|
||||||
|
|
||||||
#endif /* PHP7_WRAPPER_GRPC_H */
|
#endif /* PHP7_WRAPPER_GRPC_H */
|
||||||
|
|
|
||||||
|
|
@ -57,73 +57,31 @@
|
||||||
#include "timeval.h"
|
#include "timeval.h"
|
||||||
|
|
||||||
zend_class_entry *grpc_ce_server;
|
zend_class_entry *grpc_ce_server;
|
||||||
|
#if PHP_MAJOR_VERSION >= 7
|
||||||
#if PHP_MAJOR_VERSION < 7
|
static zend_object_handlers server_ce_handlers;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Frees and destroys an instance of wrapped_grpc_server */
|
/* Frees and destroys an instance of wrapped_grpc_server */
|
||||||
void free_wrapped_grpc_server(void *object TSRMLS_DC) {
|
PHP_GRPC_FREE_WRAPPED_FUNC_START(wrapped_grpc_server)
|
||||||
wrapped_grpc_server *server = (wrapped_grpc_server *)object;
|
if (p->wrapped != NULL) {
|
||||||
if (server->wrapped != NULL) {
|
grpc_server_shutdown_and_notify(p->wrapped, completion_queue, NULL);
|
||||||
grpc_server_shutdown_and_notify(server->wrapped, completion_queue, NULL);
|
grpc_server_cancel_all_calls(p->wrapped);
|
||||||
grpc_server_cancel_all_calls(server->wrapped);
|
|
||||||
grpc_completion_queue_pluck(completion_queue, NULL,
|
grpc_completion_queue_pluck(completion_queue, NULL,
|
||||||
gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
|
gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
|
||||||
grpc_server_destroy(server->wrapped);
|
grpc_server_destroy(p->wrapped);
|
||||||
}
|
}
|
||||||
zend_object_std_dtor(&server->std TSRMLS_CC);
|
PHP_GRPC_FREE_WRAPPED_FUNC_END()
|
||||||
efree(server);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initializes an instance of wrapped_grpc_call to be associated with an object
|
/* Initializes an instance of wrapped_grpc_call to be associated with an object
|
||||||
* of a class specified by class_type */
|
* of a class specified by class_type */
|
||||||
zend_object_value create_wrapped_grpc_server(zend_class_entry *class_type
|
php_grpc_zend_object create_wrapped_grpc_server(zend_class_entry *class_type
|
||||||
TSRMLS_DC) {
|
TSRMLS_DC) {
|
||||||
zend_object_value retval;
|
PHP_GRPC_ALLOC_CLASS_OBJECT(wrapped_grpc_server);
|
||||||
wrapped_grpc_server *intern;
|
|
||||||
|
|
||||||
intern = (wrapped_grpc_server *)emalloc(sizeof(wrapped_grpc_server));
|
|
||||||
memset(intern, 0, sizeof(wrapped_grpc_server));
|
|
||||||
|
|
||||||
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
|
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
|
||||||
object_properties_init(&intern->std, class_type);
|
object_properties_init(&intern->std, class_type);
|
||||||
retval.handle = zend_objects_store_put(
|
PHP_GRPC_FREE_CLASS_OBJECT(wrapped_grpc_server, server_ce_handlers);
|
||||||
intern, (zend_objects_store_dtor_t)zend_objects_destroy_object,
|
|
||||||
free_wrapped_grpc_server, NULL TSRMLS_CC);
|
|
||||||
retval.handlers = zend_get_std_object_handlers();
|
|
||||||
return retval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
static zend_object_handlers server_ce_handlers;
|
|
||||||
|
|
||||||
/* Frees and destroys an instance of wrapped_grpc_server */
|
|
||||||
static void free_wrapped_grpc_server(zend_object *object) {
|
|
||||||
wrapped_grpc_server *server = wrapped_grpc_server_from_obj(object);
|
|
||||||
if (server->wrapped != NULL) {
|
|
||||||
grpc_server_shutdown_and_notify(server->wrapped, completion_queue, NULL);
|
|
||||||
grpc_server_cancel_all_calls(server->wrapped);
|
|
||||||
grpc_completion_queue_pluck(completion_queue, NULL,
|
|
||||||
gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
|
|
||||||
grpc_server_destroy(server->wrapped);
|
|
||||||
}
|
|
||||||
zend_object_std_dtor(&server->std);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initializes an instance of wrapped_grpc_call to be associated with an object
|
|
||||||
* of a class specified by class_type */
|
|
||||||
zend_object *create_wrapped_grpc_server(zend_class_entry *class_type) {
|
|
||||||
wrapped_grpc_server *intern;
|
|
||||||
intern = ecalloc(1, sizeof(wrapped_grpc_server) +
|
|
||||||
zend_object_properties_size(class_type));
|
|
||||||
zend_object_std_init(&intern->std, class_type);
|
|
||||||
object_properties_init(&intern->std, class_type);
|
|
||||||
intern->std.handlers = &server_ce_handlers;
|
|
||||||
return &intern->std;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new instance of the Server class
|
* Constructs a new instance of the Server class
|
||||||
* @param array $args The arguments to pass to the server (optional)
|
* @param array $args The arguments to pass to the server (optional)
|
||||||
|
|
@ -275,7 +233,7 @@ static zend_function_entry server_methods[] = {
|
||||||
PHP_ME(Server, addHttp2Port, NULL, ZEND_ACC_PUBLIC)
|
PHP_ME(Server, addHttp2Port, NULL, ZEND_ACC_PUBLIC)
|
||||||
PHP_ME(Server, addSecureHttp2Port, NULL, ZEND_ACC_PUBLIC)
|
PHP_ME(Server, addSecureHttp2Port, NULL, ZEND_ACC_PUBLIC)
|
||||||
PHP_ME(Server, start, NULL, ZEND_ACC_PUBLIC)
|
PHP_ME(Server, start, NULL, ZEND_ACC_PUBLIC)
|
||||||
PHP_FE_END
|
PHP_FE_END
|
||||||
};
|
};
|
||||||
|
|
||||||
void grpc_init_server(TSRMLS_D) {
|
void grpc_init_server(TSRMLS_D) {
|
||||||
|
|
@ -283,10 +241,5 @@ void grpc_init_server(TSRMLS_D) {
|
||||||
INIT_CLASS_ENTRY(ce, "Grpc\\Server", server_methods);
|
INIT_CLASS_ENTRY(ce, "Grpc\\Server", server_methods);
|
||||||
ce.create_object = create_wrapped_grpc_server;
|
ce.create_object = create_wrapped_grpc_server;
|
||||||
grpc_ce_server = zend_register_internal_class(&ce TSRMLS_CC);
|
grpc_ce_server = zend_register_internal_class(&ce TSRMLS_CC);
|
||||||
#if PHP_MAJOR_VERSION >= 7
|
PHP_GRPC_INIT_HANDLER(wrapped_grpc_server, server_ce_handlers);
|
||||||
memcpy(&server_ce_handlers, zend_get_std_object_handlers(),
|
|
||||||
sizeof(zend_object_handlers));
|
|
||||||
server_ce_handlers.offset = XtOffsetOf(wrapped_grpc_server, std);
|
|
||||||
server_ce_handlers.free_obj = free_wrapped_grpc_server;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -66,8 +66,7 @@ static inline wrapped_grpc_server
|
||||||
XtOffsetOf(wrapped_grpc_server, std));
|
XtOffsetOf(wrapped_grpc_server, std));
|
||||||
}
|
}
|
||||||
|
|
||||||
#define Z_WRAPPED_GRPC_SERVER_P(zv) \
|
#define Z_WRAPPED_GRPC_SERVER_P(zv) wrapped_grpc_server_from_obj(Z_OBJ_P((zv)))
|
||||||
wrapped_grpc_server_from_obj(Z_OBJ_P((zv)))
|
|
||||||
|
|
||||||
#endif /* PHP_MAJOR_VERSION */
|
#endif /* PHP_MAJOR_VERSION */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,69 +50,28 @@
|
||||||
#include <grpc/grpc_security.h>
|
#include <grpc/grpc_security.h>
|
||||||
|
|
||||||
zend_class_entry *grpc_ce_server_credentials;
|
zend_class_entry *grpc_ce_server_credentials;
|
||||||
|
#if PHP_MAJOR_VERSION >= 7
|
||||||
#if PHP_MAJOR_VERSION < 7
|
static zend_object_handlers server_credentials_ce_handlers;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Frees and destroys an instace of wrapped_grpc_server_credentials */
|
/* Frees and destroys an instace of wrapped_grpc_server_credentials */
|
||||||
void free_wrapped_grpc_server_credentials(void *object TSRMLS_DC) {
|
PHP_GRPC_FREE_WRAPPED_FUNC_START(wrapped_grpc_server_credentials)
|
||||||
wrapped_grpc_server_credentials *creds =
|
if (p->wrapped != NULL) {
|
||||||
(wrapped_grpc_server_credentials *)object;
|
grpc_server_credentials_release(p->wrapped);
|
||||||
if (creds->wrapped != NULL) {
|
|
||||||
grpc_server_credentials_release(creds->wrapped);
|
|
||||||
}
|
}
|
||||||
zend_object_std_dtor(&creds->std TSRMLS_CC);
|
PHP_GRPC_FREE_WRAPPED_FUNC_END()
|
||||||
efree(creds);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initializes an instace of wrapped_grpc_server_credentials to be associated
|
/* Initializes an instace of wrapped_grpc_server_credentials to be associated
|
||||||
* with an object of a class specified by class_type */
|
* with an object of a class specified by class_type */
|
||||||
zend_object_value create_wrapped_grpc_server_credentials(
|
php_grpc_zend_object create_wrapped_grpc_server_credentials(
|
||||||
zend_class_entry *class_type TSRMLS_DC) {
|
zend_class_entry *class_type TSRMLS_DC) {
|
||||||
zend_object_value retval;
|
PHP_GRPC_ALLOC_CLASS_OBJECT(wrapped_grpc_server_credentials);
|
||||||
wrapped_grpc_server_credentials *intern;
|
|
||||||
|
|
||||||
intern = (wrapped_grpc_server_credentials *)emalloc(
|
|
||||||
sizeof(wrapped_grpc_server_credentials));
|
|
||||||
memset(intern, 0, sizeof(wrapped_grpc_server_credentials));
|
|
||||||
|
|
||||||
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
|
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
|
||||||
object_properties_init(&intern->std, class_type);
|
object_properties_init(&intern->std, class_type);
|
||||||
retval.handle = zend_objects_store_put(
|
PHP_GRPC_FREE_CLASS_OBJECT(wrapped_grpc_server_credentials,
|
||||||
intern, (zend_objects_store_dtor_t)zend_objects_destroy_object,
|
server_credentials_ce_handlers);
|
||||||
free_wrapped_grpc_server_credentials, NULL TSRMLS_CC);
|
|
||||||
retval.handlers = zend_get_std_object_handlers();
|
|
||||||
return retval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
static zend_object_handlers server_credentials_ce_handlers;
|
|
||||||
|
|
||||||
/* Frees and destroys an instace of wrapped_grpc_server_credentials */
|
|
||||||
static void free_wrapped_grpc_server_credentials(zend_object *object) {
|
|
||||||
wrapped_grpc_server_credentials *creds =
|
|
||||||
wrapped_grpc_server_creds_from_obj(object);
|
|
||||||
if (creds->wrapped != NULL) {
|
|
||||||
grpc_server_credentials_release(creds->wrapped);
|
|
||||||
}
|
|
||||||
zend_object_std_dtor(&creds->std);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initializes an instace of wrapped_grpc_server_credentials to be associated
|
|
||||||
* with an object of a class specified by class_type */
|
|
||||||
zend_object *create_wrapped_grpc_server_credentials(zend_class_entry
|
|
||||||
*class_type) {
|
|
||||||
wrapped_grpc_server_credentials *intern;
|
|
||||||
intern = ecalloc(1, sizeof(wrapped_grpc_server_credentials) +
|
|
||||||
zend_object_properties_size(class_type));
|
|
||||||
zend_object_std_init(&intern->std, class_type);
|
|
||||||
object_properties_init(&intern->std, class_type);
|
|
||||||
intern->std.handlers = &server_credentials_ce_handlers;
|
|
||||||
return &intern->std;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
zval *grpc_php_wrap_server_credentials(grpc_server_credentials
|
zval *grpc_php_wrap_server_credentials(grpc_server_credentials
|
||||||
*wrapped TSRMLS_DC) {
|
*wrapped TSRMLS_DC) {
|
||||||
zval *server_credentials_object;
|
zval *server_credentials_object;
|
||||||
|
|
@ -163,7 +122,7 @@ PHP_METHOD(ServerCredentials, createSsl) {
|
||||||
static zend_function_entry server_credentials_methods[] = {
|
static zend_function_entry server_credentials_methods[] = {
|
||||||
PHP_ME(ServerCredentials, createSsl, NULL,
|
PHP_ME(ServerCredentials, createSsl, NULL,
|
||||||
ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
|
ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
|
||||||
PHP_FE_END
|
PHP_FE_END
|
||||||
};
|
};
|
||||||
|
|
||||||
void grpc_init_server_credentials(TSRMLS_D) {
|
void grpc_init_server_credentials(TSRMLS_D) {
|
||||||
|
|
@ -171,13 +130,6 @@ void grpc_init_server_credentials(TSRMLS_D) {
|
||||||
INIT_CLASS_ENTRY(ce, "Grpc\\ServerCredentials", server_credentials_methods);
|
INIT_CLASS_ENTRY(ce, "Grpc\\ServerCredentials", server_credentials_methods);
|
||||||
ce.create_object = create_wrapped_grpc_server_credentials;
|
ce.create_object = create_wrapped_grpc_server_credentials;
|
||||||
grpc_ce_server_credentials = zend_register_internal_class(&ce TSRMLS_CC);
|
grpc_ce_server_credentials = zend_register_internal_class(&ce TSRMLS_CC);
|
||||||
#if PHP_MAJOR_VERSION >= 7
|
PHP_GRPC_INIT_HANDLER(wrapped_grpc_server_credentials,
|
||||||
memcpy(&server_credentials_ce_handlers,
|
server_credentials_ce_handlers);
|
||||||
zend_get_std_object_handlers(),
|
|
||||||
sizeof(zend_object_handlers));
|
|
||||||
server_credentials_ce_handlers.offset =
|
|
||||||
XtOffsetOf(wrapped_grpc_server_credentials, std);
|
|
||||||
server_credentials_ce_handlers.free_obj =
|
|
||||||
free_wrapped_grpc_server_credentials;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,13 +63,13 @@ PHP_GRPC_WRAP_OBJECT_END(wrapped_grpc_server_credentials)
|
||||||
#else
|
#else
|
||||||
|
|
||||||
static inline wrapped_grpc_server_credentials
|
static inline wrapped_grpc_server_credentials
|
||||||
*wrapped_grpc_server_creds_from_obj(zend_object *obj) {
|
*wrapped_grpc_server_credentials_from_obj(zend_object *obj) {
|
||||||
return (wrapped_grpc_server_credentials*)
|
return (wrapped_grpc_server_credentials*)(
|
||||||
((char*)(obj) - XtOffsetOf(wrapped_grpc_server_credentials, std));
|
(char*)(obj) - XtOffsetOf(wrapped_grpc_server_credentials, std));
|
||||||
}
|
}
|
||||||
|
|
||||||
#define Z_WRAPPED_GRPC_SERVER_CREDS_P(zv) \
|
#define Z_WRAPPED_GRPC_SERVER_CREDS_P(zv) \
|
||||||
wrapped_grpc_server_creds_from_obj(Z_OBJ_P((zv)))
|
wrapped_grpc_server_credentials_from_obj(Z_OBJ_P((zv)))
|
||||||
|
|
||||||
#endif /* PHP_MAJOR_VERSION */
|
#endif /* PHP_MAJOR_VERSION */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,57 +51,24 @@
|
||||||
#include <grpc/support/time.h>
|
#include <grpc/support/time.h>
|
||||||
|
|
||||||
zend_class_entry *grpc_ce_timeval;
|
zend_class_entry *grpc_ce_timeval;
|
||||||
|
#if PHP_MAJOR_VERSION >= 7
|
||||||
#if PHP_MAJOR_VERSION < 7
|
static zend_object_handlers timeval_ce_handlers;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Frees and destroys an instance of wrapped_grpc_call */
|
/* Frees and destroys an instance of wrapped_grpc_call */
|
||||||
void free_wrapped_grpc_timeval(void *object TSRMLS_DC) {
|
PHP_GRPC_FREE_WRAPPED_FUNC_START(wrapped_grpc_timeval)
|
||||||
wrapped_grpc_timeval *timeval = (wrapped_grpc_timeval *)object;
|
PHP_GRPC_FREE_WRAPPED_FUNC_END()
|
||||||
zend_object_std_dtor(&timeval->std TSRMLS_CC);
|
|
||||||
efree(timeval);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initializes an instance of wrapped_grpc_timeval to be associated with an
|
/* Initializes an instance of wrapped_grpc_timeval to be associated with an
|
||||||
* object of a class specified by class_type */
|
* object of a class specified by class_type */
|
||||||
zend_object_value create_wrapped_grpc_timeval(zend_class_entry *class_type
|
php_grpc_zend_object create_wrapped_grpc_timeval(zend_class_entry *class_type
|
||||||
TSRMLS_DC) {
|
TSRMLS_DC) {
|
||||||
zend_object_value retval;
|
PHP_GRPC_ALLOC_CLASS_OBJECT(wrapped_grpc_timeval);
|
||||||
wrapped_grpc_timeval *intern;
|
|
||||||
intern = (wrapped_grpc_timeval *)emalloc(sizeof(wrapped_grpc_timeval));
|
|
||||||
memset(intern, 0, sizeof(wrapped_grpc_timeval));
|
|
||||||
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
|
zend_object_std_init(&intern->std, class_type TSRMLS_CC);
|
||||||
object_properties_init(&intern->std, class_type);
|
object_properties_init(&intern->std, class_type);
|
||||||
retval.handle = zend_objects_store_put(
|
PHP_GRPC_FREE_CLASS_OBJECT(wrapped_grpc_timeval, timeval_ce_handlers);
|
||||||
intern, (zend_objects_store_dtor_t)zend_objects_destroy_object,
|
|
||||||
free_wrapped_grpc_timeval, NULL TSRMLS_CC);
|
|
||||||
retval.handlers = zend_get_std_object_handlers();
|
|
||||||
return retval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
static zend_object_handlers timeval_ce_handlers;
|
|
||||||
|
|
||||||
/* Frees and destroys an instance of wrapped_grpc_call */
|
|
||||||
static void free_wrapped_grpc_timeval(zend_object *object) {
|
|
||||||
wrapped_grpc_timeval *timeval = wrapped_grpc_timeval_from_obj(object);
|
|
||||||
zend_object_std_dtor(&timeval->std);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initializes an instance of wrapped_grpc_timeval to be associated with an
|
|
||||||
* object of a class specified by class_type */
|
|
||||||
zend_object *create_wrapped_grpc_timeval(zend_class_entry *class_type) {
|
|
||||||
wrapped_grpc_timeval *intern;
|
|
||||||
intern = ecalloc(1, sizeof(wrapped_grpc_timeval) +
|
|
||||||
zend_object_properties_size(class_type));
|
|
||||||
zend_object_std_init(&intern->std, class_type);
|
|
||||||
object_properties_init(&intern->std, class_type);
|
|
||||||
intern->std.handlers = &timeval_ce_handlers;
|
|
||||||
return &intern->std;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
zval *grpc_php_wrap_timeval(gpr_timespec wrapped TSRMLS_DC) {
|
zval *grpc_php_wrap_timeval(gpr_timespec wrapped TSRMLS_DC) {
|
||||||
zval *timeval_object;
|
zval *timeval_object;
|
||||||
PHP_GRPC_MAKE_STD_ZVAL(timeval_object);
|
PHP_GRPC_MAKE_STD_ZVAL(timeval_object);
|
||||||
|
|
@ -311,13 +278,7 @@ void grpc_init_timeval(TSRMLS_D) {
|
||||||
INIT_CLASS_ENTRY(ce, "Grpc\\Timeval", timeval_methods);
|
INIT_CLASS_ENTRY(ce, "Grpc\\Timeval", timeval_methods);
|
||||||
ce.create_object = create_wrapped_grpc_timeval;
|
ce.create_object = create_wrapped_grpc_timeval;
|
||||||
grpc_ce_timeval = zend_register_internal_class(&ce TSRMLS_CC);
|
grpc_ce_timeval = zend_register_internal_class(&ce TSRMLS_CC);
|
||||||
#if PHP_MAJOR_VERSION >= 7
|
PHP_GRPC_INIT_HANDLER(wrapped_grpc_timeval, timeval_ce_handlers);
|
||||||
memcpy(&timeval_ce_handlers, zend_get_std_object_handlers(),
|
|
||||||
sizeof(zend_object_handlers));
|
|
||||||
timeval_ce_handlers.offset =
|
|
||||||
XtOffsetOf(wrapped_grpc_timeval, std);
|
|
||||||
timeval_ce_handlers.free_obj = free_wrapped_grpc_timeval;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void grpc_shutdown_timeval(TSRMLS_D) {}
|
void grpc_shutdown_timeval(TSRMLS_D) {}
|
||||||
|
|
|
||||||
|
|
@ -240,6 +240,7 @@ CORE_SOURCE_FILES = [
|
||||||
'src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c',
|
'src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.c',
|
||||||
'src/core/ext/transport/chttp2/client/insecure/channel_create.c',
|
'src/core/ext/transport/chttp2/client/insecure/channel_create.c',
|
||||||
'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c',
|
'src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c',
|
||||||
|
'src/core/ext/lb_policy/grpclb/grpclb.c',
|
||||||
'src/core/ext/lb_policy/grpclb/load_balancer_api.c',
|
'src/core/ext/lb_policy/grpclb/load_balancer_api.c',
|
||||||
'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c',
|
'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c',
|
||||||
'third_party/nanopb/pb_common.c',
|
'third_party/nanopb/pb_common.c',
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ inherit_from: .rubocop_todo.yml
|
||||||
AllCops:
|
AllCops:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'bin/apis/**/*'
|
- 'bin/apis/**/*'
|
||||||
- 'bin/math.rb'
|
- 'bin/math_pb.rb'
|
||||||
- 'bin/math_services.rb'
|
- 'bin/math_services_pb.rb'
|
||||||
- 'pb/grpc/health/v1/*'
|
- 'pb/grpc/health/v1/*'
|
||||||
- 'pb/test/**/*'
|
- 'pb/test/**/*'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
|
||||||
$LOAD_PATH.unshift(this_dir) unless $LOAD_PATH.include?(this_dir)
|
$LOAD_PATH.unshift(this_dir) unless $LOAD_PATH.include?(this_dir)
|
||||||
|
|
||||||
require 'grpc'
|
require 'grpc'
|
||||||
require 'math_services'
|
require 'math_services_pb'
|
||||||
require 'optparse'
|
require 'optparse'
|
||||||
|
|
||||||
include GRPC::Core::TimeConsts
|
include GRPC::Core::TimeConsts
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ $LOAD_PATH.unshift(this_dir) unless $LOAD_PATH.include?(this_dir)
|
||||||
require 'forwardable'
|
require 'forwardable'
|
||||||
require 'grpc'
|
require 'grpc'
|
||||||
require 'logger'
|
require 'logger'
|
||||||
require 'math_services'
|
require 'math_services_pb'
|
||||||
require 'optparse'
|
require 'optparse'
|
||||||
|
|
||||||
# RubyLogger defines a logger for gRPC based on the standard ruby logger.
|
# RubyLogger defines a logger for gRPC based on the standard ruby logger.
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
require 'grpc'
|
require 'grpc'
|
||||||
require 'math'
|
require 'math_pb'
|
||||||
|
|
||||||
module Math
|
module Math
|
||||||
module Math
|
module Math
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
require 'grpc'
|
require 'grpc'
|
||||||
require 'grpc/health/v1/health_services'
|
require 'grpc/health/v1/health_services_pb'
|
||||||
require 'thread'
|
require 'thread'
|
||||||
|
|
||||||
module Grpc
|
module Grpc
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
require 'grpc'
|
require 'grpc'
|
||||||
require 'grpc/health/v1/health'
|
require 'grpc/health/v1/health_pb'
|
||||||
|
|
||||||
module Grpc
|
module Grpc
|
||||||
module Health
|
module Health
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||||
# Source: grpc/testing/duplicate/echo_duplicate.proto for package 'grpc.testing.duplicate'
|
# Source: src/proto/grpc/testing/duplicate/echo_duplicate.proto for package 'grpc.testing.duplicate'
|
||||||
# Original file comments:
|
# Original file comments:
|
||||||
# Copyright 2015, Google Inc.
|
# Copyright 2015, Google Inc.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
require 'grpc'
|
require 'grpc'
|
||||||
require 'grpc/testing/duplicate/echo_duplicate'
|
require 'src/proto/grpc/testing/duplicate/echo_duplicate_pb'
|
||||||
|
|
||||||
module Grpc
|
module Grpc
|
||||||
module Testing
|
module Testing
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||||
# source: grpc/testing/metrics.proto
|
# source: src/proto/grpc/testing/metrics.proto
|
||||||
|
|
||||||
require 'google/protobuf'
|
require 'google/protobuf'
|
||||||
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||||
# Source: grpc/testing/metrics.proto for package 'grpc.testing'
|
# Source: src/proto/grpc/testing/metrics.proto for package 'grpc.testing'
|
||||||
# Original file comments:
|
# Original file comments:
|
||||||
# Copyright 2015-2016, Google Inc.
|
# Copyright 2015-2016, Google Inc.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
|
|
@ -38,7 +38,7 @@
|
||||||
# service.
|
# service.
|
||||||
|
|
||||||
require 'grpc'
|
require 'grpc'
|
||||||
require 'grpc/testing/metrics'
|
require 'src/proto/grpc/testing/metrics_pb'
|
||||||
|
|
||||||
module Grpc
|
module Grpc
|
||||||
module Testing
|
module Testing
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
require 'google/protobuf'
|
require 'google/protobuf'
|
||||||
|
|
||||||
require 'src/proto/grpc/testing/empty'
|
require 'src/proto/grpc/testing/empty_pb'
|
||||||
require 'src/proto/grpc/testing/messages'
|
require 'src/proto/grpc/testing/messages_pb'
|
||||||
Google::Protobuf::DescriptorPool.generated_pool.build do
|
Google::Protobuf::DescriptorPool.generated_pool.build do
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
require 'grpc'
|
require 'grpc'
|
||||||
require 'src/proto/grpc/testing/test'
|
require 'src/proto/grpc/testing/test_pb'
|
||||||
|
|
||||||
module Grpc
|
module Grpc
|
||||||
module Testing
|
module Testing
|
||||||
|
|
@ -52,9 +52,9 @@ require_relative '../../lib/grpc'
|
||||||
require 'googleauth'
|
require 'googleauth'
|
||||||
require 'google/protobuf'
|
require 'google/protobuf'
|
||||||
|
|
||||||
require_relative '../src/proto/grpc/testing/empty'
|
require_relative '../src/proto/grpc/testing/empty_pb'
|
||||||
require_relative '../src/proto/grpc/testing/messages'
|
require_relative '../src/proto/grpc/testing/messages_pb'
|
||||||
require_relative '../src/proto/grpc/testing/test_services'
|
require_relative '../src/proto/grpc/testing/test_services_pb'
|
||||||
|
|
||||||
AUTH_ENV = Google::Auth::CredentialsLoader::ENV_VAR
|
AUTH_ENV = Google::Auth::CredentialsLoader::ENV_VAR
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,9 +50,9 @@ require 'optparse'
|
||||||
|
|
||||||
require 'grpc'
|
require 'grpc'
|
||||||
|
|
||||||
require_relative '../src/proto/grpc/testing/empty'
|
require_relative '../src/proto/grpc/testing/empty_pb'
|
||||||
require_relative '../src/proto/grpc/testing/messages'
|
require_relative '../src/proto/grpc/testing/messages_pb'
|
||||||
require_relative '../src/proto/grpc/testing/test_services'
|
require_relative '../src/proto/grpc/testing/test_services_pb'
|
||||||
|
|
||||||
# DebugIsTruncated extends the default Logger to truncate debug messages
|
# DebugIsTruncated extends the default Logger to truncate debug messages
|
||||||
class DebugIsTruncated < Logger
|
class DebugIsTruncated < Logger
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ $LOAD_PATH.unshift(this_dir) unless $LOAD_PATH.include?(this_dir)
|
||||||
|
|
||||||
require 'grpc'
|
require 'grpc'
|
||||||
require 'histogram'
|
require 'histogram'
|
||||||
require 'src/proto/grpc/testing/services_services'
|
require 'src/proto/grpc/testing/services_services_pb'
|
||||||
|
|
||||||
class Poisson
|
class Poisson
|
||||||
def interarrival
|
def interarrival
|
||||||
|
|
|
||||||
|
|
@ -38,9 +38,9 @@ $LOAD_PATH.unshift(this_dir) unless $LOAD_PATH.include?(this_dir)
|
||||||
|
|
||||||
require 'grpc'
|
require 'grpc'
|
||||||
require 'qps-common'
|
require 'qps-common'
|
||||||
require 'src/proto/grpc/testing/messages'
|
require 'src/proto/grpc/testing/messages_pb'
|
||||||
require 'src/proto/grpc/testing/services_services'
|
require 'src/proto/grpc/testing/services_services_pb'
|
||||||
require 'src/proto/grpc/testing/stats'
|
require 'src/proto/grpc/testing/stats_pb'
|
||||||
|
|
||||||
class BenchmarkServiceImpl < Grpc::Testing::BenchmarkService::Service
|
class BenchmarkServiceImpl < Grpc::Testing::BenchmarkService::Service
|
||||||
def unary_call(req, _call)
|
def unary_call(req, _call)
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
require 'google/protobuf'
|
require 'google/protobuf'
|
||||||
|
|
||||||
require 'src/proto/grpc/testing/payloads'
|
require 'src/proto/grpc/testing/payloads_pb'
|
||||||
require 'src/proto/grpc/testing/stats'
|
require 'src/proto/grpc/testing/stats_pb'
|
||||||
Google::Protobuf::DescriptorPool.generated_pool.build do
|
Google::Protobuf::DescriptorPool.generated_pool.build do
|
||||||
add_message "grpc.testing.PoissonParams" do
|
add_message "grpc.testing.PoissonParams" do
|
||||||
optional :offered_load, :double, 1
|
optional :offered_load, :double, 1
|
||||||
|
|
@ -109,6 +109,8 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
|
||||||
repeated :server_stats, :message, 4, "grpc.testing.ServerStats"
|
repeated :server_stats, :message, 4, "grpc.testing.ServerStats"
|
||||||
repeated :server_cores, :int32, 5
|
repeated :server_cores, :int32, 5
|
||||||
optional :summary, :message, 6, "grpc.testing.ScenarioResultSummary"
|
optional :summary, :message, 6, "grpc.testing.ScenarioResultSummary"
|
||||||
|
repeated :client_success, :bool, 7
|
||||||
|
repeated :server_success, :bool, 8
|
||||||
end
|
end
|
||||||
add_enum "grpc.testing.ClientType" do
|
add_enum "grpc.testing.ClientType" do
|
||||||
value :SYNC_CLIENT, 0
|
value :SYNC_CLIENT, 0
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
require 'google/protobuf'
|
require 'google/protobuf'
|
||||||
|
|
||||||
require 'src/proto/grpc/testing/messages'
|
require 'src/proto/grpc/testing/messages_pb'
|
||||||
require 'src/proto/grpc/testing/control'
|
require 'src/proto/grpc/testing/control_pb'
|
||||||
Google::Protobuf::DescriptorPool.generated_pool.build do
|
Google::Protobuf::DescriptorPool.generated_pool.build do
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
# of unary/streaming requests/responses.
|
# of unary/streaming requests/responses.
|
||||||
|
|
||||||
require 'grpc'
|
require 'grpc'
|
||||||
require 'src/proto/grpc/testing/services'
|
require 'src/proto/grpc/testing/services_pb'
|
||||||
|
|
||||||
module Grpc
|
module Grpc
|
||||||
module Testing
|
module Testing
|
||||||
|
|
@ -44,7 +44,7 @@ require 'facter'
|
||||||
require 'client'
|
require 'client'
|
||||||
require 'qps-common'
|
require 'qps-common'
|
||||||
require 'server'
|
require 'server'
|
||||||
require 'src/proto/grpc/testing/services_services'
|
require 'src/proto/grpc/testing/services_services_pb'
|
||||||
|
|
||||||
class WorkerServiceImpl < Grpc::Testing::WorkerService::Service
|
class WorkerServiceImpl < Grpc::Testing::WorkerService::Service
|
||||||
def cpu_cores
|
def cpu_cores
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ describe 'Ping protobuf code generation' do
|
||||||
# Get the current content
|
# Get the current content
|
||||||
service_path = File.join(root_dir, 'src', 'ruby', 'pb', 'grpc',
|
service_path = File.join(root_dir, 'src', 'ruby', 'pb', 'grpc',
|
||||||
'testing', 'duplicate',
|
'testing', 'duplicate',
|
||||||
'echo_duplicate_services.rb')
|
'echo_duplicate_services_pb.rb')
|
||||||
want = nil
|
want = nil
|
||||||
File.open(service_path) { |f| want = f.read }
|
File.open(service_path) { |f| want = f.read }
|
||||||
|
|
||||||
|
|
@ -54,7 +54,7 @@ describe 'Ping protobuf code generation' do
|
||||||
got = nil
|
got = nil
|
||||||
Dir.mktmpdir do |tmp_dir|
|
Dir.mktmpdir do |tmp_dir|
|
||||||
gen_out = File.join(tmp_dir, 'src', 'proto', 'grpc', 'testing',
|
gen_out = File.join(tmp_dir, 'src', 'proto', 'grpc', 'testing',
|
||||||
'duplicate', 'echo_duplicate_services.rb')
|
'duplicate', 'echo_duplicate_services_pb.rb')
|
||||||
pid = spawn(
|
pid = spawn(
|
||||||
'protoc',
|
'protoc',
|
||||||
'-I.',
|
'-I.',
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
require 'grpc'
|
require 'grpc'
|
||||||
require 'grpc/health/v1/health'
|
require 'grpc/health/v1/health_pb'
|
||||||
require 'grpc/health/checker'
|
require 'grpc/health/checker'
|
||||||
require 'open3'
|
require 'open3'
|
||||||
require 'tmpdir'
|
require 'tmpdir'
|
||||||
|
|
@ -43,7 +43,7 @@ describe 'Health protobuf code generation' do
|
||||||
skip 'protoc || grpc_ruby_plugin missing, cannot verify health code-gen'
|
skip 'protoc || grpc_ruby_plugin missing, cannot verify health code-gen'
|
||||||
else
|
else
|
||||||
it 'should already be loaded indirectly i.e, used by the other specs' do
|
it 'should already be loaded indirectly i.e, used by the other specs' do
|
||||||
expect(require('grpc/health/v1/health_services')).to be(false)
|
expect(require('grpc/health/v1/health_services_pb')).to be(false)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should have the same content as created by code generation' do
|
it 'should have the same content as created by code generation' do
|
||||||
|
|
@ -52,7 +52,7 @@ describe 'Health protobuf code generation' do
|
||||||
|
|
||||||
# Get the current content
|
# Get the current content
|
||||||
service_path = File.join(root_dir, 'ruby', 'pb', 'grpc',
|
service_path = File.join(root_dir, 'ruby', 'pb', 'grpc',
|
||||||
'health', 'v1', 'health_services.rb')
|
'health', 'v1', 'health_services_pb.rb')
|
||||||
want = nil
|
want = nil
|
||||||
File.open(service_path) { |f| want = f.read }
|
File.open(service_path) { |f| want = f.read }
|
||||||
|
|
||||||
|
|
@ -62,7 +62,7 @@ describe 'Health protobuf code generation' do
|
||||||
got = nil
|
got = nil
|
||||||
Dir.mktmpdir do |tmp_dir|
|
Dir.mktmpdir do |tmp_dir|
|
||||||
gen_out = File.join(tmp_dir, 'grpc', 'health', 'v1',
|
gen_out = File.join(tmp_dir, 'grpc', 'health', 'v1',
|
||||||
'health_services.rb')
|
'health_services_pb.rb')
|
||||||
pid = spawn(
|
pid = spawn(
|
||||||
'protoc',
|
'protoc',
|
||||||
'-I.',
|
'-I.',
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue