grpc 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +29456 -0
- data/Rakefile +13 -8
- data/etc/roots.pem +5114 -0
- data/include/grpc/byte_buffer.h +120 -0
- data/include/grpc/byte_buffer_reader.h +58 -0
- data/include/grpc/census.h +488 -0
- data/include/grpc/compression.h +106 -0
- data/include/grpc/grpc.h +732 -0
- data/include/grpc/grpc_security.h +374 -0
- data/include/grpc/grpc_zookeeper.h +59 -0
- data/include/grpc/status.h +163 -0
- data/include/grpc/support/alloc.h +72 -0
- data/include/grpc/support/atm.h +92 -0
- data/include/grpc/support/atm_gcc_atomic.h +72 -0
- data/include/grpc/support/atm_gcc_sync.h +87 -0
- data/include/grpc/support/atm_win32.h +125 -0
- data/include/grpc/support/avl.h +91 -0
- data/include/grpc/support/cmdline.h +101 -0
- data/include/grpc/support/cpu.h +57 -0
- data/include/grpc/support/histogram.h +76 -0
- data/include/grpc/support/host_port.h +64 -0
- data/include/grpc/support/log.h +108 -0
- data/include/grpc/support/log_win32.h +51 -0
- data/include/grpc/support/port_platform.h +356 -0
- data/include/grpc/support/slice.h +182 -0
- data/include/grpc/support/slice_buffer.h +102 -0
- data/include/grpc/support/string_util.h +61 -0
- data/include/grpc/support/subprocess.h +57 -0
- data/include/grpc/support/sync.h +315 -0
- data/include/grpc/support/sync_generic.h +55 -0
- data/include/grpc/support/sync_posix.h +47 -0
- data/include/grpc/support/sync_win32.h +49 -0
- data/include/grpc/support/thd.h +91 -0
- data/include/grpc/support/time.h +128 -0
- data/include/grpc/support/tls.h +77 -0
- data/include/grpc/support/tls_gcc.h +56 -0
- data/include/grpc/support/tls_msvc.h +56 -0
- data/include/grpc/support/tls_pthread.h +60 -0
- data/include/grpc/support/useful.h +75 -0
- data/src/core/census/aggregation.h +66 -0
- data/src/core/census/context.c +46 -0
- data/src/core/census/context.h +47 -0
- data/src/core/census/grpc_context.c +53 -0
- data/src/core/census/grpc_filter.c +184 -0
- data/src/core/census/grpc_filter.h +44 -0
- data/src/core/census/initialize.c +57 -0
- data/src/core/census/operation.c +63 -0
- data/src/core/census/rpc_metric_id.h +51 -0
- data/src/core/census/tracing.c +45 -0
- data/src/core/channel/channel_args.c +209 -0
- data/src/core/channel/channel_args.h +88 -0
- data/src/core/channel/channel_stack.c +262 -0
- data/src/core/channel/channel_stack.h +260 -0
- data/src/core/channel/client_channel.c +524 -0
- data/src/core/channel/client_channel.h +63 -0
- data/src/core/channel/client_uchannel.c +243 -0
- data/src/core/channel/client_uchannel.h +60 -0
- data/src/core/channel/compress_filter.c +297 -0
- data/src/core/channel/compress_filter.h +65 -0
- data/src/core/channel/connected_channel.c +167 -0
- data/src/core/channel/connected_channel.h +51 -0
- data/src/core/channel/context.h +49 -0
- data/src/core/channel/http_client_filter.c +248 -0
- data/src/core/channel/http_client_filter.h +44 -0
- data/src/core/channel/http_server_filter.c +233 -0
- data/src/core/channel/http_server_filter.h +42 -0
- data/src/core/channel/subchannel_call_holder.c +259 -0
- data/src/core/channel/subchannel_call_holder.h +98 -0
- data/src/core/client_config/client_config.c +72 -0
- data/src/core/client_config/client_config.h +53 -0
- data/src/core/client_config/connector.c +54 -0
- data/src/core/client_config/connector.h +95 -0
- data/src/core/client_config/default_initial_connect_string.c +39 -0
- data/src/core/client_config/initial_connect_string.c +53 -0
- data/src/core/client_config/initial_connect_string.h +50 -0
- data/src/core/client_config/lb_policies/pick_first.c +398 -0
- data/src/core/client_config/lb_policies/pick_first.h +43 -0
- data/src/core/client_config/lb_policies/round_robin.c +537 -0
- data/src/core/client_config/lb_policies/round_robin.h +46 -0
- data/src/core/client_config/lb_policy.c +134 -0
- data/src/core/client_config/lb_policy.h +143 -0
- data/src/core/client_config/lb_policy_factory.c +48 -0
- data/src/core/client_config/lb_policy_factory.h +73 -0
- data/src/core/client_config/lb_policy_registry.c +88 -0
- data/src/core/client_config/lb_policy_registry.h +54 -0
- data/src/core/client_config/resolver.c +82 -0
- data/src/core/client_config/resolver.h +94 -0
- data/src/core/client_config/resolver_factory.c +55 -0
- data/src/core/client_config/resolver_factory.h +82 -0
- data/src/core/client_config/resolver_registry.c +137 -0
- data/src/core/client_config/resolver_registry.h +65 -0
- data/src/core/client_config/resolvers/dns_resolver.c +257 -0
- data/src/core/client_config/resolvers/dns_resolver.h +42 -0
- data/src/core/client_config/resolvers/sockaddr_resolver.c +391 -0
- data/src/core/client_config/resolvers/sockaddr_resolver.h +50 -0
- data/src/core/client_config/subchannel.c +697 -0
- data/src/core/client_config/subchannel.h +165 -0
- data/src/core/client_config/subchannel_factory.c +49 -0
- data/src/core/client_config/subchannel_factory.h +66 -0
- data/src/core/client_config/uri_parser.c +242 -0
- data/src/core/client_config/uri_parser.h +51 -0
- data/src/core/compression/algorithm.c +166 -0
- data/src/core/compression/algorithm_metadata.h +53 -0
- data/src/core/compression/message_compress.c +198 -0
- data/src/core/compression/message_compress.h +52 -0
- data/src/core/debug/trace.c +136 -0
- data/src/core/debug/trace.h +43 -0
- data/src/core/httpcli/format_request.c +120 -0
- data/src/core/httpcli/format_request.h +45 -0
- data/src/core/httpcli/httpcli.c +286 -0
- data/src/core/httpcli/httpcli.h +162 -0
- data/src/core/httpcli/httpcli_security_connector.c +189 -0
- data/src/core/httpcli/parser.c +211 -0
- data/src/core/httpcli/parser.h +64 -0
- data/src/core/iomgr/closure.c +98 -0
- data/src/core/iomgr/closure.h +97 -0
- data/src/core/iomgr/endpoint.c +67 -0
- data/src/core/iomgr/endpoint.h +102 -0
- data/src/core/iomgr/endpoint_pair.h +47 -0
- data/src/core/iomgr/endpoint_pair_posix.c +82 -0
- data/src/core/iomgr/endpoint_pair_windows.c +97 -0
- data/src/core/iomgr/exec_ctx.c +72 -0
- data/src/core/iomgr/exec_ctx.h +78 -0
- data/src/core/iomgr/executor.c +143 -0
- data/src/core/iomgr/executor.h +53 -0
- data/src/core/iomgr/fd_posix.c +438 -0
- data/src/core/iomgr/fd_posix.h +189 -0
- data/src/core/iomgr/iocp_windows.c +206 -0
- data/src/core/iomgr/iocp_windows.h +56 -0
- data/src/core/iomgr/iomgr.c +156 -0
- data/src/core/iomgr/iomgr.h +43 -0
- data/src/core/iomgr/iomgr_internal.h +58 -0
- data/src/core/iomgr/iomgr_posix.c +52 -0
- data/src/core/iomgr/iomgr_posix.h +39 -0
- data/src/core/iomgr/iomgr_windows.c +73 -0
- data/src/core/iomgr/pollset.h +95 -0
- data/src/core/iomgr/pollset_multipoller_with_epoll.c +258 -0
- data/src/core/iomgr/pollset_multipoller_with_poll_posix.c +227 -0
- data/src/core/iomgr/pollset_posix.c +638 -0
- data/src/core/iomgr/pollset_posix.h +147 -0
- data/src/core/iomgr/pollset_set.h +67 -0
- data/src/core/iomgr/pollset_set_posix.c +182 -0
- data/src/core/iomgr/pollset_set_posix.h +61 -0
- data/src/core/iomgr/pollset_set_windows.c +60 -0
- data/src/core/iomgr/pollset_set_windows.h +39 -0
- data/src/core/iomgr/pollset_windows.c +248 -0
- data/src/core/iomgr/pollset_windows.h +79 -0
- data/src/core/iomgr/resolve_address.h +72 -0
- data/src/core/iomgr/resolve_address_posix.c +183 -0
- data/src/core/iomgr/resolve_address_windows.c +166 -0
- data/src/core/iomgr/sockaddr.h +47 -0
- data/src/core/iomgr/sockaddr_posix.h +44 -0
- data/src/core/iomgr/sockaddr_utils.c +234 -0
- data/src/core/iomgr/sockaddr_utils.h +89 -0
- data/src/core/iomgr/sockaddr_win32.h +46 -0
- data/src/core/iomgr/socket_utils_common_posix.c +208 -0
- data/src/core/iomgr/socket_utils_linux.c +51 -0
- data/src/core/iomgr/socket_utils_posix.c +70 -0
- data/src/core/iomgr/socket_utils_posix.h +113 -0
- data/src/core/iomgr/socket_windows.c +98 -0
- data/src/core/iomgr/socket_windows.h +111 -0
- data/src/core/iomgr/tcp_client.h +53 -0
- data/src/core/iomgr/tcp_client_posix.c +304 -0
- data/src/core/iomgr/tcp_client_windows.c +221 -0
- data/src/core/iomgr/tcp_posix.c +485 -0
- data/src/core/iomgr/tcp_posix.h +65 -0
- data/src/core/iomgr/tcp_server.h +83 -0
- data/src/core/iomgr/tcp_server_posix.c +562 -0
- data/src/core/iomgr/tcp_server_windows.c +509 -0
- data/src/core/iomgr/tcp_windows.c +406 -0
- data/src/core/iomgr/tcp_windows.h +57 -0
- data/src/core/iomgr/time_averaged_stats.c +77 -0
- data/src/core/iomgr/time_averaged_stats.h +88 -0
- data/src/core/iomgr/timer.c +345 -0
- data/src/core/iomgr/timer.h +89 -0
- data/src/core/iomgr/timer_heap.c +148 -0
- data/src/core/iomgr/timer_heap.h +57 -0
- data/src/core/iomgr/timer_internal.h +61 -0
- data/src/core/iomgr/udp_server.c +439 -0
- data/src/core/iomgr/udp_server.h +83 -0
- data/src/core/iomgr/wakeup_fd_eventfd.c +85 -0
- data/src/core/iomgr/wakeup_fd_nospecial.c +51 -0
- data/src/core/iomgr/wakeup_fd_pipe.c +97 -0
- data/src/core/iomgr/wakeup_fd_pipe.h +41 -0
- data/src/core/iomgr/wakeup_fd_posix.c +72 -0
- data/src/core/iomgr/wakeup_fd_posix.h +101 -0
- data/src/core/iomgr/workqueue.h +85 -0
- data/src/core/iomgr/workqueue_posix.c +143 -0
- data/src/core/iomgr/workqueue_posix.h +51 -0
- data/src/core/iomgr/workqueue_windows.c +40 -0
- data/src/core/iomgr/workqueue_windows.h +37 -0
- data/src/core/json/json.c +64 -0
- data/src/core/json/json.h +88 -0
- data/src/core/json/json_common.h +49 -0
- data/src/core/json/json_reader.c +660 -0
- data/src/core/json/json_reader.h +160 -0
- data/src/core/json/json_string.c +379 -0
- data/src/core/json/json_writer.c +260 -0
- data/src/core/json/json_writer.h +97 -0
- data/src/core/profiling/basic_timers.c +274 -0
- data/src/core/profiling/stap_timers.c +65 -0
- data/src/core/profiling/timers.h +119 -0
- data/src/core/security/auth_filters.h +42 -0
- data/src/core/security/base64.c +233 -0
- data/src/core/security/base64.h +52 -0
- data/src/core/security/client_auth_filter.c +337 -0
- data/src/core/security/credentials.c +1273 -0
- data/src/core/security/credentials.h +376 -0
- data/src/core/security/credentials_metadata.c +101 -0
- data/src/core/security/credentials_posix.c +61 -0
- data/src/core/security/credentials_win32.c +61 -0
- data/src/core/security/google_default_credentials.c +260 -0
- data/src/core/security/handshake.c +327 -0
- data/src/core/security/handshake.h +50 -0
- data/src/core/security/json_token.c +405 -0
- data/src/core/security/json_token.h +118 -0
- data/src/core/security/jwt_verifier.c +842 -0
- data/src/core/security/jwt_verifier.h +136 -0
- data/src/core/security/secure_endpoint.c +383 -0
- data/src/core/security/secure_endpoint.h +49 -0
- data/src/core/security/security_connector.c +756 -0
- data/src/core/security/security_connector.h +246 -0
- data/src/core/security/security_context.c +342 -0
- data/src/core/security/security_context.h +114 -0
- data/src/core/security/server_auth_filter.c +264 -0
- data/src/core/security/server_secure_chttp2.c +268 -0
- data/src/core/statistics/census_interface.h +76 -0
- data/src/core/statistics/census_rpc_stats.h +101 -0
- data/src/core/support/alloc.c +90 -0
- data/src/core/support/avl.c +288 -0
- data/src/core/support/block_annotate.h +48 -0
- data/src/core/support/cmdline.c +347 -0
- data/src/core/support/cpu_iphone.c +49 -0
- data/src/core/support/cpu_linux.c +78 -0
- data/src/core/support/cpu_posix.c +77 -0
- data/src/core/support/cpu_windows.c +47 -0
- data/src/core/support/env.h +60 -0
- data/src/core/support/env_linux.c +62 -0
- data/src/core/support/env_posix.c +57 -0
- data/src/core/support/env_win32.c +65 -0
- data/src/core/support/file.c +91 -0
- data/src/core/support/file.h +63 -0
- data/src/core/support/file_posix.c +85 -0
- data/src/core/support/file_win32.c +84 -0
- data/src/core/support/histogram.c +244 -0
- data/src/core/support/host_port.c +110 -0
- data/src/core/support/log.c +66 -0
- data/src/core/support/log_android.c +87 -0
- data/src/core/support/log_linux.c +105 -0
- data/src/core/support/log_posix.c +102 -0
- data/src/core/support/log_win32.c +125 -0
- data/src/core/support/murmur_hash.c +96 -0
- data/src/core/support/murmur_hash.h +44 -0
- data/src/core/support/slice.c +343 -0
- data/src/core/support/slice_buffer.c +282 -0
- data/src/core/support/stack_lockfree.c +175 -0
- data/src/core/support/stack_lockfree.h +53 -0
- data/src/core/support/string.c +296 -0
- data/src/core/support/string.h +121 -0
- data/src/core/support/string_posix.c +86 -0
- data/src/core/support/string_win32.c +109 -0
- data/src/core/support/string_win32.h +47 -0
- data/src/core/support/subprocess_posix.c +112 -0
- data/src/core/support/sync.c +122 -0
- data/src/core/support/sync_posix.c +104 -0
- data/src/core/support/sync_win32.c +128 -0
- data/src/core/support/thd.c +64 -0
- data/src/core/support/thd_internal.h +39 -0
- data/src/core/support/thd_posix.c +94 -0
- data/src/core/support/thd_win32.c +117 -0
- data/src/core/support/time.c +304 -0
- data/src/core/support/time_posix.c +161 -0
- data/src/core/support/time_precise.c +89 -0
- data/src/core/support/time_precise.h +42 -0
- data/src/core/support/time_win32.c +101 -0
- data/src/core/support/tls_pthread.c +45 -0
- data/src/core/surface/api_trace.c +36 -0
- data/src/core/surface/api_trace.h +65 -0
- data/src/core/surface/byte_buffer.c +97 -0
- data/src/core/surface/byte_buffer_reader.c +123 -0
- data/src/core/surface/call.c +1424 -0
- data/src/core/surface/call.h +109 -0
- data/src/core/surface/call_details.c +50 -0
- data/src/core/surface/call_log_batch.c +118 -0
- data/src/core/surface/call_test_only.h +64 -0
- data/src/core/surface/channel.c +327 -0
- data/src/core/surface/channel.h +74 -0
- data/src/core/surface/channel_connectivity.c +220 -0
- data/src/core/surface/channel_create.c +235 -0
- data/src/core/surface/channel_ping.c +79 -0
- data/src/core/surface/completion_queue.c +481 -0
- data/src/core/surface/completion_queue.h +91 -0
- data/src/core/surface/event_string.c +81 -0
- data/src/core/surface/event_string.h +42 -0
- data/src/core/surface/init.c +168 -0
- data/src/core/surface/init.h +40 -0
- data/src/core/surface/init_secure.c +42 -0
- data/src/core/surface/lame_client.c +149 -0
- data/src/core/surface/metadata_array.c +49 -0
- data/src/core/surface/secure_channel_create.c +336 -0
- data/src/core/surface/server.c +1343 -0
- data/src/core/surface/server.h +67 -0
- data/src/core/surface/server_chttp2.c +149 -0
- data/src/core/surface/server_create.c +51 -0
- data/src/core/surface/surface_trace.h +48 -0
- data/src/core/surface/validate_metadata.c +73 -0
- data/src/core/surface/version.c +39 -0
- data/src/core/transport/byte_stream.c +76 -0
- data/src/core/transport/byte_stream.h +88 -0
- data/src/core/transport/chttp2/alpn.c +56 -0
- data/src/core/transport/chttp2/alpn.h +49 -0
- data/src/core/transport/chttp2/bin_encoder.c +285 -0
- data/src/core/transport/chttp2/bin_encoder.h +54 -0
- data/src/core/transport/chttp2/frame.h +69 -0
- data/src/core/transport/chttp2/frame_data.c +245 -0
- data/src/core/transport/chttp2/frame_data.h +101 -0
- data/src/core/transport/chttp2/frame_goaway.c +193 -0
- data/src/core/transport/chttp2/frame_goaway.h +77 -0
- data/src/core/transport/chttp2/frame_ping.c +97 -0
- data/src/core/transport/chttp2/frame_ping.h +56 -0
- data/src/core/transport/chttp2/frame_rst_stream.c +100 -0
- data/src/core/transport/chttp2/frame_rst_stream.h +55 -0
- data/src/core/transport/chttp2/frame_settings.c +259 -0
- data/src/core/transport/chttp2/frame_settings.h +103 -0
- data/src/core/transport/chttp2/frame_window_update.c +114 -0
- data/src/core/transport/chttp2/frame_window_update.h +58 -0
- data/src/core/transport/chttp2/hpack_encoder.c +572 -0
- data/src/core/transport/chttp2/hpack_encoder.h +95 -0
- data/src/core/transport/chttp2/hpack_parser.c +1449 -0
- data/src/core/transport/chttp2/hpack_parser.h +116 -0
- data/src/core/transport/chttp2/hpack_table.c +361 -0
- data/src/core/transport/chttp2/hpack_table.h +108 -0
- data/src/core/transport/chttp2/http2_errors.h +56 -0
- data/src/core/transport/chttp2/huffsyms.c +297 -0
- data/src/core/transport/chttp2/huffsyms.h +48 -0
- data/src/core/transport/chttp2/incoming_metadata.c +96 -0
- data/src/core/transport/chttp2/incoming_metadata.h +60 -0
- data/src/core/transport/chttp2/internal.h +757 -0
- data/src/core/transport/chttp2/parsing.c +866 -0
- data/src/core/transport/chttp2/status_conversion.c +109 -0
- data/src/core/transport/chttp2/status_conversion.h +50 -0
- data/src/core/transport/chttp2/stream_lists.c +401 -0
- data/src/core/transport/chttp2/stream_map.c +198 -0
- data/src/core/transport/chttp2/stream_map.h +85 -0
- data/src/core/transport/chttp2/timeout_encoding.c +185 -0
- data/src/core/transport/chttp2/timeout_encoding.h +47 -0
- data/src/core/transport/chttp2/varint.c +66 -0
- data/src/core/transport/chttp2/varint.h +76 -0
- data/src/core/transport/chttp2/writing.c +356 -0
- data/src/core/transport/chttp2_transport.c +1692 -0
- data/src/core/transport/chttp2_transport.h +51 -0
- data/src/core/transport/connectivity_state.c +164 -0
- data/src/core/transport/connectivity_state.h +85 -0
- data/src/core/transport/metadata.c +690 -0
- data/src/core/transport/metadata.h +156 -0
- data/src/core/transport/metadata_batch.c +194 -0
- data/src/core/transport/metadata_batch.h +125 -0
- data/src/core/transport/static_metadata.c +90 -0
- data/src/core/transport/static_metadata.h +408 -0
- data/src/core/transport/transport.c +183 -0
- data/src/core/transport/transport.h +222 -0
- data/src/core/transport/transport_impl.h +78 -0
- data/src/core/transport/transport_op_string.c +140 -0
- data/src/core/tsi/fake_transport_security.c +525 -0
- data/src/core/tsi/fake_transport_security.h +61 -0
- data/src/core/tsi/ssl_transport_security.c +1467 -0
- data/src/core/tsi/ssl_transport_security.h +173 -0
- data/src/core/tsi/transport_security.c +284 -0
- data/src/core/tsi/transport_security.h +111 -0
- data/src/core/tsi/transport_security_interface.h +344 -0
- data/{bin → src/ruby/bin}/apis/google/protobuf/empty.rb +0 -0
- data/{bin → src/ruby/bin}/apis/pubsub_demo.rb +7 -15
- data/{bin → src/ruby/bin}/apis/tech/pubsub/proto/pubsub.rb +0 -0
- data/{bin → src/ruby/bin}/apis/tech/pubsub/proto/pubsub_services.rb +0 -0
- data/{bin → src/ruby/bin}/grpc_ruby_interop_client +0 -0
- data/{bin → src/ruby/bin}/grpc_ruby_interop_server +0 -0
- data/{bin → src/ruby/bin}/interop/interop_client.rb +0 -0
- data/{bin → src/ruby/bin}/interop/interop_server.rb +0 -0
- data/src/ruby/bin/math.rb +32 -0
- data/{bin → src/ruby/bin}/math_client.rb +1 -1
- data/{bin → src/ruby/bin}/math_server.rb +1 -1
- data/src/ruby/bin/math_services.rb +27 -0
- data/{bin → src/ruby/bin}/noproto_client.rb +1 -1
- data/{bin → src/ruby/bin}/noproto_server.rb +1 -1
- data/{ext → src/ruby/ext}/grpc/extconf.rb +24 -40
- data/{ext → src/ruby/ext}/grpc/rb_byte_buffer.c +0 -0
- data/{ext → src/ruby/ext}/grpc/rb_byte_buffer.h +0 -0
- data/{ext → src/ruby/ext}/grpc/rb_call.c +80 -18
- data/{ext → src/ruby/ext}/grpc/rb_call.h +6 -0
- data/src/ruby/ext/grpc/rb_call_credentials.c +315 -0
- data/src/ruby/ext/grpc/rb_call_credentials.h +46 -0
- data/{ext → src/ruby/ext}/grpc/rb_channel.c +19 -7
- data/{ext → src/ruby/ext}/grpc/rb_channel.h +0 -0
- data/{ext → src/ruby/ext}/grpc/rb_channel_args.c +2 -0
- data/{ext → src/ruby/ext}/grpc/rb_channel_args.h +0 -0
- data/src/ruby/ext/grpc/rb_channel_credentials.c +266 -0
- data/{ext/grpc/rb_credentials.h → src/ruby/ext/grpc/rb_channel_credentials.h} +3 -3
- data/{ext → src/ruby/ext}/grpc/rb_completion_queue.c +3 -1
- data/{ext → src/ruby/ext}/grpc/rb_completion_queue.h +0 -0
- data/src/ruby/ext/grpc/rb_event_thread.c +153 -0
- data/src/ruby/ext/grpc/rb_event_thread.h +37 -0
- data/{ext → src/ruby/ext}/grpc/rb_grpc.c +25 -5
- data/{ext → src/ruby/ext}/grpc/rb_grpc.h +0 -0
- data/{ext → src/ruby/ext}/grpc/rb_server.c +4 -1
- data/{ext → src/ruby/ext}/grpc/rb_server.h +0 -0
- data/{ext → src/ruby/ext}/grpc/rb_server_credentials.c +2 -0
- data/{ext → src/ruby/ext}/grpc/rb_server_credentials.h +0 -0
- data/{lib → src/ruby/lib}/grpc.rb +6 -1
- data/{lib → src/ruby/lib}/grpc/core/time_consts.rb +0 -0
- data/{lib → src/ruby/lib}/grpc/errors.rb +0 -0
- data/{lib → src/ruby/lib}/grpc/generic/active_call.rb +4 -6
- data/{lib → src/ruby/lib}/grpc/generic/bidi_call.rb +16 -4
- data/{lib → src/ruby/lib}/grpc/generic/client_stub.rb +42 -52
- data/{lib → src/ruby/lib}/grpc/generic/rpc_desc.rb +0 -0
- data/{lib → src/ruby/lib}/grpc/generic/rpc_server.rb +15 -8
- data/{lib → src/ruby/lib}/grpc/generic/service.rb +4 -2
- data/src/ruby/lib/grpc/grpc.so +0 -0
- data/{lib → src/ruby/lib}/grpc/logconfig.rb +0 -0
- data/{lib → src/ruby/lib}/grpc/notifier.rb +0 -0
- data/{lib → src/ruby/lib}/grpc/version.rb +2 -2
- data/src/ruby/pb/README.md +42 -0
- data/src/ruby/pb/generate_proto_ruby.sh +51 -0
- data/src/ruby/pb/grpc/health/checker.rb +75 -0
- data/src/ruby/pb/grpc/health/v1alpha/health.rb +29 -0
- data/src/ruby/pb/grpc/health/v1alpha/health_services.rb +28 -0
- data/src/ruby/pb/test/client.rb +469 -0
- data/src/ruby/pb/test/proto/empty.rb +15 -0
- data/src/ruby/pb/test/proto/messages.rb +80 -0
- data/src/ruby/pb/test/proto/test.rb +14 -0
- data/src/ruby/pb/test/proto/test_services.rb +64 -0
- data/src/ruby/pb/test/server.rb +253 -0
- data/{bin/math_services.rb → src/ruby/spec/call_credentials_spec.rb} +19 -18
- data/{spec → src/ruby/spec}/call_spec.rb +10 -1
- data/{spec/credentials_spec.rb → src/ruby/spec/channel_credentials_spec.rb} +38 -12
- data/{spec → src/ruby/spec}/channel_spec.rb +14 -9
- data/{spec → src/ruby/spec}/client_server_spec.rb +31 -2
- data/{spec → src/ruby/spec}/completion_queue_spec.rb +0 -0
- data/{spec → src/ruby/spec}/generic/active_call_spec.rb +2 -1
- data/{spec → src/ruby/spec}/generic/client_stub_spec.rb +27 -67
- data/{spec → src/ruby/spec}/generic/rpc_desc_spec.rb +0 -0
- data/{spec → src/ruby/spec}/generic/rpc_server_pool_spec.rb +0 -0
- data/{spec → src/ruby/spec}/generic/rpc_server_spec.rb +12 -46
- data/{spec → src/ruby/spec}/generic/service_spec.rb +6 -3
- data/{spec → src/ruby/spec}/pb/health/checker_spec.rb +8 -8
- data/{spec → src/ruby/spec}/server_credentials_spec.rb +0 -0
- data/{spec → src/ruby/spec}/server_spec.rb +0 -0
- data/{spec → src/ruby/spec}/spec_helper.rb +0 -0
- data/{spec → src/ruby/spec}/testdata/README +0 -0
- data/{spec → src/ruby/spec}/testdata/ca.pem +0 -0
- data/{spec → src/ruby/spec}/testdata/server1.key +0 -0
- data/src/ruby/spec/testdata/server1.pem +16 -0
- data/{spec → src/ruby/spec}/time_consts_spec.rb +0 -0
- metadata +496 -97
- data/bin/math.proto +0 -80
- data/bin/math.rb +0 -61
- data/ext/grpc/rb_credentials.c +0 -294
- data/lib/grpc/grpc.so +0 -0
- data/spec/testdata/server1.pem +0 -16
@@ -0,0 +1,37 @@
|
|
1
|
+
/*
|
2
|
+
*
|
3
|
+
* Copyright 2016, Google Inc.
|
4
|
+
* All rights reserved.
|
5
|
+
*
|
6
|
+
* Redistribution and use in source and binary forms, with or without
|
7
|
+
* modification, are permitted provided that the following conditions are
|
8
|
+
* met:
|
9
|
+
*
|
10
|
+
* * Redistributions of source code must retain the above copyright
|
11
|
+
* notice, this list of conditions and the following disclaimer.
|
12
|
+
* * Redistributions in binary form must reproduce the above
|
13
|
+
* copyright notice, this list of conditions and the following disclaimer
|
14
|
+
* in the documentation and/or other materials provided with the
|
15
|
+
* distribution.
|
16
|
+
* * Neither the name of Google Inc. nor the names of its
|
17
|
+
* contributors may be used to endorse or promote products derived from
|
18
|
+
* this software without specific prior written permission.
|
19
|
+
*
|
20
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
21
|
+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
22
|
+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
23
|
+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
24
|
+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
25
|
+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
26
|
+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
27
|
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
28
|
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
29
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
30
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
|
+
*
|
32
|
+
*/
|
33
|
+
|
34
|
+
void grpc_rb_event_queue_thread_start();
|
35
|
+
|
36
|
+
void grpc_rb_event_queue_enqueue(void (*callback)(void*),
|
37
|
+
void *argument);
|
@@ -41,10 +41,11 @@
|
|
41
41
|
#include <grpc/grpc.h>
|
42
42
|
#include <grpc/support/time.h>
|
43
43
|
#include "rb_call.h"
|
44
|
+
#include "rb_call_credentials.h"
|
44
45
|
#include "rb_channel.h"
|
46
|
+
#include "rb_channel_credentials.h"
|
45
47
|
#include "rb_completion_queue.h"
|
46
48
|
#include "rb_server.h"
|
47
|
-
#include "rb_credentials.h"
|
48
49
|
#include "rb_server_credentials.h"
|
49
50
|
|
50
51
|
static VALUE grpc_rb_cTimeVal = Qnil;
|
@@ -55,7 +56,10 @@ static rb_data_type_t grpc_rb_timespec_data_type = {
|
|
55
56
|
{NULL, NULL}},
|
56
57
|
NULL,
|
57
58
|
NULL,
|
58
|
-
|
59
|
+
#ifdef RUBY_TYPED_FREE_IMMEDIATELY
|
60
|
+
RUBY_TYPED_FREE_IMMEDIATELY
|
61
|
+
#endif
|
62
|
+
};
|
59
63
|
|
60
64
|
/* Alloc func that blocks allocation of a given object by raising an
|
61
65
|
* exception. */
|
@@ -88,7 +92,7 @@ static ID id_tv_sec;
|
|
88
92
|
static ID id_tv_nsec;
|
89
93
|
|
90
94
|
/**
|
91
|
-
* grpc_rb_time_timeval creates a
|
95
|
+
* grpc_rb_time_timeval creates a timeval from a ruby time object.
|
92
96
|
*
|
93
97
|
* This func is copied from ruby source, MRI/source/time.c, which is published
|
94
98
|
* under the same license as the ruby.h, on which the entire extensions is
|
@@ -134,7 +138,7 @@ gpr_timespec grpc_rb_time_timeval(VALUE time, int interval) {
|
|
134
138
|
d += 1;
|
135
139
|
f -= 1;
|
136
140
|
}
|
137
|
-
t.tv_sec = (
|
141
|
+
t.tv_sec = (gpr_int64)f;
|
138
142
|
if (f != t.tv_sec) {
|
139
143
|
rb_raise(rb_eRangeError, "%f out of Time range",
|
140
144
|
RFLOAT_VALUE(time));
|
@@ -262,10 +266,20 @@ static void Init_grpc_time_consts() {
|
|
262
266
|
id_tv_nsec = rb_intern("tv_nsec");
|
263
267
|
}
|
264
268
|
|
269
|
+
/*
|
270
|
+
TODO: find an alternative to ruby_vm_at_exit that is ok in Ruby 2.0 where
|
271
|
+
RUBY_TYPED_FREE_IMMEDIATELY is not defined.
|
272
|
+
|
273
|
+
At the moment, registering a function using ruby_vm_at_exit segfaults in Ruby
|
274
|
+
2.0. This is not an issue with the gRPC handler. More likely, this was an
|
275
|
+
in issue with 2.0 that got resolved in 2.1 and has not been backported.
|
276
|
+
*/
|
277
|
+
#ifdef RUBY_TYPED_FREE_IMMEDIATELY
|
265
278
|
static void grpc_rb_shutdown(ruby_vm_t *vm) {
|
266
279
|
(void)vm;
|
267
280
|
grpc_shutdown();
|
268
281
|
}
|
282
|
+
#endif
|
269
283
|
|
270
284
|
/* Initialize the GRPC module structs */
|
271
285
|
|
@@ -285,7 +299,12 @@ VALUE sym_metadata = Qundef;
|
|
285
299
|
|
286
300
|
void Init_grpc() {
|
287
301
|
grpc_init();
|
302
|
+
|
303
|
+
/* TODO: find alternative to ruby_vm_at_exit that is ok in Ruby 2.0 */
|
304
|
+
#ifdef RUBY_TYPED_FREE_IMMEDIATELY
|
288
305
|
ruby_vm_at_exit(grpc_rb_shutdown);
|
306
|
+
#endif
|
307
|
+
|
289
308
|
grpc_rb_mGRPC = rb_define_module("GRPC");
|
290
309
|
grpc_rb_mGrpcCore = rb_define_module_under(grpc_rb_mGRPC, "Core");
|
291
310
|
grpc_rb_sNewServerRpc =
|
@@ -300,7 +319,8 @@ void Init_grpc() {
|
|
300
319
|
Init_grpc_channel();
|
301
320
|
Init_grpc_completion_queue();
|
302
321
|
Init_grpc_call();
|
303
|
-
|
322
|
+
Init_grpc_call_credentials();
|
323
|
+
Init_grpc_channel_credentials();
|
304
324
|
Init_grpc_server();
|
305
325
|
Init_grpc_server_credentials();
|
306
326
|
Init_grpc_status_codes();
|
File without changes
|
@@ -101,11 +101,14 @@ static const rb_data_type_t grpc_rb_server_data_type = {
|
|
101
101
|
{NULL, NULL}},
|
102
102
|
NULL,
|
103
103
|
NULL,
|
104
|
+
#ifdef RUBY_TYPED_FREE_IMMEDIATELY
|
104
105
|
/* It is unsafe to specify RUBY_TYPED_FREE_IMMEDIATELY because the free function would block
|
105
106
|
* and we might want to unlock GVL
|
106
107
|
* TODO(yugui) Unlock GVL?
|
107
108
|
*/
|
108
|
-
0
|
109
|
+
0,
|
110
|
+
#endif
|
111
|
+
};
|
109
112
|
|
110
113
|
/* Allocates grpc_rb_server instances. */
|
111
114
|
static VALUE grpc_rb_server_alloc(VALUE cls) {
|
File without changes
|
@@ -91,7 +91,9 @@ static const rb_data_type_t grpc_rb_server_credentials_data_type = {
|
|
91
91
|
{grpc_rb_server_credentials_mark, grpc_rb_server_credentials_free,
|
92
92
|
GRPC_RB_MEMSIZE_UNAVAILABLE, {NULL, NULL}},
|
93
93
|
NULL, NULL,
|
94
|
+
#ifdef RUBY_TYPED_FREE_IMMEDIATELY
|
94
95
|
RUBY_TYPED_FREE_IMMEDIATELY
|
96
|
+
#endif
|
95
97
|
};
|
96
98
|
|
97
99
|
/* Allocates ServerCredential instances.
|
File without changes
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright 2015, Google Inc.
|
1
|
+
# Copyright 2015-2016, Google Inc.
|
2
2
|
# All rights reserved.
|
3
3
|
#
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
@@ -27,6 +27,11 @@
|
|
27
27
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
28
28
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
29
|
|
30
|
+
ssl_roots_path = File.expand_path('../../../../etc/roots.pem', __FILE__)
|
31
|
+
unless ENV['GRPC_DEFAULT_SSL_ROOTS_FILE_PATH']
|
32
|
+
ENV['GRPC_DEFAULT_SSL_ROOTS_FILE_PATH'] = ssl_roots_path
|
33
|
+
end
|
34
|
+
|
30
35
|
require 'grpc/errors'
|
31
36
|
require 'grpc/grpc'
|
32
37
|
require 'grpc/logconfig'
|
File without changes
|
File without changes
|
@@ -199,11 +199,7 @@ module GRPC
|
|
199
199
|
# marshalled.
|
200
200
|
def remote_send(req, marshalled = false)
|
201
201
|
GRPC.logger.debug("sending #{req}, marshalled? #{marshalled}")
|
202
|
-
|
203
|
-
payload = req
|
204
|
-
else
|
205
|
-
payload = @marshal.call(req)
|
206
|
-
end
|
202
|
+
payload = marshalled ? req : @marshal.call(req)
|
207
203
|
@call.run_batch(@cq, self, INFINITE_FUTURE, SEND_MESSAGE => payload)
|
208
204
|
end
|
209
205
|
|
@@ -417,7 +413,9 @@ module GRPC
|
|
417
413
|
# @return [Enumerator, nil] a response Enumerator
|
418
414
|
def bidi_streamer(requests, **kw, &blk)
|
419
415
|
start_call(**kw) unless @started
|
420
|
-
bd = BidiCall.new(@call, @cq, @marshal, @unmarshal
|
416
|
+
bd = BidiCall.new(@call, @cq, @marshal, @unmarshal,
|
417
|
+
metadata_tag: @metadata_tag)
|
418
|
+
@metadata_tag = nil # run_on_client ensures metadata is read
|
421
419
|
bd.run_on_client(requests, @op_notifier, &blk)
|
422
420
|
end
|
423
421
|
|
@@ -56,7 +56,8 @@ module GRPC
|
|
56
56
|
# the call
|
57
57
|
# @param marshal [Function] f(obj)->string that marshal requests
|
58
58
|
# @param unmarshal [Function] f(string)->obj that unmarshals responses
|
59
|
-
|
59
|
+
# @param metadata_tag [Object] tag object used to collect metadata
|
60
|
+
def initialize(call, q, marshal, unmarshal, metadata_tag: nil)
|
60
61
|
fail(ArgumentError, 'not a call') unless call.is_a? Core::Call
|
61
62
|
unless q.is_a? Core::CompletionQueue
|
62
63
|
fail(ArgumentError, 'not a CompletionQueue')
|
@@ -67,6 +68,7 @@ module GRPC
|
|
67
68
|
@op_notifier = nil # signals completion on clients
|
68
69
|
@readq = Queue.new
|
69
70
|
@unmarshal = unmarshal
|
71
|
+
@metadata_tag = metadata_tag
|
70
72
|
end
|
71
73
|
|
72
74
|
# Begins orchestration of the Bidi stream for a client sending requests.
|
@@ -113,6 +115,18 @@ module GRPC
|
|
113
115
|
@op_notifier.notify(self)
|
114
116
|
end
|
115
117
|
|
118
|
+
# performs a read using @call.run_batch, ensures metadata is set up
|
119
|
+
def read_using_run_batch
|
120
|
+
ops = { RECV_MESSAGE => nil }
|
121
|
+
ops[RECV_INITIAL_METADATA] = nil unless @metadata_tag.nil?
|
122
|
+
batch_result = @call.run_batch(@cq, self, INFINITE_FUTURE, ops)
|
123
|
+
unless @metadata_tag.nil?
|
124
|
+
@call.metadata = batch_result.metadata
|
125
|
+
@metadata_tag = nil
|
126
|
+
end
|
127
|
+
batch_result
|
128
|
+
end
|
129
|
+
|
116
130
|
# each_queued_msg yields each message on this instances readq
|
117
131
|
#
|
118
132
|
# - messages are added to the readq by #read_loop
|
@@ -169,9 +183,7 @@ module GRPC
|
|
169
183
|
loop do
|
170
184
|
GRPC.logger.debug("bidi-read-loop: #{count}")
|
171
185
|
count += 1
|
172
|
-
|
173
|
-
batch_result = @call.run_batch(@cq, read_tag, INFINITE_FUTURE,
|
174
|
-
RECV_MESSAGE => nil)
|
186
|
+
batch_result = read_using_run_batch
|
175
187
|
|
176
188
|
# handle the next message
|
177
189
|
if batch_result.message.nil?
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright 2015, Google Inc.
|
1
|
+
# Copyright 2015-2016, Google Inc.
|
2
2
|
# All rights reserved.
|
3
3
|
#
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
@@ -50,26 +50,12 @@ module GRPC
|
|
50
50
|
return alt_chan
|
51
51
|
end
|
52
52
|
kw['grpc.primary_user_agent'] = "grpc-ruby/#{VERSION}"
|
53
|
-
|
54
|
-
|
53
|
+
unless creds.is_a?(Core::ChannelCredentials) || creds.is_a?(Symbol)
|
54
|
+
fail(TypeError, '!ChannelCredentials or Symbol')
|
55
|
+
end
|
55
56
|
Core::Channel.new(host, kw, creds)
|
56
57
|
end
|
57
58
|
|
58
|
-
def self.update_with_jwt_aud_uri(a_hash, host, method)
|
59
|
-
last_slash_idx, res = method.rindex('/'), a_hash.clone
|
60
|
-
return res if last_slash_idx.nil?
|
61
|
-
service_name = method[0..(last_slash_idx - 1)]
|
62
|
-
res[:jwt_aud_uri] = "https://#{host}#{service_name}"
|
63
|
-
res
|
64
|
-
end
|
65
|
-
|
66
|
-
# check_update_metadata is used by #initialize verify that it's a Proc.
|
67
|
-
def self.check_update_metadata(update_metadata)
|
68
|
-
return update_metadata if update_metadata.nil?
|
69
|
-
fail(TypeError, '!is_a?Proc') unless update_metadata.is_a?(Proc)
|
70
|
-
update_metadata
|
71
|
-
end
|
72
|
-
|
73
59
|
# Allows users of the stub to modify the propagate mask.
|
74
60
|
#
|
75
61
|
# This is an advanced feature for use when making calls to another gRPC
|
@@ -81,7 +67,8 @@ module GRPC
|
|
81
67
|
# Minimally, a stub is created with the just the host of the gRPC service
|
82
68
|
# it wishes to access, e.g.,
|
83
69
|
#
|
84
|
-
# my_stub = ClientStub.new(example.host.com:50505
|
70
|
+
# my_stub = ClientStub.new(example.host.com:50505,
|
71
|
+
# :this_channel_is_insecure)
|
85
72
|
#
|
86
73
|
# Any arbitrary keyword arguments are treated as channel arguments used to
|
87
74
|
# configure the RPC connection to the host.
|
@@ -97,29 +84,21 @@ module GRPC
|
|
97
84
|
# - :timeout
|
98
85
|
# when present, this is the default timeout used for calls
|
99
86
|
#
|
100
|
-
# - :update_metadata
|
101
|
-
# when present, this a func that takes a hash and returns a hash
|
102
|
-
# it can be used to update metadata, i.e, remove, or amend
|
103
|
-
# metadata values.
|
104
|
-
#
|
105
87
|
# @param host [String] the host the stub connects to
|
106
88
|
# @param q [Core::CompletionQueue] used to wait for events
|
89
|
+
# @param creds [Core::ChannelCredentials|Symbol] the channel credentials, or
|
90
|
+
# :this_channel_is_insecure
|
107
91
|
# @param channel_override [Core::Channel] a pre-created channel
|
108
92
|
# @param timeout [Number] the default timeout to use in requests
|
109
|
-
# @param creds [Core::Credentials] the channel
|
110
|
-
# @param update_metadata a func that updates metadata as described above
|
111
93
|
# @param kw [KeywordArgs]the channel arguments
|
112
|
-
def initialize(host, q,
|
94
|
+
def initialize(host, q, creds,
|
113
95
|
channel_override: nil,
|
114
96
|
timeout: nil,
|
115
|
-
creds: nil,
|
116
97
|
propagate_mask: nil,
|
117
|
-
update_metadata: nil,
|
118
98
|
**kw)
|
119
99
|
fail(TypeError, '!CompletionQueue') unless q.is_a?(Core::CompletionQueue)
|
120
100
|
@queue = q
|
121
101
|
@ch = ClientStub.setup_channel(channel_override, host, creds, **kw)
|
122
|
-
@update_metadata = ClientStub.check_update_metadata(update_metadata)
|
123
102
|
alt_host = kw[Core::Channel::SSL_TARGET]
|
124
103
|
@host = alt_host.nil? ? host : alt_host
|
125
104
|
@propagate_mask = propagate_mask
|
@@ -164,27 +143,29 @@ module GRPC
|
|
164
143
|
# @param deadline [Time] (optional) the time the request should complete
|
165
144
|
# @param parent [Core::Call] a prior call whose reserved metadata
|
166
145
|
# will be propagated by this one.
|
146
|
+
# @param credentials [Core::CallCredentials] credentials to use when making
|
147
|
+
# the call
|
167
148
|
# @param return_op [true|false] return an Operation if true
|
168
149
|
# @return [Object] the response received from the server
|
169
150
|
def request_response(method, req, marshal, unmarshal,
|
170
151
|
deadline: nil,
|
171
152
|
timeout: nil,
|
172
153
|
return_op: false,
|
173
|
-
parent:
|
154
|
+
parent: nil,
|
155
|
+
credentials: nil,
|
174
156
|
**kw)
|
175
157
|
c = new_active_call(method, marshal, unmarshal,
|
176
158
|
deadline: deadline,
|
177
159
|
timeout: timeout,
|
178
|
-
parent: parent
|
179
|
-
|
180
|
-
|
181
|
-
return c.request_response(req, **md) unless return_op
|
160
|
+
parent: parent,
|
161
|
+
credentials: credentials)
|
162
|
+
return c.request_response(req, **kw) unless return_op
|
182
163
|
|
183
164
|
# return the operation view of the active_call; define #execute as a
|
184
165
|
# new method for this instance that invokes #request_response.
|
185
166
|
op = c.operation
|
186
167
|
op.define_singleton_method(:execute) do
|
187
|
-
c.request_response(req, **
|
168
|
+
c.request_response(req, **kw)
|
188
169
|
end
|
189
170
|
op
|
190
171
|
end
|
@@ -233,26 +214,28 @@ module GRPC
|
|
233
214
|
# @param return_op [true|false] return an Operation if true
|
234
215
|
# @param parent [Core::Call] a prior call whose reserved metadata
|
235
216
|
# will be propagated by this one.
|
217
|
+
# @param credentials [Core::CallCredentials] credentials to use when making
|
218
|
+
# the call
|
236
219
|
# @return [Object|Operation] the response received from the server
|
237
220
|
def client_streamer(method, requests, marshal, unmarshal,
|
238
221
|
deadline: nil,
|
239
222
|
timeout: nil,
|
240
223
|
return_op: false,
|
241
224
|
parent: nil,
|
225
|
+
credentials: nil,
|
242
226
|
**kw)
|
243
227
|
c = new_active_call(method, marshal, unmarshal,
|
244
228
|
deadline: deadline,
|
245
229
|
timeout: timeout,
|
246
|
-
parent: parent
|
247
|
-
|
248
|
-
|
249
|
-
return c.client_streamer(requests, **md) unless return_op
|
230
|
+
parent: parent,
|
231
|
+
credentials: credentials)
|
232
|
+
return c.client_streamer(requests, **kw) unless return_op
|
250
233
|
|
251
234
|
# return the operation view of the active_call; define #execute as a
|
252
235
|
# new method for this instance that invokes #client_streamer.
|
253
236
|
op = c.operation
|
254
237
|
op.define_singleton_method(:execute) do
|
255
|
-
c.client_streamer(requests, **
|
238
|
+
c.client_streamer(requests, **kw)
|
256
239
|
end
|
257
240
|
op
|
258
241
|
end
|
@@ -309,6 +292,8 @@ module GRPC
|
|
309
292
|
# @param return_op [true|false]return an Operation if true
|
310
293
|
# @param parent [Core::Call] a prior call whose reserved metadata
|
311
294
|
# will be propagated by this one.
|
295
|
+
# @param credentials [Core::CallCredentials] credentials to use when making
|
296
|
+
# the call
|
312
297
|
# @param blk [Block] when provided, is executed for each response
|
313
298
|
# @return [Enumerator|Operation|nil] as discussed above
|
314
299
|
def server_streamer(method, req, marshal, unmarshal,
|
@@ -316,21 +301,21 @@ module GRPC
|
|
316
301
|
timeout: nil,
|
317
302
|
return_op: false,
|
318
303
|
parent: nil,
|
304
|
+
credentials: nil,
|
319
305
|
**kw,
|
320
306
|
&blk)
|
321
307
|
c = new_active_call(method, marshal, unmarshal,
|
322
308
|
deadline: deadline,
|
323
309
|
timeout: timeout,
|
324
|
-
parent: parent
|
325
|
-
|
326
|
-
|
327
|
-
return c.server_streamer(req, **md, &blk) unless return_op
|
310
|
+
parent: parent,
|
311
|
+
credentials: credentials)
|
312
|
+
return c.server_streamer(req, **kw, &blk) unless return_op
|
328
313
|
|
329
314
|
# return the operation view of the active_call; define #execute
|
330
315
|
# as a new method for this instance that invokes #server_streamer
|
331
316
|
op = c.operation
|
332
317
|
op.define_singleton_method(:execute) do
|
333
|
-
c.server_streamer(req, **
|
318
|
+
c.server_streamer(req, **kw, &blk)
|
334
319
|
end
|
335
320
|
op
|
336
321
|
end
|
@@ -425,6 +410,8 @@ module GRPC
|
|
425
410
|
# @param deadline [Time] (optional) the time the request should complete
|
426
411
|
# @param parent [Core::Call] a prior call whose reserved metadata
|
427
412
|
# will be propagated by this one.
|
413
|
+
# @param credentials [Core::CallCredentials] credentials to use when making
|
414
|
+
# the call
|
428
415
|
# @param return_op [true|false] return an Operation if true
|
429
416
|
# @param blk [Block] when provided, is executed for each response
|
430
417
|
# @return [Enumerator|nil|Operation] as discussed above
|
@@ -433,21 +420,22 @@ module GRPC
|
|
433
420
|
timeout: nil,
|
434
421
|
return_op: false,
|
435
422
|
parent: nil,
|
423
|
+
credentials: nil,
|
436
424
|
**kw,
|
437
425
|
&blk)
|
438
426
|
c = new_active_call(method, marshal, unmarshal,
|
439
427
|
deadline: deadline,
|
440
428
|
timeout: timeout,
|
441
|
-
parent: parent
|
442
|
-
|
443
|
-
|
444
|
-
return c.bidi_streamer(requests, **
|
429
|
+
parent: parent,
|
430
|
+
credentials: credentials)
|
431
|
+
|
432
|
+
return c.bidi_streamer(requests, **kw, &blk) unless return_op
|
445
433
|
|
446
434
|
# return the operation view of the active_call; define #execute
|
447
435
|
# as a new method for this instance that invokes #bidi_streamer
|
448
436
|
op = c.operation
|
449
437
|
op.define_singleton_method(:execute) do
|
450
|
-
c.bidi_streamer(requests, **
|
438
|
+
c.bidi_streamer(requests, **kw, &blk)
|
451
439
|
end
|
452
440
|
op
|
453
441
|
end
|
@@ -465,7 +453,8 @@ module GRPC
|
|
465
453
|
def new_active_call(method, marshal, unmarshal,
|
466
454
|
deadline: nil,
|
467
455
|
timeout: nil,
|
468
|
-
parent: nil
|
456
|
+
parent: nil,
|
457
|
+
credentials: nil)
|
469
458
|
if deadline.nil?
|
470
459
|
deadline = from_relative_time(timeout.nil? ? @timeout : timeout)
|
471
460
|
end
|
@@ -475,6 +464,7 @@ module GRPC
|
|
475
464
|
method,
|
476
465
|
nil, # host use nil,
|
477
466
|
deadline)
|
467
|
+
call.set_credentials! credentials unless credentials.nil?
|
478
468
|
ActiveCall.new(call, @queue, marshal, unmarshal, deadline, started: false)
|
479
469
|
end
|
480
470
|
end
|