Merge branch 'master' into uv_core_transport
This commit is contained in:
commit
bcc60f75d4
407
CMakeLists.txt
407
CMakeLists.txt
|
|
@ -191,7 +191,9 @@ add_library(gpr
|
|||
src/core/lib/support/log_linux.c
|
||||
src/core/lib/support/log_posix.c
|
||||
src/core/lib/support/log_windows.c
|
||||
src/core/lib/support/mpscq.c
|
||||
src/core/lib/support/murmur_hash.c
|
||||
src/core/lib/support/percent_encoding.c
|
||||
src/core/lib/support/slice.c
|
||||
src/core/lib/support/slice_buffer.c
|
||||
src/core/lib/support/stack_lockfree.c
|
||||
|
|
@ -257,20 +259,17 @@ foreach(_hdr
|
|||
include/grpc/support/tls_msvc.h
|
||||
include/grpc/support/tls_pthread.h
|
||||
include/grpc/support/useful.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/gpr_types.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
|
||||
)
|
||||
string(REPLACE "include/" "" _path ${_hdr})
|
||||
get_filename_component(_path ${_path} PATH)
|
||||
|
|
@ -306,6 +305,7 @@ add_library(grpc
|
|||
src/core/lib/http/httpcli.c
|
||||
src/core/lib/http/parser.c
|
||||
src/core/lib/iomgr/closure.c
|
||||
src/core/lib/iomgr/combiner.c
|
||||
src/core/lib/iomgr/endpoint.c
|
||||
src/core/lib/iomgr/endpoint_pair_posix.c
|
||||
src/core/lib/iomgr/endpoint_pair_windows.c
|
||||
|
|
@ -445,7 +445,6 @@ add_library(grpc
|
|||
src/core/ext/client_config/channel_connectivity.c
|
||||
src/core/ext/client_config/client_channel.c
|
||||
src/core/ext/client_config/client_channel_factory.c
|
||||
src/core/ext/client_config/client_config.c
|
||||
src/core/ext/client_config/client_config_plugin.c
|
||||
src/core/ext/client_config/connector.c
|
||||
src/core/ext/client_config/default_initial_connect_string.c
|
||||
|
|
@ -457,8 +456,8 @@ add_library(grpc
|
|||
src/core/ext/client_config/resolver.c
|
||||
src/core/ext/client_config/resolver_factory.c
|
||||
src/core/ext/client_config/resolver_registry.c
|
||||
src/core/ext/client_config/resolver_result.c
|
||||
src/core/ext/client_config/subchannel.c
|
||||
src/core/ext/client_config/subchannel_call_holder.c
|
||||
src/core/ext/client_config/subchannel_index.c
|
||||
src/core/ext/client_config/uri_parser.c
|
||||
src/core/ext/transport/chttp2/server/insecure/server_chttp2.c
|
||||
|
|
@ -480,6 +479,7 @@ add_library(grpc
|
|||
src/core/ext/census/base_resources.c
|
||||
src/core/ext/census/context.c
|
||||
src/core/ext/census/gen/census.pb.c
|
||||
src/core/ext/census/gen/trace_context.pb.c
|
||||
src/core/ext/census/grpc_context.c
|
||||
src/core/ext/census/grpc_filter.c
|
||||
src/core/ext/census/grpc_plugin.c
|
||||
|
|
@ -514,30 +514,26 @@ foreach(_hdr
|
|||
include/grpc/compression.h
|
||||
include/grpc/grpc.h
|
||||
include/grpc/grpc_posix.h
|
||||
include/grpc/grpc_security_constants.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/gpr_types.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
|
||||
include/grpc/grpc_security.h
|
||||
include/grpc/grpc_security_constants.h
|
||||
include/grpc/census.h
|
||||
)
|
||||
string(REPLACE "include/" "" _path ${_hdr})
|
||||
|
|
@ -574,6 +570,7 @@ add_library(grpc_cronet
|
|||
src/core/lib/http/httpcli.c
|
||||
src/core/lib/http/parser.c
|
||||
src/core/lib/iomgr/closure.c
|
||||
src/core/lib/iomgr/combiner.c
|
||||
src/core/lib/iomgr/endpoint.c
|
||||
src/core/lib/iomgr/endpoint_pair_posix.c
|
||||
src/core/lib/iomgr/endpoint_pair_windows.c
|
||||
|
|
@ -688,7 +685,6 @@ add_library(grpc_cronet
|
|||
src/core/ext/client_config/channel_connectivity.c
|
||||
src/core/ext/client_config/client_channel.c
|
||||
src/core/ext/client_config/client_channel_factory.c
|
||||
src/core/ext/client_config/client_config.c
|
||||
src/core/ext/client_config/client_config_plugin.c
|
||||
src/core/ext/client_config/connector.c
|
||||
src/core/ext/client_config/default_initial_connect_string.c
|
||||
|
|
@ -700,8 +696,8 @@ add_library(grpc_cronet
|
|||
src/core/ext/client_config/resolver.c
|
||||
src/core/ext/client_config/resolver_factory.c
|
||||
src/core/ext/client_config/resolver_registry.c
|
||||
src/core/ext/client_config/resolver_result.c
|
||||
src/core/ext/client_config/subchannel.c
|
||||
src/core/ext/client_config/subchannel_call_holder.c
|
||||
src/core/ext/client_config/subchannel_index.c
|
||||
src/core/ext/client_config/uri_parser.c
|
||||
src/core/lib/http/httpcli_security_connector.c
|
||||
|
|
@ -755,31 +751,27 @@ foreach(_hdr
|
|||
include/grpc/compression.h
|
||||
include/grpc/grpc.h
|
||||
include/grpc/grpc_posix.h
|
||||
include/grpc/grpc_security_constants.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/gpr_types.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
|
||||
include/grpc/grpc_cronet.h
|
||||
include/grpc/grpc_security.h
|
||||
include/grpc/grpc_security_constants.h
|
||||
)
|
||||
string(REPLACE "include/" "" _path ${_hdr})
|
||||
get_filename_component(_path ${_path} PATH)
|
||||
|
|
@ -816,6 +808,7 @@ add_library(grpc_unsecure
|
|||
src/core/lib/http/httpcli.c
|
||||
src/core/lib/http/parser.c
|
||||
src/core/lib/iomgr/closure.c
|
||||
src/core/lib/iomgr/combiner.c
|
||||
src/core/lib/iomgr/endpoint.c
|
||||
src/core/lib/iomgr/endpoint_pair_posix.c
|
||||
src/core/lib/iomgr/endpoint_pair_windows.c
|
||||
|
|
@ -930,7 +923,6 @@ add_library(grpc_unsecure
|
|||
src/core/ext/client_config/channel_connectivity.c
|
||||
src/core/ext/client_config/client_channel.c
|
||||
src/core/ext/client_config/client_channel_factory.c
|
||||
src/core/ext/client_config/client_config.c
|
||||
src/core/ext/client_config/client_config_plugin.c
|
||||
src/core/ext/client_config/connector.c
|
||||
src/core/ext/client_config/default_initial_connect_string.c
|
||||
|
|
@ -942,8 +934,8 @@ add_library(grpc_unsecure
|
|||
src/core/ext/client_config/resolver.c
|
||||
src/core/ext/client_config/resolver_factory.c
|
||||
src/core/ext/client_config/resolver_registry.c
|
||||
src/core/ext/client_config/resolver_result.c
|
||||
src/core/ext/client_config/subchannel.c
|
||||
src/core/ext/client_config/subchannel_call_holder.c
|
||||
src/core/ext/client_config/subchannel_index.c
|
||||
src/core/ext/client_config/uri_parser.c
|
||||
src/core/ext/resolver/dns/native/dns_resolver.c
|
||||
|
|
@ -961,6 +953,7 @@ add_library(grpc_unsecure
|
|||
src/core/ext/census/base_resources.c
|
||||
src/core/ext/census/context.c
|
||||
src/core/ext/census/gen/census.pb.c
|
||||
src/core/ext/census/gen/trace_context.pb.c
|
||||
src/core/ext/census/grpc_context.c
|
||||
src/core/ext/census/grpc_filter.c
|
||||
src/core/ext/census/grpc_plugin.c
|
||||
|
|
@ -993,28 +986,25 @@ foreach(_hdr
|
|||
include/grpc/compression.h
|
||||
include/grpc/grpc.h
|
||||
include/grpc/grpc_posix.h
|
||||
include/grpc/grpc_security_constants.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/gpr_types.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
|
||||
include/grpc/census.h
|
||||
)
|
||||
string(REPLACE "include/" "" _path ${_hdr})
|
||||
|
|
@ -1035,39 +1025,140 @@ endif()
|
|||
|
||||
|
||||
add_library(grpc++
|
||||
src/cpp/client/insecure_credentials.cc
|
||||
src/cpp/client/secure_credentials.cc
|
||||
src/cpp/common/auth_property_iterator.cc
|
||||
src/cpp/common/secure_auth_context.cc
|
||||
src/cpp/common/secure_channel_arguments.cc
|
||||
src/cpp/common/secure_create_auth_context.cc
|
||||
src/cpp/server/insecure_server_credentials.cc
|
||||
src/cpp/server/secure_server_credentials.cc
|
||||
src/cpp/client/channel.cc
|
||||
src/cpp/client/channel_cc.cc
|
||||
src/cpp/client/client_context.cc
|
||||
src/cpp/client/create_channel.cc
|
||||
src/cpp/client/create_channel_internal.cc
|
||||
src/cpp/client/create_channel_posix.cc
|
||||
src/cpp/client/credentials.cc
|
||||
src/cpp/client/credentials_cc.cc
|
||||
src/cpp/client/generic_stub.cc
|
||||
src/cpp/client/insecure_credentials.cc
|
||||
src/cpp/common/channel_arguments.cc
|
||||
src/cpp/common/channel_filter.cc
|
||||
src/cpp/common/completion_queue.cc
|
||||
src/cpp/common/completion_queue_cc.cc
|
||||
src/cpp/common/core_codegen.cc
|
||||
src/cpp/common/rpc_method.cc
|
||||
src/cpp/server/async_generic_service.cc
|
||||
src/cpp/server/create_default_thread_pool.cc
|
||||
src/cpp/server/dynamic_thread_pool.cc
|
||||
src/cpp/server/insecure_server_credentials.cc
|
||||
src/cpp/server/server.cc
|
||||
src/cpp/server/server_builder.cc
|
||||
src/cpp/server/server_cc.cc
|
||||
src/cpp/server/server_context.cc
|
||||
src/cpp/server/server_credentials.cc
|
||||
src/cpp/server/server_posix.cc
|
||||
src/cpp/util/byte_buffer.cc
|
||||
src/cpp/util/slice.cc
|
||||
src/cpp/util/byte_buffer_cc.cc
|
||||
src/cpp/util/slice_cc.cc
|
||||
src/cpp/util/status.cc
|
||||
src/cpp/util/string_ref.cc
|
||||
src/cpp/util/time.cc
|
||||
src/cpp/util/time_cc.cc
|
||||
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/combiner.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_uv.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_uv.c
|
||||
src/core/lib/iomgr/pollset_set_windows.c
|
||||
src/core/lib/iomgr/pollset_uv.c
|
||||
src/core/lib/iomgr/pollset_windows.c
|
||||
src/core/lib/iomgr/resolve_address_posix.c
|
||||
src/core/lib/iomgr/resolve_address_uv.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_utils_uv.c
|
||||
src/core/lib/iomgr/socket_utils_windows.c
|
||||
src/core/lib/iomgr/socket_windows.c
|
||||
src/core/lib/iomgr/tcp_client_posix.c
|
||||
src/core/lib/iomgr/tcp_client_uv.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_uv.c
|
||||
src/core/lib/iomgr/tcp_server_windows.c
|
||||
src/core/lib/iomgr/tcp_uv.c
|
||||
src/core/lib/iomgr/tcp_windows.c
|
||||
src/core/lib/iomgr/time_averaged_stats.c
|
||||
src/core/lib/iomgr/timer_generic.c
|
||||
src/core/lib/iomgr/timer_heap.c
|
||||
src/core/lib/iomgr/timer_uv.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_uv.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/timeout_encoding.c
|
||||
src/core/lib/transport/transport.c
|
||||
src/core/lib/transport/transport_op_string.c
|
||||
src/cpp/codegen/codegen_init.cc
|
||||
)
|
||||
|
||||
|
|
@ -1085,6 +1176,7 @@ target_link_libraries(grpc++
|
|||
${_gRPC_SSL_LIBRARIES}
|
||||
${_gRPC_PROTOBUF_LIBRARIES}
|
||||
grpc
|
||||
gpr
|
||||
)
|
||||
|
||||
foreach(_hdr
|
||||
|
|
@ -1135,6 +1227,30 @@ foreach(_hdr
|
|||
include/grpc++/support/stub_options.h
|
||||
include/grpc++/support/sync_stream.h
|
||||
include/grpc++/support/time.h
|
||||
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/grpc_security_constants.h
|
||||
include/grpc/status.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/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/gpr_types.h
|
||||
include/grpc/impl/codegen/port_platform.h
|
||||
include/grpc/impl/codegen/slice.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/async_stream.h
|
||||
include/grpc++/impl/codegen/async_unary_call.h
|
||||
include/grpc++/impl/codegen/call.h
|
||||
|
|
@ -1158,6 +1274,7 @@ foreach(_hdr
|
|||
include/grpc++/impl/codegen/service_type.h
|
||||
include/grpc++/impl/codegen/status.h
|
||||
include/grpc++/impl/codegen/status_code_enum.h
|
||||
include/grpc++/impl/codegen/status_helper.h
|
||||
include/grpc++/impl/codegen/string_ref.h
|
||||
include/grpc++/impl/codegen/stub_options.h
|
||||
include/grpc++/impl/codegen/sync.h
|
||||
|
|
@ -1165,27 +1282,6 @@ foreach(_hdr
|
|||
include/grpc++/impl/codegen/sync_no_cxx11.h
|
||||
include/grpc++/impl/codegen/sync_stream.h
|
||||
include/grpc++/impl/codegen/time.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
|
||||
)
|
||||
string(REPLACE "include/" "" _path ${_hdr})
|
||||
get_filename_component(_path ${_path} PATH)
|
||||
|
|
@ -1252,6 +1348,7 @@ foreach(_hdr
|
|||
include/grpc++/impl/codegen/service_type.h
|
||||
include/grpc++/impl/codegen/status.h
|
||||
include/grpc++/impl/codegen/status_code_enum.h
|
||||
include/grpc++/impl/codegen/status_helper.h
|
||||
include/grpc++/impl/codegen/string_ref.h
|
||||
include/grpc++/impl/codegen/stub_options.h
|
||||
include/grpc++/impl/codegen/sync.h
|
||||
|
|
@ -1259,27 +1356,23 @@ foreach(_hdr
|
|||
include/grpc++/impl/codegen/sync_no_cxx11.h
|
||||
include/grpc++/impl/codegen/sync_stream.h
|
||||
include/grpc++/impl/codegen/time.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/gpr_types.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
|
||||
include/grpc++/impl/codegen/config_protobuf.h
|
||||
)
|
||||
string(REPLACE "include/" "" _path ${_hdr})
|
||||
|
|
@ -1300,34 +1393,135 @@ endif()
|
|||
|
||||
|
||||
add_library(grpc++_unsecure
|
||||
src/cpp/client/insecure_credentials.cc
|
||||
src/cpp/common/insecure_create_auth_context.cc
|
||||
src/cpp/client/channel.cc
|
||||
src/cpp/server/insecure_server_credentials.cc
|
||||
src/cpp/client/channel_cc.cc
|
||||
src/cpp/client/client_context.cc
|
||||
src/cpp/client/create_channel.cc
|
||||
src/cpp/client/create_channel_internal.cc
|
||||
src/cpp/client/create_channel_posix.cc
|
||||
src/cpp/client/credentials.cc
|
||||
src/cpp/client/credentials_cc.cc
|
||||
src/cpp/client/generic_stub.cc
|
||||
src/cpp/client/insecure_credentials.cc
|
||||
src/cpp/common/channel_arguments.cc
|
||||
src/cpp/common/channel_filter.cc
|
||||
src/cpp/common/completion_queue.cc
|
||||
src/cpp/common/completion_queue_cc.cc
|
||||
src/cpp/common/core_codegen.cc
|
||||
src/cpp/common/rpc_method.cc
|
||||
src/cpp/server/async_generic_service.cc
|
||||
src/cpp/server/create_default_thread_pool.cc
|
||||
src/cpp/server/dynamic_thread_pool.cc
|
||||
src/cpp/server/insecure_server_credentials.cc
|
||||
src/cpp/server/server.cc
|
||||
src/cpp/server/server_builder.cc
|
||||
src/cpp/server/server_cc.cc
|
||||
src/cpp/server/server_context.cc
|
||||
src/cpp/server/server_credentials.cc
|
||||
src/cpp/server/server_posix.cc
|
||||
src/cpp/util/byte_buffer.cc
|
||||
src/cpp/util/slice.cc
|
||||
src/cpp/util/byte_buffer_cc.cc
|
||||
src/cpp/util/slice_cc.cc
|
||||
src/cpp/util/status.cc
|
||||
src/cpp/util/string_ref.cc
|
||||
src/cpp/util/time.cc
|
||||
src/cpp/util/time_cc.cc
|
||||
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/combiner.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_uv.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_uv.c
|
||||
src/core/lib/iomgr/pollset_set_windows.c
|
||||
src/core/lib/iomgr/pollset_uv.c
|
||||
src/core/lib/iomgr/pollset_windows.c
|
||||
src/core/lib/iomgr/resolve_address_posix.c
|
||||
src/core/lib/iomgr/resolve_address_uv.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_utils_uv.c
|
||||
src/core/lib/iomgr/socket_utils_windows.c
|
||||
src/core/lib/iomgr/socket_windows.c
|
||||
src/core/lib/iomgr/tcp_client_posix.c
|
||||
src/core/lib/iomgr/tcp_client_uv.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_uv.c
|
||||
src/core/lib/iomgr/tcp_server_windows.c
|
||||
src/core/lib/iomgr/tcp_uv.c
|
||||
src/core/lib/iomgr/tcp_windows.c
|
||||
src/core/lib/iomgr/time_averaged_stats.c
|
||||
src/core/lib/iomgr/timer_generic.c
|
||||
src/core/lib/iomgr/timer_heap.c
|
||||
src/core/lib/iomgr/timer_uv.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_uv.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/timeout_encoding.c
|
||||
src/core/lib/transport/transport.c
|
||||
src/core/lib/transport/transport_op_string.c
|
||||
src/cpp/codegen/codegen_init.cc
|
||||
)
|
||||
|
||||
|
|
@ -1345,7 +1539,6 @@ target_link_libraries(grpc++_unsecure
|
|||
${_gRPC_PROTOBUF_LIBRARIES}
|
||||
gpr
|
||||
grpc_unsecure
|
||||
grpc
|
||||
)
|
||||
|
||||
foreach(_hdr
|
||||
|
|
@ -1396,6 +1589,30 @@ foreach(_hdr
|
|||
include/grpc++/support/stub_options.h
|
||||
include/grpc++/support/sync_stream.h
|
||||
include/grpc++/support/time.h
|
||||
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/grpc_security_constants.h
|
||||
include/grpc/status.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/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/gpr_types.h
|
||||
include/grpc/impl/codegen/port_platform.h
|
||||
include/grpc/impl/codegen/slice.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/async_stream.h
|
||||
include/grpc++/impl/codegen/async_unary_call.h
|
||||
include/grpc++/impl/codegen/call.h
|
||||
|
|
@ -1419,6 +1636,7 @@ foreach(_hdr
|
|||
include/grpc++/impl/codegen/service_type.h
|
||||
include/grpc++/impl/codegen/status.h
|
||||
include/grpc++/impl/codegen/status_code_enum.h
|
||||
include/grpc++/impl/codegen/status_helper.h
|
||||
include/grpc++/impl/codegen/string_ref.h
|
||||
include/grpc++/impl/codegen/stub_options.h
|
||||
include/grpc++/impl/codegen/sync.h
|
||||
|
|
@ -1426,27 +1644,6 @@ foreach(_hdr
|
|||
include/grpc++/impl/codegen/sync_no_cxx11.h
|
||||
include/grpc++/impl/codegen/sync_stream.h
|
||||
include/grpc++/impl/codegen/time.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
|
||||
)
|
||||
string(REPLACE "include/" "" _path ${_hdr})
|
||||
get_filename_component(_path ${_path} PATH)
|
||||
|
|
@ -1589,6 +1786,30 @@ if (gRPC_INSTALL)
|
|||
endif()
|
||||
|
||||
|
||||
add_executable(gen_percent_encoding_tables
|
||||
tools/codegen/core/gen_percent_encoding_tables.c
|
||||
)
|
||||
|
||||
target_include_directories(gen_percent_encoding_tables
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
PRIVATE ${BORINGSSL_ROOT_DIR}/include
|
||||
PRIVATE ${PROTOBUF_ROOT_DIR}/src
|
||||
PRIVATE ${ZLIB_ROOT_DIR}
|
||||
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib
|
||||
)
|
||||
|
||||
|
||||
|
||||
if (gRPC_INSTALL)
|
||||
install(TARGETS gen_percent_encoding_tables EXPORT gRPCTargets
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
add_executable(grpc_create_jwt
|
||||
test/core/security/create_jwt.c
|
||||
)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ refer to these documents
|
|||
* [Java](https://github.com/grpc/grpc-java)
|
||||
* [Node](src/node): `npm install grpc`
|
||||
* [Objective-C](src/objective-c)
|
||||
* [PHP](src/php): `pecl install grpc-beta`
|
||||
* [PHP](src/php): `pecl install grpc`
|
||||
* [Python](src/python/grpcio): `pip install grpcio`
|
||||
* [Ruby](src/ruby): `gem install grpc`
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ graft include/grpc
|
|||
graft third_party/boringssl
|
||||
graft third_party/nanopb
|
||||
graft third_party/zlib
|
||||
include src/python/grpcio/_unixccompiler_patch.py
|
||||
include src/python/grpcio/_spawn_patch.py
|
||||
include src/python/grpcio/commands.py
|
||||
include src/python/grpcio/grpc_version.py
|
||||
include src/python/grpcio/grpc_core_dependencies.py
|
||||
|
|
|
|||
20
README.md
20
README.md
|
|
@ -23,16 +23,16 @@ This repository contains source code for gRPC libraries for multiple languages w
|
|||
|
||||
Libraries in different languages are in different states of development. We are seeking contributions for all of these libraries.
|
||||
|
||||
| Language | Source | Status |
|
||||
|-------------------------|-------------------------------------|----------------------------------|
|
||||
| Shared C [core library] | [src/core] (src/core) | Beta - the surface API is stable |
|
||||
| C++ | [src/cpp] (src/cpp) | Beta - the surface API is stable |
|
||||
| Ruby | [src/ruby] (src/ruby) | Beta - the surface API is stable |
|
||||
| NodeJS | [src/node] (src/node) | Beta - the surface API is stable |
|
||||
| Python | [src/python] (src/python) | Beta - the surface API is stable |
|
||||
| PHP | [src/php] (src/php) | Beta - the surface API is stable |
|
||||
| C# | [src/csharp] (src/csharp) | Beta - the surface API is stable |
|
||||
| Objective-C | [src/objective-c] (src/objective-c) | Beta - the surface API is stable |
|
||||
| Language | Source | Status |
|
||||
|-------------------------|-------------------------------------|---------|
|
||||
| Shared C [core library] | [src/core] (src/core) | 1.0 |
|
||||
| C++ | [src/cpp] (src/cpp) | 1.0 |
|
||||
| Ruby | [src/ruby] (src/ruby) | 1.0 |
|
||||
| NodeJS | [src/node] (src/node) | 1.0 |
|
||||
| Python | [src/python] (src/python) | 1.0 |
|
||||
| PHP | [src/php] (src/php) | 1.0 |
|
||||
| C# | [src/csharp] (src/csharp) | 1.0 |
|
||||
| Objective-C | [src/objective-c] (src/objective-c) | 1.0 |
|
||||
|
||||
<small>
|
||||
Java source code is in the [grpc-java] (http://github.com/grpc/grpc-java) repository.
|
||||
|
|
|
|||
6
Rakefile
6
Rakefile
|
|
@ -100,13 +100,15 @@ desc 'Build the native gem file under rake_compiler_dock'
|
|||
task 'gem:native' do
|
||||
verbose = ENV['V'] || '0'
|
||||
|
||||
grpc_config = ENV['GRPC_CONFIG'] || 'opt'
|
||||
|
||||
if RUBY_PLATFORM =~ /darwin/
|
||||
FileUtils.touch 'grpc_c.32.ruby'
|
||||
FileUtils.touch 'grpc_c.64.ruby'
|
||||
system "rake cross native gem RUBY_CC_VERSION=2.3.0:2.2.2:2.1.5:2.0.0 V=#{verbose}"
|
||||
system "rake cross native gem RUBY_CC_VERSION=2.3.0:2.2.2:2.1.5:2.0.0 V=#{verbose} GRPC_CONFIG=#{grpc_config}"
|
||||
else
|
||||
Rake::Task['dlls'].execute
|
||||
docker_for_windows "bundle && rake cross native gem RUBY_CC_VERSION=2.3.0:2.2.2:2.1.5:2.0.0 V=#{verbose}"
|
||||
docker_for_windows "bundle && rake cross native gem RUBY_CC_VERSION=2.3.0:2.2.2:2.1.5:2.0.0 V=#{verbose} GRPC_CONFIG=#{grpc_config}"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -518,7 +518,9 @@
|
|||
'src/core/lib/support/log_linux.c',
|
||||
'src/core/lib/support/log_posix.c',
|
||||
'src/core/lib/support/log_windows.c',
|
||||
'src/core/lib/support/mpscq.c',
|
||||
'src/core/lib/support/murmur_hash.c',
|
||||
'src/core/lib/support/percent_encoding.c',
|
||||
'src/core/lib/support/slice.c',
|
||||
'src/core/lib/support/slice_buffer.c',
|
||||
'src/core/lib/support/stack_lockfree.c',
|
||||
|
|
@ -581,6 +583,7 @@
|
|||
'src/core/lib/http/httpcli.c',
|
||||
'src/core/lib/http/parser.c',
|
||||
'src/core/lib/iomgr/closure.c',
|
||||
'src/core/lib/iomgr/combiner.c',
|
||||
'src/core/lib/iomgr/endpoint.c',
|
||||
'src/core/lib/iomgr/endpoint_pair_posix.c',
|
||||
'src/core/lib/iomgr/endpoint_pair_windows.c',
|
||||
|
|
@ -720,7 +723,6 @@
|
|||
'src/core/ext/client_config/channel_connectivity.c',
|
||||
'src/core/ext/client_config/client_channel.c',
|
||||
'src/core/ext/client_config/client_channel_factory.c',
|
||||
'src/core/ext/client_config/client_config.c',
|
||||
'src/core/ext/client_config/client_config_plugin.c',
|
||||
'src/core/ext/client_config/connector.c',
|
||||
'src/core/ext/client_config/default_initial_connect_string.c',
|
||||
|
|
@ -732,8 +734,8 @@
|
|||
'src/core/ext/client_config/resolver.c',
|
||||
'src/core/ext/client_config/resolver_factory.c',
|
||||
'src/core/ext/client_config/resolver_registry.c',
|
||||
'src/core/ext/client_config/resolver_result.c',
|
||||
'src/core/ext/client_config/subchannel.c',
|
||||
'src/core/ext/client_config/subchannel_call_holder.c',
|
||||
'src/core/ext/client_config/subchannel_index.c',
|
||||
'src/core/ext/client_config/uri_parser.c',
|
||||
'src/core/ext/transport/chttp2/server/insecure/server_chttp2.c',
|
||||
|
|
@ -755,6 +757,7 @@
|
|||
'src/core/ext/census/base_resources.c',
|
||||
'src/core/ext/census/context.c',
|
||||
'src/core/ext/census/gen/census.pb.c',
|
||||
'src/core/ext/census/gen/trace_context.pb.c',
|
||||
'src/core/ext/census/grpc_context.c',
|
||||
'src/core/ext/census/grpc_filter.c',
|
||||
'src/core/ext/census/grpc_plugin.c',
|
||||
|
|
|
|||
124
build.yaml
124
build.yaml
|
|
@ -2,11 +2,17 @@
|
|||
'#2': It is used among other things to generate all of our project files.
|
||||
'#3': Please refer to the templates directory for more information.
|
||||
settings:
|
||||
'#1': The public version number of the library.
|
||||
'#2': Master always has a "-dev" suffix
|
||||
'#3': Use "-preN" suffixes to identify pre-release versions
|
||||
'#4': Per-language overrides are possible with (eg) ruby_version tag here
|
||||
'#5': See the expand_version.py for all the quirks here
|
||||
'#01': The public version number of the library.
|
||||
'#02': ===
|
||||
'#03': Please update the 'g_stands_for' field periodically with a new g word
|
||||
'#04': not listed in doc/g_stands_for.md - and update that document to list the
|
||||
'#05': new word.
|
||||
'#06': ===
|
||||
'#07': Master always has a "-dev" suffix
|
||||
'#08': Use "-preN" suffixes to identify pre-release versions
|
||||
'#09': Per-language overrides are possible with (eg) ruby_version tag here
|
||||
'#10': See the expand_version.py for all the quirks here
|
||||
g_stands_for: good
|
||||
version: 1.1.0-dev
|
||||
filegroups:
|
||||
- name: census
|
||||
|
|
@ -18,6 +24,7 @@ filegroups:
|
|||
- src/core/ext/census/census_interface.h
|
||||
- src/core/ext/census/census_rpc_stats.h
|
||||
- src/core/ext/census/gen/census.pb.h
|
||||
- src/core/ext/census/gen/trace_context.pb.h
|
||||
- src/core/ext/census/grpc_filter.h
|
||||
- src/core/ext/census/mlog.h
|
||||
- src/core/ext/census/resource.h
|
||||
|
|
@ -26,6 +33,7 @@ filegroups:
|
|||
- src/core/ext/census/base_resources.c
|
||||
- src/core/ext/census/context.c
|
||||
- src/core/ext/census/gen/census.pb.c
|
||||
- src/core/ext/census/gen/trace_context.pb.c
|
||||
- src/core/ext/census/grpc_context.c
|
||||
- src/core/ext/census/grpc_filter.c
|
||||
- src/core/ext/census/grpc_plugin.c
|
||||
|
|
@ -74,7 +82,9 @@ filegroups:
|
|||
- src/core/lib/support/backoff.h
|
||||
- src/core/lib/support/block_annotate.h
|
||||
- src/core/lib/support/env.h
|
||||
- src/core/lib/support/mpscq.h
|
||||
- src/core/lib/support/murmur_hash.h
|
||||
- src/core/lib/support/percent_encoding.h
|
||||
- src/core/lib/support/stack_lockfree.h
|
||||
- src/core/lib/support/string.h
|
||||
- src/core/lib/support/string_windows.h
|
||||
|
|
@ -102,7 +112,9 @@ filegroups:
|
|||
- src/core/lib/support/log_linux.c
|
||||
- src/core/lib/support/log_posix.c
|
||||
- src/core/lib/support/log_windows.c
|
||||
- src/core/lib/support/mpscq.c
|
||||
- src/core/lib/support/murmur_hash.c
|
||||
- src/core/lib/support/percent_encoding.c
|
||||
- src/core/lib/support/slice.c
|
||||
- src/core/lib/support/slice_buffer.c
|
||||
- src/core/lib/support/stack_lockfree.c
|
||||
|
|
@ -131,20 +143,17 @@ filegroups:
|
|||
- gpr_codegen
|
||||
- name: gpr_codegen
|
||||
public_headers:
|
||||
- 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/gpr_types.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
|
||||
- name: grpc_base
|
||||
public_headers:
|
||||
- include/grpc/byte_buffer.h
|
||||
|
|
@ -152,6 +161,7 @@ filegroups:
|
|||
- include/grpc/compression.h
|
||||
- include/grpc/grpc.h
|
||||
- include/grpc/grpc_posix.h
|
||||
- include/grpc/grpc_security_constants.h
|
||||
- include/grpc/status.h
|
||||
headers:
|
||||
- src/core/lib/channel/channel_args.h
|
||||
|
|
@ -170,6 +180,7 @@ filegroups:
|
|||
- src/core/lib/http/httpcli.h
|
||||
- src/core/lib/http/parser.h
|
||||
- src/core/lib/iomgr/closure.h
|
||||
- src/core/lib/iomgr/combiner.h
|
||||
- src/core/lib/iomgr/endpoint.h
|
||||
- src/core/lib/iomgr/endpoint_pair.h
|
||||
- src/core/lib/iomgr/error.h
|
||||
|
|
@ -257,6 +268,7 @@ filegroups:
|
|||
- src/core/lib/http/httpcli.c
|
||||
- src/core/lib/http/parser.c
|
||||
- src/core/lib/iomgr/closure.c
|
||||
- src/core/lib/iomgr/combiner.c
|
||||
- src/core/lib/iomgr/endpoint.c
|
||||
- src/core/lib/iomgr/endpoint_pair_posix.c
|
||||
- src/core/lib/iomgr/endpoint_pair_windows.c
|
||||
|
|
@ -350,7 +362,6 @@ filegroups:
|
|||
headers:
|
||||
- src/core/ext/client_config/client_channel.h
|
||||
- src/core/ext/client_config/client_channel_factory.h
|
||||
- src/core/ext/client_config/client_config.h
|
||||
- src/core/ext/client_config/connector.h
|
||||
- src/core/ext/client_config/initial_connect_string.h
|
||||
- src/core/ext/client_config/lb_policy.h
|
||||
|
|
@ -360,15 +371,14 @@ filegroups:
|
|||
- src/core/ext/client_config/resolver.h
|
||||
- src/core/ext/client_config/resolver_factory.h
|
||||
- src/core/ext/client_config/resolver_registry.h
|
||||
- src/core/ext/client_config/resolver_result.h
|
||||
- src/core/ext/client_config/subchannel.h
|
||||
- src/core/ext/client_config/subchannel_call_holder.h
|
||||
- src/core/ext/client_config/subchannel_index.h
|
||||
- src/core/ext/client_config/uri_parser.h
|
||||
src:
|
||||
- src/core/ext/client_config/channel_connectivity.c
|
||||
- src/core/ext/client_config/client_channel.c
|
||||
- src/core/ext/client_config/client_channel_factory.c
|
||||
- src/core/ext/client_config/client_config.c
|
||||
- src/core/ext/client_config/client_config_plugin.c
|
||||
- src/core/ext/client_config/connector.c
|
||||
- src/core/ext/client_config/default_initial_connect_string.c
|
||||
|
|
@ -380,8 +390,8 @@ filegroups:
|
|||
- src/core/ext/client_config/resolver.c
|
||||
- src/core/ext/client_config/resolver_factory.c
|
||||
- src/core/ext/client_config/resolver_registry.c
|
||||
- src/core/ext/client_config/resolver_result.c
|
||||
- src/core/ext/client_config/subchannel.c
|
||||
- src/core/ext/client_config/subchannel_call_holder.c
|
||||
- src/core/ext/client_config/subchannel_index.c
|
||||
- src/core/ext/client_config/uri_parser.c
|
||||
plugin: grpc_client_config
|
||||
|
|
@ -389,7 +399,6 @@ filegroups:
|
|||
- grpc_base
|
||||
- name: grpc_codegen
|
||||
public_headers:
|
||||
- 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
|
||||
|
|
@ -453,7 +462,6 @@ filegroups:
|
|||
- name: grpc_secure
|
||||
public_headers:
|
||||
- include/grpc/grpc_security.h
|
||||
- include/grpc/grpc_security_constants.h
|
||||
headers:
|
||||
- src/core/lib/security/context/security_context.h
|
||||
- src/core/lib/security/credentials/composite/composite_credentials.h
|
||||
|
|
@ -715,36 +723,33 @@ filegroups:
|
|||
- src/cpp/server/dynamic_thread_pool.h
|
||||
- src/cpp/server/thread_pool_interface.h
|
||||
src:
|
||||
- src/cpp/client/channel.cc
|
||||
- src/cpp/client/channel_cc.cc
|
||||
- src/cpp/client/client_context.cc
|
||||
- src/cpp/client/create_channel.cc
|
||||
- src/cpp/client/create_channel_internal.cc
|
||||
- src/cpp/client/create_channel_posix.cc
|
||||
- src/cpp/client/credentials.cc
|
||||
- src/cpp/client/credentials_cc.cc
|
||||
- src/cpp/client/generic_stub.cc
|
||||
- src/cpp/client/insecure_credentials.cc
|
||||
- src/cpp/common/channel_arguments.cc
|
||||
- src/cpp/common/channel_filter.cc
|
||||
- src/cpp/common/completion_queue.cc
|
||||
- src/cpp/common/completion_queue_cc.cc
|
||||
- src/cpp/common/core_codegen.cc
|
||||
- src/cpp/common/rpc_method.cc
|
||||
- src/cpp/server/async_generic_service.cc
|
||||
- src/cpp/server/create_default_thread_pool.cc
|
||||
- src/cpp/server/dynamic_thread_pool.cc
|
||||
- src/cpp/server/insecure_server_credentials.cc
|
||||
- src/cpp/server/server.cc
|
||||
- src/cpp/server/server_builder.cc
|
||||
- src/cpp/server/server_cc.cc
|
||||
- src/cpp/server/server_context.cc
|
||||
- src/cpp/server/server_credentials.cc
|
||||
- src/cpp/server/server_posix.cc
|
||||
- src/cpp/util/byte_buffer.cc
|
||||
- src/cpp/util/slice.cc
|
||||
- src/cpp/util/byte_buffer_cc.cc
|
||||
- src/cpp/util/slice_cc.cc
|
||||
- src/cpp/util/status.cc
|
||||
- src/cpp/util/string_ref.cc
|
||||
- src/cpp/util/time.cc
|
||||
deps:
|
||||
- grpc
|
||||
- src/cpp/util/time_cc.cc
|
||||
uses:
|
||||
- grpc_base
|
||||
- grpc++_codegen_base
|
||||
- name: grpc++_codegen_base
|
||||
language: c++
|
||||
|
|
@ -772,6 +777,7 @@ filegroups:
|
|||
- include/grpc++/impl/codegen/service_type.h
|
||||
- include/grpc++/impl/codegen/status.h
|
||||
- include/grpc++/impl/codegen/status_code_enum.h
|
||||
- include/grpc++/impl/codegen/status_helper.h
|
||||
- include/grpc++/impl/codegen/string_ref.h
|
||||
- include/grpc++/impl/codegen/stub_options.h
|
||||
- include/grpc++/impl/codegen/sync.h
|
||||
|
|
@ -987,11 +993,13 @@ libs:
|
|||
- src/cpp/common/secure_auth_context.h
|
||||
- src/cpp/server/secure_server_credentials.h
|
||||
src:
|
||||
- src/cpp/client/insecure_credentials.cc
|
||||
- src/cpp/client/secure_credentials.cc
|
||||
- src/cpp/common/auth_property_iterator.cc
|
||||
- src/cpp/common/secure_auth_context.cc
|
||||
- src/cpp/common/secure_channel_arguments.cc
|
||||
- src/cpp/common/secure_create_auth_context.cc
|
||||
- src/cpp/server/insecure_server_credentials.cc
|
||||
- src/cpp/server/secure_server_credentials.cc
|
||||
deps:
|
||||
- grpc
|
||||
|
|
@ -1028,7 +1036,7 @@ libs:
|
|||
headers:
|
||||
- test/cpp/util/test_config.h
|
||||
src:
|
||||
- test/cpp/util/test_config.cc
|
||||
- test/cpp/util/test_config_cc.cc
|
||||
- name: grpc++_test_util
|
||||
build: private
|
||||
language: c++
|
||||
|
|
@ -1062,7 +1070,9 @@ libs:
|
|||
build: all
|
||||
language: c++
|
||||
src:
|
||||
- src/cpp/client/insecure_credentials.cc
|
||||
- src/cpp/common/insecure_create_auth_context.cc
|
||||
- src/cpp/server/insecure_server_credentials.cc
|
||||
deps:
|
||||
- gpr
|
||||
- grpc_unsecure
|
||||
|
|
@ -1418,6 +1428,17 @@ targets:
|
|||
- test/core/end2end/fuzzers/client_fuzzer_corpus
|
||||
dict: test/core/end2end/fuzzers/hpack.dictionary
|
||||
maxlen: 2048
|
||||
- name: combiner_test
|
||||
cpu_cost: 30
|
||||
build: test
|
||||
language: c
|
||||
src:
|
||||
- test/core/iomgr/combiner_test.c
|
||||
deps:
|
||||
- grpc_test_util
|
||||
- grpc
|
||||
- gpr_test_util
|
||||
- gpr
|
||||
- name: compression_test
|
||||
build: test
|
||||
language: c
|
||||
|
|
@ -1590,6 +1611,12 @@ targets:
|
|||
src:
|
||||
- tools/codegen/core/gen_legal_metadata_characters.c
|
||||
deps: []
|
||||
- name: gen_percent_encoding_tables
|
||||
build: tool
|
||||
language: c
|
||||
src:
|
||||
- tools/codegen/core/gen_percent_encoding_tables.c
|
||||
deps: []
|
||||
- name: goaway_server_test
|
||||
cpu_cost: 0.1
|
||||
build: test
|
||||
|
|
@ -1669,6 +1696,23 @@ targets:
|
|||
deps:
|
||||
- gpr_test_util
|
||||
- gpr
|
||||
- name: gpr_mpscq_test
|
||||
cpu_cost: 30
|
||||
build: test
|
||||
language: c
|
||||
src:
|
||||
- test/core/support/mpscq_test.c
|
||||
deps:
|
||||
- gpr_test_util
|
||||
- gpr
|
||||
- name: gpr_percent_encoding_test
|
||||
build: test
|
||||
language: c
|
||||
src:
|
||||
- test/core/support/percent_encoding_test.c
|
||||
deps:
|
||||
- gpr_test_util
|
||||
- gpr
|
||||
- name: gpr_slice_buffer_test
|
||||
build: test
|
||||
language: c
|
||||
|
|
@ -2230,6 +2274,32 @@ targets:
|
|||
- grpc
|
||||
- gpr_test_util
|
||||
- gpr
|
||||
- name: percent_decode_fuzzer
|
||||
build: fuzzer
|
||||
language: c
|
||||
src:
|
||||
- test/core/support/percent_decode_fuzzer.c
|
||||
deps:
|
||||
- grpc_test_util
|
||||
- grpc
|
||||
- gpr_test_util
|
||||
- gpr
|
||||
corpus_dirs:
|
||||
- test/core/support/percent_decode_corpus
|
||||
maxlen: 32
|
||||
- name: percent_encode_fuzzer
|
||||
build: fuzzer
|
||||
language: c
|
||||
src:
|
||||
- test/core/support/percent_encode_fuzzer.c
|
||||
deps:
|
||||
- grpc_test_util
|
||||
- grpc
|
||||
- gpr_test_util
|
||||
- gpr
|
||||
corpus_dirs:
|
||||
- test/core/support/percent_encode_corpus
|
||||
maxlen: 32
|
||||
- name: resolve_address_test
|
||||
build: test
|
||||
language: c
|
||||
|
|
|
|||
|
|
@ -56,7 +56,9 @@ if test "$PHP_GRPC" != "no"; then
|
|||
src/core/lib/support/log_linux.c \
|
||||
src/core/lib/support/log_posix.c \
|
||||
src/core/lib/support/log_windows.c \
|
||||
src/core/lib/support/mpscq.c \
|
||||
src/core/lib/support/murmur_hash.c \
|
||||
src/core/lib/support/percent_encoding.c \
|
||||
src/core/lib/support/slice.c \
|
||||
src/core/lib/support/slice_buffer.c \
|
||||
src/core/lib/support/stack_lockfree.c \
|
||||
|
|
@ -97,6 +99,7 @@ if test "$PHP_GRPC" != "no"; then
|
|||
src/core/lib/http/httpcli.c \
|
||||
src/core/lib/http/parser.c \
|
||||
src/core/lib/iomgr/closure.c \
|
||||
src/core/lib/iomgr/combiner.c \
|
||||
src/core/lib/iomgr/endpoint.c \
|
||||
src/core/lib/iomgr/endpoint_pair_posix.c \
|
||||
src/core/lib/iomgr/endpoint_pair_windows.c \
|
||||
|
|
@ -236,7 +239,6 @@ if test "$PHP_GRPC" != "no"; then
|
|||
src/core/ext/client_config/channel_connectivity.c \
|
||||
src/core/ext/client_config/client_channel.c \
|
||||
src/core/ext/client_config/client_channel_factory.c \
|
||||
src/core/ext/client_config/client_config.c \
|
||||
src/core/ext/client_config/client_config_plugin.c \
|
||||
src/core/ext/client_config/connector.c \
|
||||
src/core/ext/client_config/default_initial_connect_string.c \
|
||||
|
|
@ -248,8 +250,8 @@ if test "$PHP_GRPC" != "no"; then
|
|||
src/core/ext/client_config/resolver.c \
|
||||
src/core/ext/client_config/resolver_factory.c \
|
||||
src/core/ext/client_config/resolver_registry.c \
|
||||
src/core/ext/client_config/resolver_result.c \
|
||||
src/core/ext/client_config/subchannel.c \
|
||||
src/core/ext/client_config/subchannel_call_holder.c \
|
||||
src/core/ext/client_config/subchannel_index.c \
|
||||
src/core/ext/client_config/uri_parser.c \
|
||||
src/core/ext/transport/chttp2/server/insecure/server_chttp2.c \
|
||||
|
|
@ -271,6 +273,7 @@ if test "$PHP_GRPC" != "no"; then
|
|||
src/core/ext/census/base_resources.c \
|
||||
src/core/ext/census/context.c \
|
||||
src/core/ext/census/gen/census.pb.c \
|
||||
src/core/ext/census/gen/trace_context.pb.c \
|
||||
src/core/ext/census/grpc_context.c \
|
||||
src/core/ext/census/grpc_filter.c \
|
||||
src/core/ext/census/grpc_plugin.c \
|
||||
|
|
|
|||
|
|
@ -98,8 +98,11 @@ For requests, **EOS** (end-of-stream) is indicated by the presence of the END_ST
|
|||
* **Trailers-Only** → HTTP-Status Content-Type Trailers
|
||||
* **Trailers** → Status [Status-Message] \*Custom-Metadata
|
||||
* **HTTP-Status** → ":status 200"
|
||||
* **Status** → "grpc-status" <status-code-as-ASCII-string>
|
||||
* **Status-Message** → "grpc-message" <descriptive text for status as ASCII string>
|
||||
* **Status** → "grpc-status" 1\*DIGIT ; 0-9
|
||||
* **Status-Message** → "grpc-message" Percent-Encoded
|
||||
* **Percent-Encoded** → 1\*(Percent-Byte-Unencoded / Percent-Byte-Encoded)
|
||||
* **Percent-Byte-Unencoded** → 1\*( %x20-%x24 / %x26-%x7E ) ; space and VCHAR, except %
|
||||
* **Percent-Byte-Encoded** → "%" 2HEXDIGIT ; 0-9 A-F
|
||||
|
||||
**Response-Headers** & **Trailers-Only** are each delivered in a single HTTP2 HEADERS frame block. Most responses are expected to have both headers and trailers but **Trailers-Only** is permitted for calls that produce an immediate error. Status must be sent in **Trailers** even if the status code is OK.
|
||||
|
||||
|
|
@ -110,6 +113,21 @@ Implementations should expect broken deployments to send non-200 HTTP status cod
|
|||
Clients may limit the size of **Response-Headers**, **Trailers**, and
|
||||
**Trailers-Only**, with a default of 8 KiB each suggested.
|
||||
|
||||
The value portion of **Status** is a decimal-encoded integer as an ASCII string,
|
||||
without any leading zeros.
|
||||
|
||||
The value portion of **Status-Message** is conceptually a Unicode string
|
||||
description of the error, physically encoded as UTF-8 followed by
|
||||
percent-encoding. Percent-encoding is specified in [RFC 3986
|
||||
§2.1](https://tools.ietf.org/html/rfc3986#section-2.1), although the form used
|
||||
here has different restricted characters. When decoding invalid values,
|
||||
implementations MUST NOT error or throw away the message. At worst, the
|
||||
implementation can abort decoding the status message altogether such that the
|
||||
user would received the raw percent-encoded form. Alternatively, the
|
||||
implementation can decode valid portions while leaving broken %-encodings as-is
|
||||
or replacing them with a replacement character (e.g., '?' or the Unicode
|
||||
replacement character).
|
||||
|
||||
####Example
|
||||
|
||||
Sample unary-call showing HTTP2 framing sequence
|
||||
|
|
|
|||
|
|
@ -1,15 +1 @@
|
|||
gRPC Fail Fast Semantics
|
||||
========================
|
||||
|
||||
Fail fast requests allow terminating requests (with status UNAVAILABLE) prior
|
||||
to the deadline of the request being met.
|
||||
|
||||
gRPC implementations of fail fast can terminate requests whenever a channel is
|
||||
in the TRANSIENT_FAILURE or SHUTDOWN states. If the channel is in any other
|
||||
state (CONNECTING, READY, or IDLE) the request should not be terminated.
|
||||
|
||||
Fail fast SHOULD be the default for gRPC implementations, with an option to
|
||||
switch to non fail fast.
|
||||
|
||||
The opposite of fail fast is 'ignore connectivity'.
|
||||
|
||||
Moved to wait-for-ready.md
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
Each version of gRPC gets a new description of what the 'g' stands for, since
|
||||
we've never really been able to figure it out.
|
||||
|
||||
Below is a list of already-used definitions (that should not be repeated in the
|
||||
future), and the corresponding version numbers that used them:
|
||||
|
||||
- 1.0 'g' stands for 'gRPC'
|
||||
- 1.1 'g' stands for 'good'
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
# HTTP to gRPC Status Code Mapping
|
||||
|
||||
Since intermediaries are a common part of HTTP infrastructure some responses to
|
||||
gRPC requests may be received that do not include the grpc-status header. In
|
||||
some cases mapping error codes from an intermediary allows the gRPC client to
|
||||
behave more appropriately to the error situation without overloading the
|
||||
semantics of either error code.
|
||||
|
||||
This table is to be used _only_ for clients that received a response that did
|
||||
not include grpc-status. If grpc-status was provided, it _must_ be used. Servers
|
||||
_must not_ use this table to determine an HTTP status code to use; the mappings
|
||||
are neither symmetric nor 1-to-1.
|
||||
|
||||
| HTTP Status Code | gRPC Status Code |
|
||||
|----------------------------|--------------------|
|
||||
| 400 Bad Request | INTERNAL |
|
||||
| 401 Unauthorized | UNAUTHENTICATED |
|
||||
| 403 Forbidden | PERMISSION\_DENIED |
|
||||
| 404 Not Found | UNIMPLEMENTED |
|
||||
| 429 Too Many Requests | UNAVAILABLE |
|
||||
| 502 Bad Gateway | UNAVAILABLE |
|
||||
| 503 Service Unavailable | UNAVAILABLE |
|
||||
| 504 Gateway Timeout | UNAVAILABLE |
|
||||
| _All other codes_ | UNKNOWN |
|
||||
|
||||
Technically, 1xx should have the entire header skipped and a subsequent header
|
||||
be read. See RFC 7540 §8.1.
|
||||
|
||||
200 is UNKNOWN because there should be a grpc-status in case of truly OK
|
||||
response.
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
gRPC Wait for Ready Semantics
|
||||
=============================
|
||||
|
||||
If an RPC is issued but the channel is in `TRANSIENT_FAILURE` or `SHUTDOWN`
|
||||
states, the RPC is unable to be transmited promptly. By default, gRPC
|
||||
implementations SHOULD fail such RPCs immediately. This is known as "fail fast,"
|
||||
but usage of the term is historical. RPCs SHOULD NOT fail as a result of the
|
||||
channel being in other states (`CONNECTING`, `READY`, or `IDLE`).
|
||||
|
||||
gRPC implementations MAY provide a per-RPC option to not fail RPCs as a result
|
||||
of the channel being in `TRANSIENT_FAILURE` state. Instead, the implementation
|
||||
queues the RPCs until the channel is `READY`. This is known as "wait for ready."
|
||||
The RPCs SHOULD still fail before `READY` if there are unrelated reasons, such
|
||||
as the channel is `SHUTDOWN` or the RPC's deadline is reached.
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
The roots.pem file is periodically generated from:
|
||||
https://hg.mozilla.org/mozilla-central/raw-file/tip/security/nss/lib/ckfw/builtins/certdata.txt
|
||||
using
|
||||
https://github.com/agl/extract-nss-root-certs
|
||||
|
|
@ -5387,3 +5387,42 @@ BggqhkjOPQQDAwNpADBmAjEAj6jcnboMBBf6Fek9LykBl7+BFjNAk2z8+e2AcG+q
|
|||
j9uEwov1NcoG3GRvaBbhj5G5AjEA2Euly8LQCGzpGPta3U1fJAuwACEl74+nBCZx
|
||||
4nxp5V2a+EEfOzmTk51V6s2N8fvB
|
||||
-----END CERTIFICATE-----
|
||||
|
||||
# Issuer: CN=ISRG Root X1 O=Internet Security Research Group
|
||||
# Subject: CN=ISRG Root X1 O=Internet Security Research Group
|
||||
# Label: "ISRG Root X1"
|
||||
# Serial: 172886928669790476064670243504169061120
|
||||
# MD5 Fingerprint: 0c:d2:f9:e0:da:17:73:e9:ed:86:4d:a5:e3:70:e7:4e
|
||||
# SHA1 Fingerprint: ca:bd:2a:79:a1:07:6a:31:f2:1d:25:36:35:cb:03:9d:43:29:a5:e8
|
||||
# SHA256 Fingerprint: 96:bc:ec:06:26:49:76:f3:74:60:77:9a:cf:28:c5:a7:cf:e8:a3:c0:aa:e1:1a:8f:fc:ee:05:c0:bd:df:08:c6
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw
|
||||
TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
|
||||
cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4
|
||||
WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu
|
||||
ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY
|
||||
MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc
|
||||
h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+
|
||||
0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U
|
||||
A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW
|
||||
T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyH
|
||||
B5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ4Q7e2RCOFvu396j3x+UC
|
||||
B5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf1b0SHzUv
|
||||
KBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWn
|
||||
OlFuhjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTn
|
||||
jh8BCNAw1FtxNrQHusEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbw
|
||||
qHyGO0aoSCqI3Haadr8faqU9GY/rOPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CI
|
||||
rU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
|
||||
HRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY9umbbjANBgkq
|
||||
hkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL
|
||||
ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ
|
||||
3BebYhtF8GaV0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KK
|
||||
NFtY2PwByVS5uCbMiogziUwthDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5
|
||||
ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7Ur
|
||||
TkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC
|
||||
jNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc
|
||||
oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq
|
||||
4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA
|
||||
mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d
|
||||
emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=
|
||||
-----END CERTIFICATE-----
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
#include <string>
|
||||
|
||||
#include <grpc++/grpc++.h>
|
||||
#include <grpc/support/log.h>
|
||||
|
||||
#include "helloworld.grpc.pb.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
#include <string>
|
||||
|
||||
#include <grpc++/grpc++.h>
|
||||
#include <grpc/support/log.h>
|
||||
#include <thread>
|
||||
|
||||
#include "helloworld.grpc.pb.h"
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
#include <thread>
|
||||
|
||||
#include <grpc++/grpc++.h>
|
||||
#include <grpc/support/log.h>
|
||||
|
||||
#include "helloworld.grpc.pb.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Grpc.Tools" version="0.6.0" />
|
||||
</packages>
|
||||
|
|
@ -5,8 +5,8 @@
|
|||
"debugType": "portable",
|
||||
},
|
||||
"dependencies": {
|
||||
"Google.Protobuf": "3.0.0-beta3",
|
||||
"Grpc": "1.0.0-pre1",
|
||||
"Google.Protobuf": "3.0.0",
|
||||
"Grpc": "1.0.0",
|
||||
},
|
||||
"frameworks": {
|
||||
"net45": {
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
"emitEntryPoint": "true"
|
||||
},
|
||||
"dependencies": {
|
||||
"Google.Protobuf": "3.0.0-beta3",
|
||||
"Grpc": "1.0.0-pre1",
|
||||
"Google.Protobuf": "3.0.0",
|
||||
"Grpc": "1.0.0",
|
||||
"Greeter": {
|
||||
"target": "project"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
"emitEntryPoint": "true"
|
||||
},
|
||||
"dependencies": {
|
||||
"Google.Protobuf": "3.0.0-beta3",
|
||||
"Grpc": "1.0.0-pre1",
|
||||
"Google.Protobuf": "3.0.0",
|
||||
"Grpc": "1.0.0",
|
||||
"Greeter": {
|
||||
"target": "project"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,16 +33,16 @@
|
|||
<ItemGroup>
|
||||
<Reference Include="Google.Protobuf, Version=3.0.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Google.Protobuf.3.0.0-beta3\lib\portable-net45+netcore45+wpa81+wp8\Google.Protobuf.dll</HintPath>
|
||||
<HintPath>..\packages\Google.Protobuf.3.0.0\lib\net45\Google.Protobuf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Grpc.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d754f35622e28bad, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Grpc.Core.0.15.0\lib\net45\Grpc.Core.dll</HintPath>
|
||||
<HintPath>..\packages\Grpc.Core.1.0.0\lib\net45\Grpc.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Interactive.Async, Version=1.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Ix-Async.1.2.5\lib\net45\System.Interactive.Async.dll</HintPath>
|
||||
<HintPath>..\packages\System.Interactive.Async.3.0.0\lib\net45\System.Interactive.Async.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
@ -61,11 +61,11 @@
|
|||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets')" />
|
||||
<Import Project="..\packages\Grpc.Core.1.0.0\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.1.0.0\build\net45\Grpc.Core.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Grpc.Core.1.0.0\build\net45\Grpc.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Core.1.0.0\build\net45\Grpc.Core.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Google.Protobuf" version="3.0.0-beta3" targetFramework="net45" />
|
||||
<package id="Grpc" version="0.15.0" targetFramework="net45" />
|
||||
<package id="Grpc.Core" version="0.15.0" targetFramework="net45" />
|
||||
<package id="Ix-Async" version="1.2.5" targetFramework="net45" />
|
||||
<package id="Grpc.Tools" version="0.15.0" targetFramework="net45" />
|
||||
</packages>
|
||||
<package id="Google.Protobuf" version="3.0.0" targetFramework="net45" />
|
||||
<package id="Grpc" version="1.0.0" targetFramework="net45" />
|
||||
<package id="Grpc.Core" version="1.0.0" targetFramework="net45" />
|
||||
<package id="System.Interactive.Async" version="3.0.0" targetFramework="net45" />
|
||||
<package id="Grpc.Tools" version="1.0.0" targetFramework="net45" />
|
||||
</packages>
|
||||
|
|
|
|||
|
|
@ -33,16 +33,16 @@
|
|||
<ItemGroup>
|
||||
<Reference Include="Google.Protobuf, Version=3.0.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Google.Protobuf.3.0.0-beta3\lib\portable-net45+netcore45+wpa81+wp8\Google.Protobuf.dll</HintPath>
|
||||
<HintPath>..\packages\Google.Protobuf.3.0.0\lib\net45\Google.Protobuf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Grpc.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d754f35622e28bad, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Grpc.Core.0.15.0\lib\net45\Grpc.Core.dll</HintPath>
|
||||
<HintPath>..\packages\Grpc.Core.1.0.0\lib\net45\Grpc.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Interactive.Async, Version=1.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Ix-Async.1.2.5\lib\net45\System.Interactive.Async.dll</HintPath>
|
||||
<HintPath>..\packages\System.Interactive.Async.3.0.0\lib\net45\System.Interactive.Async.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
@ -59,11 +59,11 @@
|
|||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets')" />
|
||||
<Import Project="..\packages\Grpc.Core.1.0.0\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.1.0.0\build\net45\Grpc.Core.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Grpc.Core.1.0.0\build\net45\Grpc.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Core.1.0.0\build\net45\Grpc.Core.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Google.Protobuf" version="3.0.0-beta3" targetFramework="net45" />
|
||||
<package id="Grpc" version="0.15.0" targetFramework="net45" />
|
||||
<package id="Grpc.Core" version="0.15.0" targetFramework="net45" />
|
||||
<package id="Ix-Async" version="1.2.5" targetFramework="net45" />
|
||||
</packages>
|
||||
<package id="Google.Protobuf" version="3.0.0" targetFramework="net45" />
|
||||
<package id="Grpc" version="1.0.0" targetFramework="net45" />
|
||||
<package id="Grpc.Core" version="1.0.0" targetFramework="net45" />
|
||||
<package id="System.Interactive.Async" version="3.0.0" targetFramework="net45" />
|
||||
</packages>
|
||||
|
|
|
|||
|
|
@ -33,16 +33,16 @@
|
|||
<ItemGroup>
|
||||
<Reference Include="Google.Protobuf, Version=3.0.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Google.Protobuf.3.0.0-beta3\lib\portable-net45+netcore45+wpa81+wp8\Google.Protobuf.dll</HintPath>
|
||||
<HintPath>..\packages\Google.Protobuf.3.0.0\lib\net45\Google.Protobuf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Grpc.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d754f35622e28bad, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Grpc.Core.0.15.0\lib\net45\Grpc.Core.dll</HintPath>
|
||||
<HintPath>..\packages\Grpc.Core.1.0.0\lib\net45\Grpc.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Interactive.Async, Version=1.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Ix-Async.1.2.5\lib\net45\System.Interactive.Async.dll</HintPath>
|
||||
<HintPath>..\packages\System.Interactive.Async.3.0.0\lib\net45\System.Interactive.Async.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
@ -59,11 +59,11 @@
|
|||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets')" />
|
||||
<Import Project="..\packages\Grpc.Core.1.0.0\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.1.0.0\build\net45\Grpc.Core.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Grpc.Core.1.0.0\build\net45\Grpc.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Core.1.0.0\build\net45\Grpc.Core.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Google.Protobuf" version="3.0.0-beta3" targetFramework="net45" />
|
||||
<package id="Grpc" version="0.15.0" targetFramework="net45" />
|
||||
<package id="Grpc.Core" version="0.15.0" targetFramework="net45" />
|
||||
<package id="Ix-Async" version="1.2.5" targetFramework="net45" />
|
||||
</packages>
|
||||
<package id="Google.Protobuf" version="3.0.0" targetFramework="net45" />
|
||||
<package id="Grpc" version="1.0.0" targetFramework="net45" />
|
||||
<package id="Grpc.Core" version="1.0.0" targetFramework="net45" />
|
||||
<package id="System.Interactive.Async" version="3.0.0" targetFramework="net45" />
|
||||
</packages>
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ setlocal
|
|||
@rem enter this directory
|
||||
cd /d %~dp0
|
||||
|
||||
set TOOLS_PATH=packages\Grpc.Tools.0.15.0\tools\windows_x86
|
||||
set TOOLS_PATH=packages\Grpc.Tools.1.0.0\tools\windows_x86
|
||||
|
||||
%TOOLS_PATH%\protoc.exe -I../../protos --csharp_out Greeter ../../protos/helloworld.proto --grpc_out Greeter --plugin=protoc-gen-grpc=%TOOLS_PATH%\grpc_csharp_plugin.exe
|
||||
|
||||
endlocal
|
||||
endlocal
|
||||
|
|
|
|||
|
|
@ -33,11 +33,11 @@
|
|||
<ItemGroup>
|
||||
<Reference Include="Google.Protobuf, Version=3.0.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Google.Protobuf.3.0.0-beta3\lib\portable-net45+netcore45+wpa81+wp8\Google.Protobuf.dll</HintPath>
|
||||
<HintPath>..\packages\Google.Protobuf.3.0.0\lib\net45\Google.Protobuf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Grpc.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d754f35622e28bad, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Grpc.Core.0.15.0\lib\net45\Grpc.Core.dll</HintPath>
|
||||
<HintPath>..\packages\Grpc.Core.1.0.0\lib\net45\Grpc.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
|
|
@ -52,7 +52,7 @@
|
|||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Interactive.Async, Version=1.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Ix-Async.1.2.5\lib\net45\System.Interactive.Async.dll</HintPath>
|
||||
<HintPath>..\packages\System.Interactive.Async.3.0.0\lib\net45\System.Interactive.Async.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
@ -74,12 +74,12 @@
|
|||
</None>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets')" />
|
||||
<Import Project="..\packages\Grpc.Core.1.0.0\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.1.0.0\build\net45\Grpc.Core.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Grpc.Core.1.0.0\build\net45\Grpc.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Core.1.0.0\build\net45\Grpc.Core.targets'))" />
|
||||
</Target>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
|
@ -88,4 +88,4 @@
|
|||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Google.Protobuf" version="3.0.0-beta3" targetFramework="net45" />
|
||||
<package id="Grpc" version="0.15.0" targetFramework="net45" />
|
||||
<package id="Grpc.Core" version="0.15.0" targetFramework="net45" />
|
||||
<package id="Ix-Async" version="1.2.5" targetFramework="net45" />
|
||||
<package id="Google.Protobuf" version="3.0.0" targetFramework="net45" />
|
||||
<package id="Grpc" version="1.0.0" targetFramework="net45" />
|
||||
<package id="Grpc.Core" version="1.0.0" targetFramework="net45" />
|
||||
<package id="System.Interactive.Async" version="3.0.0" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
|
||||
</packages>
|
||||
</packages>
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@
|
|||
<ItemGroup>
|
||||
<Reference Include="Google.Protobuf, Version=3.0.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Google.Protobuf.3.0.0-beta3\lib\portable-net45+netcore45+wpa81+wp8\Google.Protobuf.dll</HintPath>
|
||||
<HintPath>..\packages\Google.Protobuf.3.0.0\lib\net45\Google.Protobuf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Grpc.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d754f35622e28bad, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Grpc.Core.0.15.0\lib\net45\Grpc.Core.dll</HintPath>
|
||||
<HintPath>..\packages\Grpc.Core.1.0.0\lib\net45\Grpc.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
|
|
@ -49,7 +49,7 @@
|
|||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Interactive.Async, Version=1.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Ix-Async.1.2.5\lib\net45\System.Interactive.Async.dll</HintPath>
|
||||
<HintPath>..\packages\System.Interactive.Async.3.0.0\lib\net45\System.Interactive.Async.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
|
|
@ -71,12 +71,12 @@
|
|||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets')" />
|
||||
<Import Project="..\packages\Grpc.Core.1.0.0\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.1.0.0\build\net45\Grpc.Core.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Grpc.Core.1.0.0\build\net45\Grpc.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Core.1.0.0\build\net45\Grpc.Core.targets'))" />
|
||||
</Target>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
|
@ -85,4 +85,4 @@
|
|||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Google.Protobuf" version="3.0.0-beta3" targetFramework="net45" />
|
||||
<package id="Grpc" version="0.15.0" targetFramework="net45" />
|
||||
<package id="Grpc.Core" version="0.15.0" targetFramework="net45" />
|
||||
<package id="Ix-Async" version="1.2.5" targetFramework="net45" />
|
||||
<package id="Google.Protobuf" version="3.0.0" targetFramework="net45" />
|
||||
<package id="Grpc" version="1.0.0" targetFramework="net45" />
|
||||
<package id="Grpc.Core" version="1.0.0" targetFramework="net45" />
|
||||
<package id="System.Interactive.Async" version="3.0.0" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
|
||||
</packages>
|
||||
</packages>
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@
|
|||
<ItemGroup>
|
||||
<Reference Include="Google.Protobuf, Version=3.0.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Google.Protobuf.3.0.0-beta3\lib\portable-net45+netcore45+wpa81+wp8\Google.Protobuf.dll</HintPath>
|
||||
<HintPath>..\packages\Google.Protobuf.3.0.0\lib\net45\Google.Protobuf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Grpc.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d754f35622e28bad, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Grpc.Core.0.15.0\lib\net45\Grpc.Core.dll</HintPath>
|
||||
<HintPath>..\packages\Grpc.Core.1.0.0\lib\net45\Grpc.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
|
|
@ -54,7 +54,7 @@
|
|||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Interactive.Async, Version=1.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Ix-Async.1.2.5\lib\net45\System.Interactive.Async.dll</HintPath>
|
||||
<HintPath>..\packages\System.Interactive.Async.3.0.0\lib\net45\System.Interactive.Async.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
@ -72,12 +72,12 @@
|
|||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets')" />
|
||||
<Import Project="..\packages\Grpc.Core.1.0.0\build\net45\Grpc.Core.targets" Condition="Exists('..\packages\Grpc.Core.1.0.0\build\net45\Grpc.Core.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Core.0.15.0\build\net45\Grpc.Core.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Grpc.Core.1.0.0\build\net45\Grpc.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Grpc.Core.1.0.0\build\net45\Grpc.Core.targets'))" />
|
||||
</Target>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
|
@ -86,4 +86,4 @@
|
|||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Google.Protobuf" version="3.0.0-beta3" targetFramework="net45" />
|
||||
<package id="Grpc" version="0.15.0" targetFramework="net45" />
|
||||
<package id="Grpc.Core" version="0.15.0" targetFramework="net45" />
|
||||
<package id="Ix-Async" version="1.2.5" targetFramework="net45" />
|
||||
<package id="Google.Protobuf" version="3.0.0" targetFramework="net45" />
|
||||
<package id="Grpc" version="1.0.0" targetFramework="net45" />
|
||||
<package id="Grpc.Core" version="1.0.0" targetFramework="net45" />
|
||||
<package id="System.Interactive.Async" version="3.0.0" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
|
||||
<package id="Grpc.Tools" version="0.15.0" targetFramework="net45" />
|
||||
</packages>
|
||||
<package id="Grpc.Tools" version="1.0.0" targetFramework="net45" />
|
||||
</packages>
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ setlocal
|
|||
@rem enter this directory
|
||||
cd /d %~dp0
|
||||
|
||||
set TOOLS_PATH=packages\Grpc.Tools.0.15.0\tools\windows_x86
|
||||
set TOOLS_PATH=packages\Grpc.Tools.1.0.0\tools\windows_x86
|
||||
|
||||
%TOOLS_PATH%\protoc.exe -I../../protos --csharp_out RouteGuide ../../protos/route_guide.proto --grpc_out RouteGuide --plugin=protoc-gen-grpc=%TOOLS_PATH%\grpc_csharp_plugin.exe
|
||||
|
||||
endlocal
|
||||
endlocal
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ There are two ways to generate the code needed to work with protocol buffers in
|
|||
$ # from this directory
|
||||
$ node ./dynamic_codegen/greeter_client.js
|
||||
$ # OR
|
||||
$ node ./dynamic_codegen/greeter_client.js
|
||||
$ node ./static_codegen/greeter_client.js
|
||||
```
|
||||
|
||||
TUTORIAL
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ Pod::Spec.new do |s|
|
|||
src = "../../protos"
|
||||
|
||||
# Run protoc with the Objective-C and gRPC plugins to generate protocol messages and gRPC clients.
|
||||
s.dependency "!ProtoCompiler-gRPCPlugin", "~> 1.0.0-pre1.2"
|
||||
s.dependency "!ProtoCompiler-gRPCPlugin", "~> 1.0"
|
||||
|
||||
# Pods directory corresponding to this app's Podfile, relative to the location of this podspec.
|
||||
pods_root = 'Pods'
|
||||
|
|
@ -45,10 +45,6 @@ Pod::Spec.new do |s|
|
|||
ms.requires_arc = false
|
||||
# The generated files depend on the protobuf runtime.
|
||||
ms.dependency "Protobuf"
|
||||
# This is needed by all pods that depend on Protobuf:
|
||||
ms.pod_target_xcconfig = {
|
||||
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1',
|
||||
}
|
||||
end
|
||||
|
||||
# Files generated by the gRPC plugin
|
||||
|
|
@ -60,4 +56,11 @@ Pod::Spec.new do |s|
|
|||
ss.dependency "gRPC-ProtoRPC"
|
||||
ss.dependency "#{s.name}/Messages"
|
||||
end
|
||||
|
||||
s.pod_target_xcconfig = {
|
||||
# This is needed by all pods that depend on Protobuf:
|
||||
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1',
|
||||
# This is needed by all pods that depend on gRPC-RxLibrary:
|
||||
'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES',
|
||||
}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ Pod::Spec.new do |s|
|
|||
src = "../../protos"
|
||||
|
||||
# Run protoc with the Objective-C and gRPC plugins to generate protocol messages and gRPC clients.
|
||||
s.dependency "!ProtoCompiler-gRPCPlugin", "~> 1.0.0-pre1.2"
|
||||
s.dependency "!ProtoCompiler-gRPCPlugin", "~> 1.0"
|
||||
|
||||
# Pods directory corresponding to this app's Podfile, relative to the location of this podspec.
|
||||
pods_root = 'Pods'
|
||||
|
|
@ -45,10 +45,6 @@ Pod::Spec.new do |s|
|
|||
ms.requires_arc = false
|
||||
# The generated files depend on the protobuf runtime.
|
||||
ms.dependency "Protobuf"
|
||||
# This is needed by all pods that depend on Protobuf:
|
||||
ms.pod_target_xcconfig = {
|
||||
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1',
|
||||
}
|
||||
end
|
||||
|
||||
# Files generated by the gRPC plugin
|
||||
|
|
@ -60,4 +56,11 @@ Pod::Spec.new do |s|
|
|||
ss.dependency "gRPC-ProtoRPC"
|
||||
ss.dependency "#{s.name}/Messages"
|
||||
end
|
||||
|
||||
s.pod_target_xcconfig = {
|
||||
# This is needed by all pods that depend on Protobuf:
|
||||
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1',
|
||||
# This is needed by all pods that depend on gRPC-RxLibrary:
|
||||
'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES',
|
||||
}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ Pod::Spec.new do |s|
|
|||
src = "../../protos"
|
||||
|
||||
# Run protoc with the Objective-C and gRPC plugins to generate protocol messages and gRPC clients.
|
||||
s.dependency "!ProtoCompiler-gRPCPlugin", "~> 1.0.0-pre1.2"
|
||||
s.dependency "!ProtoCompiler-gRPCPlugin", "~> 1.0"
|
||||
|
||||
# Pods directory corresponding to this app's Podfile, relative to the location of this podspec.
|
||||
pods_root = 'Pods'
|
||||
|
|
@ -45,10 +45,6 @@ Pod::Spec.new do |s|
|
|||
ms.requires_arc = false
|
||||
# The generated files depend on the protobuf runtime.
|
||||
ms.dependency "Protobuf"
|
||||
# This is needed by all pods that depend on Protobuf:
|
||||
ms.pod_target_xcconfig = {
|
||||
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1',
|
||||
}
|
||||
end
|
||||
|
||||
# Files generated by the gRPC plugin
|
||||
|
|
@ -60,4 +56,11 @@ Pod::Spec.new do |s|
|
|||
ss.dependency "gRPC-ProtoRPC"
|
||||
ss.dependency "#{s.name}/Messages"
|
||||
end
|
||||
|
||||
s.pod_target_xcconfig = {
|
||||
# This is needed by all pods that depend on Protobuf:
|
||||
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1',
|
||||
# This is needed by all pods that depend on gRPC-RxLibrary:
|
||||
'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES',
|
||||
}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
{
|
||||
"name": "grpc/grpc-demo",
|
||||
"description": "gRPC example for PHP",
|
||||
"minimum-stability": "dev",
|
||||
"require": {
|
||||
"grpc/grpc": "v0.15.2"
|
||||
"grpc/grpc": "v1.0.0"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,5 +30,5 @@
|
|||
|
||||
set -e
|
||||
cd $(dirname $0)
|
||||
php $extension_dir -d extension=grpc.so -d max_execution_time=300 \
|
||||
php -d extension=grpc.so -d max_execution_time=300 \
|
||||
greeter_client.php $1
|
||||
|
|
|
|||
|
|
@ -1,56 +1 @@
|
|||
gRPC in 3 minutes (Python)
|
||||
========================
|
||||
|
||||
Background
|
||||
-------------
|
||||
For this sample, we've already generated the server and client stubs from
|
||||
[helloworld.proto][] and we'll be using a specific reference platform.
|
||||
|
||||
|
||||
Install gRPC:
|
||||
```sh
|
||||
$ pip install grpcio
|
||||
```
|
||||
Or, to install it system wide:
|
||||
```sh
|
||||
$ sudo pip install grpcio
|
||||
```
|
||||
|
||||
If you're on Windows, make sure you installed the `pip.exe` component when you
|
||||
installed Python. Invoke as above but with `pip.exe` instead of `pip` (you may
|
||||
also need to invoke from a `cmd.exe` ran as administrator):
|
||||
```sh
|
||||
$ pip.exe install grpcio
|
||||
```
|
||||
|
||||
Download the example
|
||||
```sh
|
||||
$ # Clone the repository to get the example code:
|
||||
$ git clone https://github.com/grpc/grpc
|
||||
$ # Navigate to the "hello, world" Python example:
|
||||
$ cd grpc/examples/python/helloworld
|
||||
```
|
||||
|
||||
Try it!
|
||||
-------
|
||||
|
||||
- Run the server
|
||||
|
||||
```sh
|
||||
$ python2.7 greeter_server.py &
|
||||
```
|
||||
|
||||
- Run the client
|
||||
|
||||
```sh
|
||||
$ python2.7 greeter_client.py
|
||||
```
|
||||
|
||||
Tutorial
|
||||
--------
|
||||
|
||||
You can find a more detailed tutorial in [gRPC Basics: Python][]
|
||||
|
||||
[helloworld.proto]:../protos/helloworld.proto
|
||||
[Install gRPC Python]:../../src/python#installation
|
||||
[gRPC Basics: Python]:http://www.grpc.io/docs/tutorials/basic/python.html
|
||||
[This code's documentation lives on the grpc.io site.](http://www.grpc.io/docs/quickstart/python.html)
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
[This code's documentation lives on the grpc.io site.](http://www.grpc.io/docs)
|
||||
[This code's documentation lives on the grpc.io site.](http://www.grpc.io/docs/quickstart/python.html)
|
||||
|
|
|
|||
|
|
@ -1 +1,3 @@
|
|||
An example showing two stubs sharing a channel and two servicers sharing a server.
|
||||
|
||||
More complete documentation lives at [grpc.io](http://www.grpc.io/docs/tutorials/basic/python.html).
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'gRPC-Core'
|
||||
version = '1.0.0-pre1'
|
||||
version = '1.0.0'
|
||||
s.version = version
|
||||
s.summary = 'Core cross-platform gRPC library, written in C'
|
||||
s.homepage = 'http://www.grpc.io'
|
||||
|
|
@ -44,7 +44,7 @@ Pod::Spec.new do |s|
|
|||
|
||||
s.source = {
|
||||
:git => 'https://github.com/grpc/grpc.git',
|
||||
:tag => "objective-c-v#{version}",
|
||||
:tag => "v#{version}",
|
||||
# TODO(jcanizales): Depend explicitly on the nanopb pod, and disable submodules.
|
||||
:submodules => true,
|
||||
}
|
||||
|
|
@ -144,63 +144,58 @@ Pod::Spec.new do |s|
|
|||
'include/grpc/support/tls_msvc.h',
|
||||
'include/grpc/support/tls_pthread.h',
|
||||
'include/grpc/support/useful.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/gpr_types.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',
|
||||
'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/grpc_security_constants.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/gpr_types.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',
|
||||
'include/grpc/grpc_security.h',
|
||||
'include/grpc/grpc_security_constants.h',
|
||||
'include/grpc/census.h'
|
||||
end
|
||||
s.subspec 'Implementation' do |ss|
|
||||
ss.header_mappings_dir = '.'
|
||||
ss.libraries = 'z'
|
||||
ss.dependency "#{s.name}/Interface", version
|
||||
ss.dependency 'BoringSSL', '~> 5.0'
|
||||
ss.dependency 'BoringSSL', '~> 6.0'
|
||||
|
||||
# To save you from scrolling, this is the last part of the podspec.
|
||||
ss.source_files = 'src/core/lib/profiling/timers.h',
|
||||
'src/core/lib/support/backoff.h',
|
||||
'src/core/lib/support/block_annotate.h',
|
||||
'src/core/lib/support/env.h',
|
||||
'src/core/lib/support/mpscq.h',
|
||||
'src/core/lib/support/murmur_hash.h',
|
||||
'src/core/lib/support/percent_encoding.h',
|
||||
'src/core/lib/support/stack_lockfree.h',
|
||||
'src/core/lib/support/string.h',
|
||||
'src/core/lib/support/string_windows.h',
|
||||
|
|
@ -227,7 +222,9 @@ Pod::Spec.new do |s|
|
|||
'src/core/lib/support/log_linux.c',
|
||||
'src/core/lib/support/log_posix.c',
|
||||
'src/core/lib/support/log_windows.c',
|
||||
'src/core/lib/support/mpscq.c',
|
||||
'src/core/lib/support/murmur_hash.c',
|
||||
'src/core/lib/support/percent_encoding.c',
|
||||
'src/core/lib/support/slice.c',
|
||||
'src/core/lib/support/slice_buffer.c',
|
||||
'src/core/lib/support/stack_lockfree.c',
|
||||
|
|
@ -268,6 +265,7 @@ Pod::Spec.new do |s|
|
|||
'src/core/lib/http/httpcli.h',
|
||||
'src/core/lib/http/parser.h',
|
||||
'src/core/lib/iomgr/closure.h',
|
||||
'src/core/lib/iomgr/combiner.h',
|
||||
'src/core/lib/iomgr/endpoint.h',
|
||||
'src/core/lib/iomgr/endpoint_pair.h',
|
||||
'src/core/lib/iomgr/error.h',
|
||||
|
|
@ -386,7 +384,6 @@ Pod::Spec.new do |s|
|
|||
'src/core/lib/tsi/transport_security_interface.h',
|
||||
'src/core/ext/client_config/client_channel.h',
|
||||
'src/core/ext/client_config/client_channel_factory.h',
|
||||
'src/core/ext/client_config/client_config.h',
|
||||
'src/core/ext/client_config/connector.h',
|
||||
'src/core/ext/client_config/initial_connect_string.h',
|
||||
'src/core/ext/client_config/lb_policy.h',
|
||||
|
|
@ -396,8 +393,8 @@ Pod::Spec.new do |s|
|
|||
'src/core/ext/client_config/resolver.h',
|
||||
'src/core/ext/client_config/resolver_factory.h',
|
||||
'src/core/ext/client_config/resolver_registry.h',
|
||||
'src/core/ext/client_config/resolver_result.h',
|
||||
'src/core/ext/client_config/subchannel.h',
|
||||
'src/core/ext/client_config/subchannel_call_holder.h',
|
||||
'src/core/ext/client_config/subchannel_index.h',
|
||||
'src/core/ext/client_config/uri_parser.h',
|
||||
'src/core/ext/lb_policy/grpclb/grpclb.h',
|
||||
|
|
@ -414,6 +411,7 @@ Pod::Spec.new do |s|
|
|||
'src/core/ext/census/census_interface.h',
|
||||
'src/core/ext/census/census_rpc_stats.h',
|
||||
'src/core/ext/census/gen/census.pb.h',
|
||||
'src/core/ext/census/gen/trace_context.pb.h',
|
||||
'src/core/ext/census/grpc_filter.h',
|
||||
'src/core/ext/census/mlog.h',
|
||||
'src/core/ext/census/resource.h',
|
||||
|
|
@ -434,6 +432,7 @@ Pod::Spec.new do |s|
|
|||
'src/core/lib/http/httpcli.c',
|
||||
'src/core/lib/http/parser.c',
|
||||
'src/core/lib/iomgr/closure.c',
|
||||
'src/core/lib/iomgr/combiner.c',
|
||||
'src/core/lib/iomgr/endpoint.c',
|
||||
'src/core/lib/iomgr/endpoint_pair_posix.c',
|
||||
'src/core/lib/iomgr/endpoint_pair_windows.c',
|
||||
|
|
@ -573,7 +572,6 @@ Pod::Spec.new do |s|
|
|||
'src/core/ext/client_config/channel_connectivity.c',
|
||||
'src/core/ext/client_config/client_channel.c',
|
||||
'src/core/ext/client_config/client_channel_factory.c',
|
||||
'src/core/ext/client_config/client_config.c',
|
||||
'src/core/ext/client_config/client_config_plugin.c',
|
||||
'src/core/ext/client_config/connector.c',
|
||||
'src/core/ext/client_config/default_initial_connect_string.c',
|
||||
|
|
@ -585,8 +583,8 @@ Pod::Spec.new do |s|
|
|||
'src/core/ext/client_config/resolver.c',
|
||||
'src/core/ext/client_config/resolver_factory.c',
|
||||
'src/core/ext/client_config/resolver_registry.c',
|
||||
'src/core/ext/client_config/resolver_result.c',
|
||||
'src/core/ext/client_config/subchannel.c',
|
||||
'src/core/ext/client_config/subchannel_call_holder.c',
|
||||
'src/core/ext/client_config/subchannel_index.c',
|
||||
'src/core/ext/client_config/uri_parser.c',
|
||||
'src/core/ext/transport/chttp2/server/insecure/server_chttp2.c',
|
||||
|
|
@ -608,6 +606,7 @@ Pod::Spec.new do |s|
|
|||
'src/core/ext/census/base_resources.c',
|
||||
'src/core/ext/census/context.c',
|
||||
'src/core/ext/census/gen/census.pb.c',
|
||||
'src/core/ext/census/gen/trace_context.pb.c',
|
||||
'src/core/ext/census/grpc_context.c',
|
||||
'src/core/ext/census/grpc_filter.c',
|
||||
'src/core/ext/census/grpc_plugin.c',
|
||||
|
|
@ -623,7 +622,9 @@ Pod::Spec.new do |s|
|
|||
'src/core/lib/support/backoff.h',
|
||||
'src/core/lib/support/block_annotate.h',
|
||||
'src/core/lib/support/env.h',
|
||||
'src/core/lib/support/mpscq.h',
|
||||
'src/core/lib/support/murmur_hash.h',
|
||||
'src/core/lib/support/percent_encoding.h',
|
||||
'src/core/lib/support/stack_lockfree.h',
|
||||
'src/core/lib/support/string.h',
|
||||
'src/core/lib/support/string_windows.h',
|
||||
|
|
@ -646,6 +647,7 @@ Pod::Spec.new do |s|
|
|||
'src/core/lib/http/httpcli.h',
|
||||
'src/core/lib/http/parser.h',
|
||||
'src/core/lib/iomgr/closure.h',
|
||||
'src/core/lib/iomgr/combiner.h',
|
||||
'src/core/lib/iomgr/endpoint.h',
|
||||
'src/core/lib/iomgr/endpoint_pair.h',
|
||||
'src/core/lib/iomgr/error.h',
|
||||
|
|
@ -764,7 +766,6 @@ Pod::Spec.new do |s|
|
|||
'src/core/lib/tsi/transport_security_interface.h',
|
||||
'src/core/ext/client_config/client_channel.h',
|
||||
'src/core/ext/client_config/client_channel_factory.h',
|
||||
'src/core/ext/client_config/client_config.h',
|
||||
'src/core/ext/client_config/connector.h',
|
||||
'src/core/ext/client_config/initial_connect_string.h',
|
||||
'src/core/ext/client_config/lb_policy.h',
|
||||
|
|
@ -774,8 +775,8 @@ Pod::Spec.new do |s|
|
|||
'src/core/ext/client_config/resolver.h',
|
||||
'src/core/ext/client_config/resolver_factory.h',
|
||||
'src/core/ext/client_config/resolver_registry.h',
|
||||
'src/core/ext/client_config/resolver_result.h',
|
||||
'src/core/ext/client_config/subchannel.h',
|
||||
'src/core/ext/client_config/subchannel_call_holder.h',
|
||||
'src/core/ext/client_config/subchannel_index.h',
|
||||
'src/core/ext/client_config/uri_parser.h',
|
||||
'src/core/ext/lb_policy/grpclb/grpclb.h',
|
||||
|
|
@ -792,6 +793,7 @@ Pod::Spec.new do |s|
|
|||
'src/core/ext/census/census_interface.h',
|
||||
'src/core/ext/census/census_rpc_stats.h',
|
||||
'src/core/ext/census/gen/census.pb.h',
|
||||
'src/core/ext/census/gen/trace_context.pb.h',
|
||||
'src/core/ext/census/grpc_filter.h',
|
||||
'src/core/ext/census/mlog.h',
|
||||
'src/core/ext/census/resource.h',
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'gRPC-ProtoRPC'
|
||||
version = '1.0.0-pre1'
|
||||
version = '1.0.0'
|
||||
s.version = version
|
||||
s.summary = 'RPC library for Protocol Buffers, based on gRPC'
|
||||
s.homepage = 'http://www.grpc.io'
|
||||
|
|
@ -39,7 +39,7 @@ Pod::Spec.new do |s|
|
|||
|
||||
s.source = {
|
||||
:git => 'https://github.com/grpc/grpc.git',
|
||||
:tag => "objective-c-v#{version}",
|
||||
:tag => "v#{version}",
|
||||
}
|
||||
|
||||
s.ios.deployment_target = '7.1'
|
||||
|
|
@ -56,8 +56,10 @@ Pod::Spec.new do |s|
|
|||
s.dependency 'gRPC', version
|
||||
s.dependency 'gRPC-RxLibrary', version
|
||||
s.dependency 'Protobuf', '~> 3.0'
|
||||
# This is needed by all pods that depend on Protobuf:
|
||||
s.pod_target_xcconfig = {
|
||||
# This is needed by all pods that depend on Protobuf:
|
||||
'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1',
|
||||
# This is needed by all pods that depend on gRPC-RxLibrary:
|
||||
'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES',
|
||||
}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'gRPC-RxLibrary'
|
||||
version = '1.0.0-pre1'
|
||||
version = '1.0.0'
|
||||
s.version = version
|
||||
s.summary = 'Reactive Extensions library for iOS/OSX.'
|
||||
s.homepage = 'http://www.grpc.io'
|
||||
|
|
@ -39,7 +39,7 @@ Pod::Spec.new do |s|
|
|||
|
||||
s.source = {
|
||||
:git => 'https://github.com/grpc/grpc.git',
|
||||
:tag => "objective-c-v#{version}",
|
||||
:tag => "v#{version}",
|
||||
}
|
||||
|
||||
s.ios.deployment_target = '7.1'
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'gRPC'
|
||||
version = '1.0.0-pre1'
|
||||
version = '1.0.0'
|
||||
s.version = version
|
||||
s.summary = 'gRPC client library for iOS/OSX'
|
||||
s.homepage = 'http://www.grpc.io'
|
||||
|
|
@ -39,7 +39,7 @@ Pod::Spec.new do |s|
|
|||
|
||||
s.source = {
|
||||
:git => 'https://github.com/grpc/grpc.git',
|
||||
:tag => "objective-c-v#{version}",
|
||||
:tag => "v#{version}",
|
||||
}
|
||||
|
||||
s.ios.deployment_target = '7.1'
|
||||
|
|
@ -59,4 +59,9 @@ Pod::Spec.new do |s|
|
|||
|
||||
# Certificates, to be able to establish TLS connections:
|
||||
s.resource_bundles = { 'gRPCCertificates' => ['etc/roots.pem'] }
|
||||
|
||||
s.pod_target_xcconfig = {
|
||||
# This is needed by all pods that depend on gRPC-RxLibrary:
|
||||
'CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES' => 'YES',
|
||||
}
|
||||
end
|
||||
|
|
|
|||
177
grpc.def
177
grpc.def
|
|
@ -1,4 +1,14 @@
|
|||
EXPORTS
|
||||
grpc_raw_byte_buffer_create
|
||||
grpc_raw_compressed_byte_buffer_create
|
||||
grpc_byte_buffer_copy
|
||||
grpc_byte_buffer_length
|
||||
grpc_byte_buffer_destroy
|
||||
grpc_byte_buffer_reader_init
|
||||
grpc_byte_buffer_reader_destroy
|
||||
grpc_byte_buffer_reader_next
|
||||
grpc_byte_buffer_reader_readall
|
||||
grpc_raw_byte_buffer_from_reader
|
||||
census_initialize
|
||||
census_shutdown
|
||||
census_supported
|
||||
|
|
@ -42,6 +52,7 @@ EXPORTS
|
|||
grpc_init
|
||||
grpc_shutdown
|
||||
grpc_version_string
|
||||
grpc_g_stands_for
|
||||
grpc_completion_queue_create
|
||||
grpc_completion_queue_next
|
||||
grpc_completion_queue_pluck
|
||||
|
|
@ -125,94 +136,6 @@ EXPORTS
|
|||
gpr_free_aligned
|
||||
gpr_set_allocation_functions
|
||||
gpr_get_allocation_functions
|
||||
grpc_raw_byte_buffer_create
|
||||
grpc_raw_compressed_byte_buffer_create
|
||||
grpc_byte_buffer_copy
|
||||
grpc_byte_buffer_length
|
||||
grpc_byte_buffer_destroy
|
||||
grpc_byte_buffer_reader_init
|
||||
grpc_byte_buffer_reader_destroy
|
||||
grpc_byte_buffer_reader_next
|
||||
grpc_byte_buffer_reader_readall
|
||||
grpc_raw_byte_buffer_from_reader
|
||||
gpr_log
|
||||
gpr_log_message
|
||||
gpr_set_log_verbosity
|
||||
gpr_log_verbosity_init
|
||||
gpr_set_log_function
|
||||
gpr_slice_ref
|
||||
gpr_slice_unref
|
||||
gpr_slice_new
|
||||
gpr_slice_new_with_user_data
|
||||
gpr_slice_new_with_len
|
||||
gpr_slice_malloc
|
||||
gpr_slice_from_copied_string
|
||||
gpr_slice_from_copied_buffer
|
||||
gpr_slice_from_static_string
|
||||
gpr_slice_sub
|
||||
gpr_slice_sub_no_ref
|
||||
gpr_slice_split_tail
|
||||
gpr_slice_split_head
|
||||
gpr_empty_slice
|
||||
gpr_slice_cmp
|
||||
gpr_slice_str_cmp
|
||||
gpr_slice_buffer_init
|
||||
gpr_slice_buffer_destroy
|
||||
gpr_slice_buffer_add
|
||||
gpr_slice_buffer_add_indexed
|
||||
gpr_slice_buffer_addn
|
||||
gpr_slice_buffer_tiny_add
|
||||
gpr_slice_buffer_pop
|
||||
gpr_slice_buffer_reset_and_unref
|
||||
gpr_slice_buffer_swap
|
||||
gpr_slice_buffer_move_into
|
||||
gpr_slice_buffer_trim_end
|
||||
gpr_slice_buffer_move_first
|
||||
gpr_slice_buffer_take_first
|
||||
gpr_mu_init
|
||||
gpr_mu_destroy
|
||||
gpr_mu_lock
|
||||
gpr_mu_unlock
|
||||
gpr_mu_trylock
|
||||
gpr_cv_init
|
||||
gpr_cv_destroy
|
||||
gpr_cv_wait
|
||||
gpr_cv_signal
|
||||
gpr_cv_broadcast
|
||||
gpr_once_init
|
||||
gpr_event_init
|
||||
gpr_event_set
|
||||
gpr_event_get
|
||||
gpr_event_wait
|
||||
gpr_ref_init
|
||||
gpr_ref
|
||||
gpr_ref_non_zero
|
||||
gpr_refn
|
||||
gpr_unref
|
||||
gpr_stats_init
|
||||
gpr_stats_inc
|
||||
gpr_stats_read
|
||||
gpr_time_0
|
||||
gpr_inf_future
|
||||
gpr_inf_past
|
||||
gpr_time_init
|
||||
gpr_now
|
||||
gpr_convert_clock_type
|
||||
gpr_time_cmp
|
||||
gpr_time_max
|
||||
gpr_time_min
|
||||
gpr_time_add
|
||||
gpr_time_sub
|
||||
gpr_time_from_micros
|
||||
gpr_time_from_nanos
|
||||
gpr_time_from_millis
|
||||
gpr_time_from_seconds
|
||||
gpr_time_from_minutes
|
||||
gpr_time_from_hours
|
||||
gpr_time_to_millis
|
||||
gpr_time_similar
|
||||
gpr_sleep_until
|
||||
gpr_timespec_to_micros
|
||||
gpr_avl_create
|
||||
gpr_avl_ref
|
||||
gpr_avl_unref
|
||||
|
|
@ -249,7 +172,41 @@ EXPORTS
|
|||
gpr_histogram_merge_contents
|
||||
gpr_join_host_port
|
||||
gpr_split_host_port
|
||||
gpr_log
|
||||
gpr_log_message
|
||||
gpr_set_log_verbosity
|
||||
gpr_log_verbosity_init
|
||||
gpr_set_log_function
|
||||
gpr_format_message
|
||||
gpr_slice_ref
|
||||
gpr_slice_unref
|
||||
gpr_slice_new
|
||||
gpr_slice_new_with_user_data
|
||||
gpr_slice_new_with_len
|
||||
gpr_slice_malloc
|
||||
gpr_slice_from_copied_string
|
||||
gpr_slice_from_copied_buffer
|
||||
gpr_slice_from_static_string
|
||||
gpr_slice_sub
|
||||
gpr_slice_sub_no_ref
|
||||
gpr_slice_split_tail
|
||||
gpr_slice_split_head
|
||||
gpr_empty_slice
|
||||
gpr_slice_cmp
|
||||
gpr_slice_str_cmp
|
||||
gpr_slice_buffer_init
|
||||
gpr_slice_buffer_destroy
|
||||
gpr_slice_buffer_add
|
||||
gpr_slice_buffer_add_indexed
|
||||
gpr_slice_buffer_addn
|
||||
gpr_slice_buffer_tiny_add
|
||||
gpr_slice_buffer_pop
|
||||
gpr_slice_buffer_reset_and_unref
|
||||
gpr_slice_buffer_swap
|
||||
gpr_slice_buffer_move_into
|
||||
gpr_slice_buffer_trim_end
|
||||
gpr_slice_buffer_move_first
|
||||
gpr_slice_buffer_take_first
|
||||
gpr_strdup
|
||||
gpr_asprintf
|
||||
gpr_subprocess_binary_extension
|
||||
|
|
@ -257,6 +214,29 @@ EXPORTS
|
|||
gpr_subprocess_destroy
|
||||
gpr_subprocess_join
|
||||
gpr_subprocess_interrupt
|
||||
gpr_mu_init
|
||||
gpr_mu_destroy
|
||||
gpr_mu_lock
|
||||
gpr_mu_unlock
|
||||
gpr_mu_trylock
|
||||
gpr_cv_init
|
||||
gpr_cv_destroy
|
||||
gpr_cv_wait
|
||||
gpr_cv_signal
|
||||
gpr_cv_broadcast
|
||||
gpr_once_init
|
||||
gpr_event_init
|
||||
gpr_event_set
|
||||
gpr_event_get
|
||||
gpr_event_wait
|
||||
gpr_ref_init
|
||||
gpr_ref
|
||||
gpr_ref_non_zero
|
||||
gpr_refn
|
||||
gpr_unref
|
||||
gpr_stats_init
|
||||
gpr_stats_inc
|
||||
gpr_stats_read
|
||||
gpr_thd_new
|
||||
gpr_thd_options_default
|
||||
gpr_thd_options_set_detached
|
||||
|
|
@ -265,3 +245,24 @@ EXPORTS
|
|||
gpr_thd_options_is_joinable
|
||||
gpr_thd_currentid
|
||||
gpr_thd_join
|
||||
gpr_time_0
|
||||
gpr_inf_future
|
||||
gpr_inf_past
|
||||
gpr_time_init
|
||||
gpr_now
|
||||
gpr_convert_clock_type
|
||||
gpr_time_cmp
|
||||
gpr_time_max
|
||||
gpr_time_min
|
||||
gpr_time_add
|
||||
gpr_time_sub
|
||||
gpr_time_from_micros
|
||||
gpr_time_from_nanos
|
||||
gpr_time_from_millis
|
||||
gpr_time_from_seconds
|
||||
gpr_time_from_minutes
|
||||
gpr_time_from_hours
|
||||
gpr_time_to_millis
|
||||
gpr_time_similar
|
||||
gpr_sleep_until
|
||||
gpr_timespec_to_micros
|
||||
|
|
|
|||
28
grpc.gemspec
28
grpc.gemspec
|
|
@ -29,6 +29,7 @@ Gem::Specification.new do |s|
|
|||
|
||||
s.add_dependency 'google-protobuf', '~> 3.0'
|
||||
s.add_dependency 'googleauth', '~> 0.5.1'
|
||||
s.add_dependency 'concurrent-ruby'
|
||||
|
||||
s.add_development_dependency 'bundler', '~> 1.9'
|
||||
s.add_development_dependency 'facter', '~> 2.4'
|
||||
|
|
@ -71,25 +72,24 @@ Gem::Specification.new do |s|
|
|||
s.files += %w( include/grpc/support/tls_msvc.h )
|
||||
s.files += %w( include/grpc/support/tls_pthread.h )
|
||||
s.files += %w( include/grpc/support/useful.h )
|
||||
s.files += %w( include/grpc/impl/codegen/alloc.h )
|
||||
s.files += %w( include/grpc/impl/codegen/atm.h )
|
||||
s.files += %w( include/grpc/impl/codegen/atm_gcc_atomic.h )
|
||||
s.files += %w( include/grpc/impl/codegen/atm_gcc_sync.h )
|
||||
s.files += %w( include/grpc/impl/codegen/atm_windows.h )
|
||||
s.files += %w( include/grpc/impl/codegen/log.h )
|
||||
s.files += %w( include/grpc/impl/codegen/gpr_types.h )
|
||||
s.files += %w( include/grpc/impl/codegen/port_platform.h )
|
||||
s.files += %w( include/grpc/impl/codegen/slice.h )
|
||||
s.files += %w( include/grpc/impl/codegen/slice_buffer.h )
|
||||
s.files += %w( include/grpc/impl/codegen/sync.h )
|
||||
s.files += %w( include/grpc/impl/codegen/sync_generic.h )
|
||||
s.files += %w( include/grpc/impl/codegen/sync_posix.h )
|
||||
s.files += %w( include/grpc/impl/codegen/sync_windows.h )
|
||||
s.files += %w( include/grpc/impl/codegen/time.h )
|
||||
s.files += %w( src/core/lib/profiling/timers.h )
|
||||
s.files += %w( src/core/lib/support/backoff.h )
|
||||
s.files += %w( src/core/lib/support/block_annotate.h )
|
||||
s.files += %w( src/core/lib/support/env.h )
|
||||
s.files += %w( src/core/lib/support/mpscq.h )
|
||||
s.files += %w( src/core/lib/support/murmur_hash.h )
|
||||
s.files += %w( src/core/lib/support/percent_encoding.h )
|
||||
s.files += %w( src/core/lib/support/stack_lockfree.h )
|
||||
s.files += %w( src/core/lib/support/string.h )
|
||||
s.files += %w( src/core/lib/support/string_windows.h )
|
||||
|
|
@ -116,7 +116,9 @@ Gem::Specification.new do |s|
|
|||
s.files += %w( src/core/lib/support/log_linux.c )
|
||||
s.files += %w( src/core/lib/support/log_posix.c )
|
||||
s.files += %w( src/core/lib/support/log_windows.c )
|
||||
s.files += %w( src/core/lib/support/mpscq.c )
|
||||
s.files += %w( src/core/lib/support/murmur_hash.c )
|
||||
s.files += %w( src/core/lib/support/percent_encoding.c )
|
||||
s.files += %w( src/core/lib/support/slice.c )
|
||||
s.files += %w( src/core/lib/support/slice_buffer.c )
|
||||
s.files += %w( src/core/lib/support/stack_lockfree.c )
|
||||
|
|
@ -146,30 +148,26 @@ Gem::Specification.new do |s|
|
|||
s.files += %w( include/grpc/compression.h )
|
||||
s.files += %w( include/grpc/grpc.h )
|
||||
s.files += %w( include/grpc/grpc_posix.h )
|
||||
s.files += %w( include/grpc/grpc_security_constants.h )
|
||||
s.files += %w( include/grpc/status.h )
|
||||
s.files += %w( include/grpc/impl/codegen/byte_buffer.h )
|
||||
s.files += %w( include/grpc/impl/codegen/byte_buffer_reader.h )
|
||||
s.files += %w( include/grpc/impl/codegen/compression_types.h )
|
||||
s.files += %w( include/grpc/impl/codegen/connectivity_state.h )
|
||||
s.files += %w( include/grpc/impl/codegen/grpc_types.h )
|
||||
s.files += %w( include/grpc/impl/codegen/propagation_bits.h )
|
||||
s.files += %w( include/grpc/impl/codegen/status.h )
|
||||
s.files += %w( include/grpc/impl/codegen/alloc.h )
|
||||
s.files += %w( include/grpc/impl/codegen/atm.h )
|
||||
s.files += %w( include/grpc/impl/codegen/atm_gcc_atomic.h )
|
||||
s.files += %w( include/grpc/impl/codegen/atm_gcc_sync.h )
|
||||
s.files += %w( include/grpc/impl/codegen/atm_windows.h )
|
||||
s.files += %w( include/grpc/impl/codegen/log.h )
|
||||
s.files += %w( include/grpc/impl/codegen/gpr_types.h )
|
||||
s.files += %w( include/grpc/impl/codegen/port_platform.h )
|
||||
s.files += %w( include/grpc/impl/codegen/slice.h )
|
||||
s.files += %w( include/grpc/impl/codegen/slice_buffer.h )
|
||||
s.files += %w( include/grpc/impl/codegen/sync.h )
|
||||
s.files += %w( include/grpc/impl/codegen/sync_generic.h )
|
||||
s.files += %w( include/grpc/impl/codegen/sync_posix.h )
|
||||
s.files += %w( include/grpc/impl/codegen/sync_windows.h )
|
||||
s.files += %w( include/grpc/impl/codegen/time.h )
|
||||
s.files += %w( include/grpc/grpc_security.h )
|
||||
s.files += %w( include/grpc/grpc_security_constants.h )
|
||||
s.files += %w( include/grpc/census.h )
|
||||
s.files += %w( src/core/lib/channel/channel_args.h )
|
||||
s.files += %w( src/core/lib/channel/channel_stack.h )
|
||||
|
|
@ -187,6 +185,7 @@ Gem::Specification.new do |s|
|
|||
s.files += %w( src/core/lib/http/httpcli.h )
|
||||
s.files += %w( src/core/lib/http/parser.h )
|
||||
s.files += %w( src/core/lib/iomgr/closure.h )
|
||||
s.files += %w( src/core/lib/iomgr/combiner.h )
|
||||
s.files += %w( src/core/lib/iomgr/endpoint.h )
|
||||
s.files += %w( src/core/lib/iomgr/endpoint_pair.h )
|
||||
s.files += %w( src/core/lib/iomgr/error.h )
|
||||
|
|
@ -305,7 +304,6 @@ Gem::Specification.new do |s|
|
|||
s.files += %w( src/core/lib/tsi/transport_security_interface.h )
|
||||
s.files += %w( src/core/ext/client_config/client_channel.h )
|
||||
s.files += %w( src/core/ext/client_config/client_channel_factory.h )
|
||||
s.files += %w( src/core/ext/client_config/client_config.h )
|
||||
s.files += %w( src/core/ext/client_config/connector.h )
|
||||
s.files += %w( src/core/ext/client_config/initial_connect_string.h )
|
||||
s.files += %w( src/core/ext/client_config/lb_policy.h )
|
||||
|
|
@ -315,8 +313,8 @@ Gem::Specification.new do |s|
|
|||
s.files += %w( src/core/ext/client_config/resolver.h )
|
||||
s.files += %w( src/core/ext/client_config/resolver_factory.h )
|
||||
s.files += %w( src/core/ext/client_config/resolver_registry.h )
|
||||
s.files += %w( src/core/ext/client_config/resolver_result.h )
|
||||
s.files += %w( src/core/ext/client_config/subchannel.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/uri_parser.h )
|
||||
s.files += %w( src/core/ext/lb_policy/grpclb/grpclb.h )
|
||||
|
|
@ -333,6 +331,7 @@ Gem::Specification.new do |s|
|
|||
s.files += %w( src/core/ext/census/census_interface.h )
|
||||
s.files += %w( src/core/ext/census/census_rpc_stats.h )
|
||||
s.files += %w( src/core/ext/census/gen/census.pb.h )
|
||||
s.files += %w( src/core/ext/census/gen/trace_context.pb.h )
|
||||
s.files += %w( src/core/ext/census/grpc_filter.h )
|
||||
s.files += %w( src/core/ext/census/mlog.h )
|
||||
s.files += %w( src/core/ext/census/resource.h )
|
||||
|
|
@ -353,6 +352,7 @@ Gem::Specification.new do |s|
|
|||
s.files += %w( src/core/lib/http/httpcli.c )
|
||||
s.files += %w( src/core/lib/http/parser.c )
|
||||
s.files += %w( src/core/lib/iomgr/closure.c )
|
||||
s.files += %w( src/core/lib/iomgr/combiner.c )
|
||||
s.files += %w( src/core/lib/iomgr/endpoint.c )
|
||||
s.files += %w( src/core/lib/iomgr/endpoint_pair_posix.c )
|
||||
s.files += %w( src/core/lib/iomgr/endpoint_pair_windows.c )
|
||||
|
|
@ -492,7 +492,6 @@ Gem::Specification.new do |s|
|
|||
s.files += %w( src/core/ext/client_config/channel_connectivity.c )
|
||||
s.files += %w( src/core/ext/client_config/client_channel.c )
|
||||
s.files += %w( src/core/ext/client_config/client_channel_factory.c )
|
||||
s.files += %w( src/core/ext/client_config/client_config.c )
|
||||
s.files += %w( src/core/ext/client_config/client_config_plugin.c )
|
||||
s.files += %w( src/core/ext/client_config/connector.c )
|
||||
s.files += %w( src/core/ext/client_config/default_initial_connect_string.c )
|
||||
|
|
@ -504,8 +503,8 @@ Gem::Specification.new do |s|
|
|||
s.files += %w( src/core/ext/client_config/resolver.c )
|
||||
s.files += %w( src/core/ext/client_config/resolver_factory.c )
|
||||
s.files += %w( src/core/ext/client_config/resolver_registry.c )
|
||||
s.files += %w( src/core/ext/client_config/resolver_result.c )
|
||||
s.files += %w( src/core/ext/client_config/subchannel.c )
|
||||
s.files += %w( src/core/ext/client_config/subchannel_call_holder.c )
|
||||
s.files += %w( src/core/ext/client_config/subchannel_index.c )
|
||||
s.files += %w( src/core/ext/client_config/uri_parser.c )
|
||||
s.files += %w( src/core/ext/transport/chttp2/server/insecure/server_chttp2.c )
|
||||
|
|
@ -527,6 +526,7 @@ Gem::Specification.new do |s|
|
|||
s.files += %w( src/core/ext/census/base_resources.c )
|
||||
s.files += %w( src/core/ext/census/context.c )
|
||||
s.files += %w( src/core/ext/census/gen/census.pb.c )
|
||||
s.files += %w( src/core/ext/census/gen/trace_context.pb.c )
|
||||
s.files += %w( src/core/ext/census/grpc_context.c )
|
||||
s.files += %w( src/core/ext/census/grpc_filter.c )
|
||||
s.files += %w( src/core/ext/census/grpc_plugin.c )
|
||||
|
|
|
|||
|
|
@ -48,7 +48,6 @@ namespace grpc {
|
|||
/// \param target The URI of the endpoint to connect to.
|
||||
/// \param creds Credentials to use for the created channel. If it does not hold
|
||||
/// an object or is invalid, a lame channel is returned.
|
||||
/// \param args Options for channel creation.
|
||||
std::shared_ptr<Channel> CreateChannel(
|
||||
const grpc::string& target,
|
||||
const std::shared_ptr<ChannelCredentials>& creds);
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@
|
|||
|
||||
#include <grpc++/impl/codegen/async_stream.h>
|
||||
#include <grpc++/impl/codegen/async_unary_call.h>
|
||||
#include <grpc++/impl/codegen/method_handler_impl.h>
|
||||
#include <grpc++/impl/codegen/proto_utils.h>
|
||||
#include <grpc++/impl/codegen/rpc_method.h>
|
||||
#include <grpc++/impl/codegen/service_type.h>
|
||||
|
|
@ -174,6 +175,7 @@ class ServerReflection GRPC_FINAL {
|
|||
return ::grpc::Status(::grpc::StatusCode::UNIMPLEMENTED, "");
|
||||
}
|
||||
};
|
||||
typedef Service StreamedUnaryService;
|
||||
};
|
||||
|
||||
} // namespace v1alpha
|
||||
|
|
|
|||
|
|
@ -51,6 +51,9 @@
|
|||
#ifndef GRPCXX_GRPCXX_H
|
||||
#define GRPCXX_GRPCXX_H
|
||||
|
||||
// Pragma for http://include-what-you-use.org/ tool, tells that following
|
||||
// headers are not private for grpc++.h and are part of its interface.
|
||||
// IWYU pragma: begin_exports
|
||||
#include <grpc/grpc.h>
|
||||
|
||||
#include <grpc++/channel.h>
|
||||
|
|
@ -62,5 +65,6 @@
|
|||
#include <grpc++/server_builder.h>
|
||||
#include <grpc++/server_context.h>
|
||||
#include <grpc++/server_posix.h>
|
||||
// IWYU pragma: end_exports
|
||||
|
||||
#endif // GRPCXX_GRPCXX_H
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@
|
|||
#include <grpc++/impl/codegen/server_context.h>
|
||||
#include <grpc++/impl/codegen/service_type.h>
|
||||
#include <grpc++/impl/codegen/status.h>
|
||||
#include <grpc/impl/codegen/log.h>
|
||||
|
||||
namespace grpc {
|
||||
|
||||
|
|
|
|||
|
|
@ -46,9 +46,9 @@
|
|||
#include <grpc++/impl/codegen/core_codegen_interface.h>
|
||||
#include <grpc++/impl/codegen/serialization_traits.h>
|
||||
#include <grpc++/impl/codegen/status.h>
|
||||
#include <grpc++/impl/codegen/status_helper.h>
|
||||
#include <grpc++/impl/codegen/string_ref.h>
|
||||
|
||||
#include <grpc/impl/codegen/alloc.h>
|
||||
#include <grpc/impl/codegen/compression_types.h>
|
||||
#include <grpc/impl/codegen/grpc_types.h>
|
||||
|
||||
|
|
@ -434,7 +434,7 @@ class CallOpServerSendStatus {
|
|||
trailing_metadata_count_ = trailing_metadata.size();
|
||||
trailing_metadata_ = FillMetadataArray(trailing_metadata);
|
||||
send_status_available_ = true;
|
||||
send_status_code_ = static_cast<grpc_status_code>(status.error_code());
|
||||
send_status_code_ = static_cast<grpc_status_code>(GetCanonicalCode(status));
|
||||
send_status_details_ = status.error_message();
|
||||
}
|
||||
|
||||
|
|
@ -662,10 +662,10 @@ class Call GRPC_FINAL {
|
|||
call_hook_->PerformOpsOnCall(ops, this);
|
||||
}
|
||||
|
||||
grpc_call* call() { return call_; }
|
||||
CompletionQueue* cq() { return cq_; }
|
||||
grpc_call* call() const { return call_; }
|
||||
CompletionQueue* cq() const { return cq_; }
|
||||
|
||||
int max_message_size() { return max_message_size_; }
|
||||
int max_message_size() const { return max_message_size_; }
|
||||
|
||||
private:
|
||||
CallHook* call_hook_;
|
||||
|
|
|
|||
|
|
@ -62,9 +62,7 @@
|
|||
#include <grpc++/impl/codegen/sync.h>
|
||||
#include <grpc++/impl/codegen/time.h>
|
||||
#include <grpc/impl/codegen/compression_types.h>
|
||||
#include <grpc/impl/codegen/log.h>
|
||||
#include <grpc/impl/codegen/propagation_bits.h>
|
||||
#include <grpc/impl/codegen/time.h>
|
||||
|
||||
struct census_context;
|
||||
struct grpc_call;
|
||||
|
|
@ -225,6 +223,9 @@ class ClientContext {
|
|||
/// EXPERIMENTAL: Set this request to be idempotent
|
||||
void set_idempotent(bool idempotent) { idempotent_ = idempotent; }
|
||||
|
||||
/// EXPERIMENTAL: Set this request to be cacheable
|
||||
void set_cacheable(bool cacheable) { cacheable_ = cacheable; }
|
||||
|
||||
/// EXPERIMENTAL: Trigger fail-fast or not on this request
|
||||
void set_fail_fast(bool fail_fast) { fail_fast_ = fail_fast; }
|
||||
|
||||
|
|
@ -271,7 +272,7 @@ class ClientContext {
|
|||
|
||||
/// Set \a algorithm to be the compression algorithm used for the client call.
|
||||
///
|
||||
/// \param algorith The compression algorithm used for the client call.
|
||||
/// \param algorithm The compression algorithm used for the client call.
|
||||
void set_compression_algorithm(grpc_compression_algorithm algorithm);
|
||||
|
||||
/// Return the peer uri in a string.
|
||||
|
|
@ -307,6 +308,10 @@ class ClientContext {
|
|||
};
|
||||
static void SetGlobalCallbacks(GlobalCallbacks* callbacks);
|
||||
|
||||
// Should be used for framework-level extensions only.
|
||||
// Applications never need to call this method.
|
||||
grpc_call* c_call() { return call_; }
|
||||
|
||||
private:
|
||||
// Disallow copy and assign.
|
||||
ClientContext(const ClientContext&);
|
||||
|
|
@ -342,7 +347,8 @@ class ClientContext {
|
|||
|
||||
uint32_t initial_metadata_flags() const {
|
||||
return (idempotent_ ? GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST : 0) |
|
||||
(fail_fast_ ? 0 : GRPC_INITIAL_METADATA_IGNORE_CONNECTIVITY);
|
||||
(fail_fast_ ? 0 : GRPC_INITIAL_METADATA_IGNORE_CONNECTIVITY) |
|
||||
(cacheable_ ? GRPC_INITIAL_METADATA_CACHEABLE_REQUEST : 0);
|
||||
}
|
||||
|
||||
grpc::string authority() { return authority_; }
|
||||
|
|
@ -350,6 +356,7 @@ class ClientContext {
|
|||
bool initial_metadata_received_;
|
||||
bool fail_fast_;
|
||||
bool idempotent_;
|
||||
bool cacheable_;
|
||||
std::shared_ptr<Channel> channel_;
|
||||
grpc::mutex mu_;
|
||||
grpc_call* call_;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@
|
|||
#include <grpc++/impl/codegen/grpc_library.h>
|
||||
#include <grpc++/impl/codegen/status.h>
|
||||
#include <grpc++/impl/codegen/time.h>
|
||||
#include <grpc/impl/codegen/time.h>
|
||||
|
||||
struct grpc_completion_queue;
|
||||
|
||||
|
|
@ -68,8 +67,10 @@ template <class R>
|
|||
class ServerReader;
|
||||
template <class W>
|
||||
class ServerWriter;
|
||||
namespace internal {
|
||||
template <class W, class R>
|
||||
class ServerReaderWriter;
|
||||
class ServerReaderWriterBody;
|
||||
}
|
||||
template <class ServiceType, class RequestType, class ResponseType>
|
||||
class RpcMethodHandler;
|
||||
template <class ServiceType, class RequestType, class ResponseType>
|
||||
|
|
@ -178,15 +179,15 @@ class CompletionQueue : private GrpcLibraryCodegen {
|
|||
template <class W>
|
||||
friend class ::grpc::ServerWriter;
|
||||
template <class W, class R>
|
||||
friend class ::grpc::ServerReaderWriter;
|
||||
friend class ::grpc::internal::ServerReaderWriterBody;
|
||||
template <class ServiceType, class RequestType, class ResponseType>
|
||||
friend class RpcMethodHandler;
|
||||
template <class ServiceType, class RequestType, class ResponseType>
|
||||
friend class ClientStreamingHandler;
|
||||
template <class ServiceType, class RequestType, class ResponseType>
|
||||
friend class ServerStreamingHandler;
|
||||
template <class ServiceType, class RequestType, class ResponseType>
|
||||
friend class BidiStreamingHandler;
|
||||
template <class Streamer, bool WriteNeeded>
|
||||
friend class TemplatedBidiStreamingHandler;
|
||||
friend class UnknownMethodHandler;
|
||||
friend class ::grpc::Server;
|
||||
friend class ::grpc::ServerContext;
|
||||
|
|
@ -217,7 +218,7 @@ class CompletionQueue : private GrpcLibraryCodegen {
|
|||
/// Performs a single polling pluck on \a tag.
|
||||
/// \warning Must not be mixed with calls to \a Next.
|
||||
void TryPluck(CompletionQueueTag* tag) {
|
||||
auto deadline = gpr_time_0(GPR_CLOCK_REALTIME);
|
||||
auto deadline = g_core_codegen_interface->gpr_time_0(GPR_CLOCK_REALTIME);
|
||||
auto ev = g_core_codegen_interface->grpc_completion_queue_pluck(
|
||||
cq_, tag, deadline, nullptr);
|
||||
if (ev.type == GRPC_QUEUE_TIMEOUT) return;
|
||||
|
|
|
|||
|
|
@ -55,6 +55,17 @@ class CoreCodegen : public CoreCodegenInterface {
|
|||
void* gpr_malloc(size_t size) GRPC_OVERRIDE;
|
||||
void gpr_free(void* p) GRPC_OVERRIDE;
|
||||
|
||||
void gpr_mu_init(gpr_mu* mu) GRPC_OVERRIDE;
|
||||
void gpr_mu_destroy(gpr_mu* mu) GRPC_OVERRIDE;
|
||||
void gpr_mu_lock(gpr_mu* mu) GRPC_OVERRIDE;
|
||||
void gpr_mu_unlock(gpr_mu* mu) GRPC_OVERRIDE;
|
||||
void gpr_cv_init(gpr_cv* cv) GRPC_OVERRIDE;
|
||||
void gpr_cv_destroy(gpr_cv* cv) GRPC_OVERRIDE;
|
||||
int gpr_cv_wait(gpr_cv* cv, gpr_mu* mu,
|
||||
gpr_timespec abs_deadline) GRPC_OVERRIDE;
|
||||
void gpr_cv_signal(gpr_cv* cv) GRPC_OVERRIDE;
|
||||
void gpr_cv_broadcast(gpr_cv* cv) GRPC_OVERRIDE;
|
||||
|
||||
void grpc_byte_buffer_destroy(grpc_byte_buffer* bb) GRPC_OVERRIDE;
|
||||
|
||||
int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader* reader,
|
||||
|
|
@ -78,6 +89,7 @@ class CoreCodegen : public CoreCodegenInterface {
|
|||
void grpc_metadata_array_destroy(grpc_metadata_array* array) GRPC_OVERRIDE;
|
||||
|
||||
gpr_timespec gpr_inf_future(gpr_clock_type type) GRPC_OVERRIDE;
|
||||
gpr_timespec gpr_time_0(gpr_clock_type type) GRPC_OVERRIDE;
|
||||
|
||||
virtual const Status& ok() GRPC_OVERRIDE;
|
||||
virtual const Status& cancelled() GRPC_OVERRIDE;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,13 @@
|
|||
|
||||
#include <grpc++/impl/codegen/config.h>
|
||||
#include <grpc++/impl/codegen/status.h>
|
||||
#include <grpc/impl/codegen/byte_buffer_reader.h>
|
||||
#include <grpc/impl/codegen/grpc_types.h>
|
||||
#include <grpc/impl/codegen/sync.h>
|
||||
|
||||
extern "C" {
|
||||
struct grpc_byte_buffer;
|
||||
}
|
||||
|
||||
namespace grpc {
|
||||
|
||||
|
|
@ -63,6 +69,17 @@ class CoreCodegenInterface {
|
|||
virtual void* gpr_malloc(size_t size) = 0;
|
||||
virtual void gpr_free(void* p) = 0;
|
||||
|
||||
virtual void gpr_mu_init(gpr_mu* mu) = 0;
|
||||
virtual void gpr_mu_destroy(gpr_mu* mu) = 0;
|
||||
virtual void gpr_mu_lock(gpr_mu* mu) = 0;
|
||||
virtual void gpr_mu_unlock(gpr_mu* mu) = 0;
|
||||
virtual void gpr_cv_init(gpr_cv* cv) = 0;
|
||||
virtual void gpr_cv_destroy(gpr_cv* cv) = 0;
|
||||
virtual int gpr_cv_wait(gpr_cv* cv, gpr_mu* mu,
|
||||
gpr_timespec abs_deadline) = 0;
|
||||
virtual void gpr_cv_signal(gpr_cv* cv) = 0;
|
||||
virtual void gpr_cv_broadcast(gpr_cv* cv) = 0;
|
||||
|
||||
virtual void grpc_byte_buffer_destroy(grpc_byte_buffer* bb) = 0;
|
||||
|
||||
virtual int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader* reader,
|
||||
|
|
@ -89,6 +106,7 @@ class CoreCodegenInterface {
|
|||
virtual const Status& cancelled() = 0;
|
||||
|
||||
virtual gpr_timespec gpr_inf_future(gpr_clock_type type) = 0;
|
||||
virtual gpr_timespec gpr_time_0(gpr_clock_type type) = 0;
|
||||
};
|
||||
|
||||
extern CoreCodegenInterface* g_core_codegen_interface;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@
|
|||
#define GRPCXX_IMPL_CODEGEN_GRPC_LIBRARY_H
|
||||
|
||||
#include <grpc++/impl/codegen/core_codegen_interface.h>
|
||||
#include <grpc/impl/codegen/log.h>
|
||||
|
||||
namespace grpc {
|
||||
|
||||
|
|
|
|||
|
|
@ -167,20 +167,22 @@ class ServerStreamingHandler : public MethodHandler {
|
|||
};
|
||||
|
||||
// A wrapper class of an application provided bidi-streaming handler.
|
||||
template <class ServiceType, class RequestType, class ResponseType>
|
||||
class BidiStreamingHandler : public MethodHandler {
|
||||
// This also applies to server-streamed implementation of a unary method
|
||||
// with the additional requirement that such methods must have done a
|
||||
// write for status to be ok
|
||||
// Since this is used by more than 1 class, the service is not passed in.
|
||||
// Instead, it is expected to be an implicitly-captured argument of func
|
||||
// (through bind or something along those lines)
|
||||
template <class Streamer, bool WriteNeeded>
|
||||
class TemplatedBidiStreamingHandler : public MethodHandler {
|
||||
public:
|
||||
BidiStreamingHandler(
|
||||
std::function<Status(ServiceType*, ServerContext*,
|
||||
ServerReaderWriter<ResponseType, RequestType>*)>
|
||||
func,
|
||||
ServiceType* service)
|
||||
: func_(func), service_(service) {}
|
||||
TemplatedBidiStreamingHandler(
|
||||
std::function<Status(ServerContext*, Streamer*)> func)
|
||||
: func_(func), write_needed_(WriteNeeded) {}
|
||||
|
||||
void RunHandler(const HandlerParameter& param) GRPC_FINAL {
|
||||
ServerReaderWriter<ResponseType, RequestType> stream(param.call,
|
||||
param.server_context);
|
||||
Status status = func_(service_, param.server_context, &stream);
|
||||
Streamer stream(param.call, param.server_context);
|
||||
Status status = func_(param.server_context, &stream);
|
||||
|
||||
CallOpSet<CallOpSendInitialMetadata, CallOpServerSendStatus> ops;
|
||||
if (!param.server_context->sent_initial_metadata_) {
|
||||
|
|
@ -189,6 +191,12 @@ class BidiStreamingHandler : public MethodHandler {
|
|||
if (param.server_context->compression_level_set()) {
|
||||
ops.set_compression_level(param.server_context->compression_level());
|
||||
}
|
||||
if (write_needed_ && status.ok()) {
|
||||
// If we needed a write but never did one, we need to mark the
|
||||
// status as a fail
|
||||
status = Status(StatusCode::INTERNAL,
|
||||
"Service did not provide response message");
|
||||
}
|
||||
}
|
||||
ops.ServerSendStatus(param.server_context->trailing_metadata_, status);
|
||||
param.call->PerformOps(&ops);
|
||||
|
|
@ -196,10 +204,36 @@ class BidiStreamingHandler : public MethodHandler {
|
|||
}
|
||||
|
||||
private:
|
||||
std::function<Status(ServiceType*, ServerContext*,
|
||||
ServerReaderWriter<ResponseType, RequestType>*)>
|
||||
func_;
|
||||
ServiceType* service_;
|
||||
std::function<Status(ServerContext*, Streamer*)> func_;
|
||||
const bool write_needed_;
|
||||
};
|
||||
|
||||
template <class ServiceType, class RequestType, class ResponseType>
|
||||
class BidiStreamingHandler
|
||||
: public TemplatedBidiStreamingHandler<
|
||||
ServerReaderWriter<ResponseType, RequestType>, false> {
|
||||
public:
|
||||
BidiStreamingHandler(
|
||||
std::function<Status(ServiceType*, ServerContext*,
|
||||
ServerReaderWriter<ResponseType, RequestType>*)>
|
||||
func,
|
||||
ServiceType* service)
|
||||
: TemplatedBidiStreamingHandler<
|
||||
ServerReaderWriter<ResponseType, RequestType>, false>(std::bind(
|
||||
func, service, std::placeholders::_1, std::placeholders::_2)) {}
|
||||
};
|
||||
|
||||
template <class RequestType, class ResponseType>
|
||||
class StreamedUnaryHandler
|
||||
: public TemplatedBidiStreamingHandler<
|
||||
ServerUnaryStreamer<RequestType, ResponseType>, true> {
|
||||
public:
|
||||
explicit StreamedUnaryHandler(
|
||||
std::function<Status(ServerContext*,
|
||||
ServerUnaryStreamer<RequestType, ResponseType>*)>
|
||||
func)
|
||||
: TemplatedBidiStreamingHandler<
|
||||
ServerUnaryStreamer<RequestType, ResponseType>, true>(func) {}
|
||||
};
|
||||
|
||||
// Handle unknown method by returning UNIMPLEMENTED error.
|
||||
|
|
|
|||
|
|
@ -40,9 +40,8 @@
|
|||
#include <grpc++/impl/codegen/core_codegen_interface.h>
|
||||
#include <grpc++/impl/codegen/serialization_traits.h>
|
||||
#include <grpc++/impl/codegen/status.h>
|
||||
#include <grpc/impl/codegen/byte_buffer.h>
|
||||
#include <grpc/impl/codegen/byte_buffer_reader.h>
|
||||
#include <grpc/impl/codegen/log.h>
|
||||
#include <grpc/impl/codegen/grpc_types.h>
|
||||
#include <grpc/impl/codegen/slice.h>
|
||||
|
||||
namespace grpc {
|
||||
|
|
|
|||
|
|
@ -60,11 +60,12 @@ class RpcMethod {
|
|||
|
||||
const char* name() const { return name_; }
|
||||
RpcType method_type() const { return method_type_; }
|
||||
void SetMethodType(RpcType type) { method_type_ = type; }
|
||||
void* channel_tag() const { return channel_tag_; }
|
||||
|
||||
private:
|
||||
const char* const name_;
|
||||
const RpcType method_type_;
|
||||
RpcType method_type_;
|
||||
void* const channel_tag_;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,10 @@
|
|||
#include <grpc++/impl/codegen/config.h>
|
||||
#include <grpc++/impl/codegen/rpc_method.h>
|
||||
#include <grpc++/impl/codegen/status.h>
|
||||
#include <grpc/impl/codegen/byte_buffer.h>
|
||||
|
||||
extern "C" {
|
||||
struct grpc_byte_buffer;
|
||||
}
|
||||
|
||||
namespace grpc {
|
||||
class ServerContext;
|
||||
|
|
@ -82,6 +85,7 @@ class RpcServiceMethod : public RpcMethod {
|
|||
// if MethodHandler is nullptr, then this is an async method
|
||||
MethodHandler* handler() const { return handler_.get(); }
|
||||
void ResetHandler() { handler_.reset(); }
|
||||
void SetHandler(MethodHandler* handler) { handler_.reset(handler); }
|
||||
|
||||
private:
|
||||
void* server_tag_;
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@
|
|||
#include <grpc++/impl/codegen/string_ref.h>
|
||||
#include <grpc++/impl/codegen/time.h>
|
||||
#include <grpc/impl/codegen/compression_types.h>
|
||||
#include <grpc/impl/codegen/time.h>
|
||||
|
||||
struct gpr_timespec;
|
||||
struct grpc_metadata;
|
||||
|
|
@ -65,8 +64,10 @@ template <class R>
|
|||
class ServerReader;
|
||||
template <class W>
|
||||
class ServerWriter;
|
||||
namespace internal {
|
||||
template <class W, class R>
|
||||
class ServerReaderWriter;
|
||||
class ServerReaderWriterBody;
|
||||
}
|
||||
template <class ServiceType, class RequestType, class ResponseType>
|
||||
class RpcMethodHandler;
|
||||
template <class ServiceType, class RequestType, class ResponseType>
|
||||
|
|
@ -166,6 +167,10 @@ class ServerContext {
|
|||
async_notify_when_done_tag_ = tag;
|
||||
}
|
||||
|
||||
// Should be used for framework-level extensions only.
|
||||
// Applications never need to call this method.
|
||||
grpc_call* c_call() { return call_; }
|
||||
|
||||
private:
|
||||
friend class ::grpc::testing::InteropServerContextInspector;
|
||||
friend class ::grpc::ServerInterface;
|
||||
|
|
@ -183,15 +188,15 @@ class ServerContext {
|
|||
template <class W>
|
||||
friend class ::grpc::ServerWriter;
|
||||
template <class W, class R>
|
||||
friend class ::grpc::ServerReaderWriter;
|
||||
friend class ::grpc::internal::ServerReaderWriterBody;
|
||||
template <class ServiceType, class RequestType, class ResponseType>
|
||||
friend class RpcMethodHandler;
|
||||
template <class ServiceType, class RequestType, class ResponseType>
|
||||
friend class ClientStreamingHandler;
|
||||
template <class ServiceType, class RequestType, class ResponseType>
|
||||
friend class ServerStreamingHandler;
|
||||
template <class ServiceType, class RequestType, class ResponseType>
|
||||
friend class BidiStreamingHandler;
|
||||
template <class Streamer, bool WriteNeeded>
|
||||
friend class TemplatedBidiStreamingHandler;
|
||||
friend class UnknownMethodHandler;
|
||||
friend class ::grpc::ClientContext;
|
||||
|
||||
|
|
|
|||
|
|
@ -52,6 +52,8 @@ class ServerCredentials;
|
|||
class Service;
|
||||
class ThreadPoolInterface;
|
||||
|
||||
extern CoreCodegenInterface* g_core_codegen_interface;
|
||||
|
||||
/// Models a gRPC server.
|
||||
///
|
||||
/// Servers are configured and started via \a grpc::ServerBuilder.
|
||||
|
|
@ -78,7 +80,10 @@ class ServerInterface : public CallHook {
|
|||
/// All completion queue associated with the server (for example, for async
|
||||
/// serving) must be shutdown *after* this method has returned:
|
||||
/// See \a ServerBuilder::AddCompletionQueue for details.
|
||||
void Shutdown() { ShutdownInternal(gpr_inf_future(GPR_CLOCK_MONOTONIC)); }
|
||||
void Shutdown() {
|
||||
ShutdownInternal(
|
||||
g_core_codegen_interface->gpr_inf_future(GPR_CLOCK_MONOTONIC));
|
||||
}
|
||||
|
||||
/// Block waiting for all work to complete.
|
||||
///
|
||||
|
|
|
|||
|
|
@ -147,6 +147,17 @@ class Service {
|
|||
methods_[index].reset();
|
||||
}
|
||||
|
||||
void MarkMethodStreamedUnary(int index,
|
||||
MethodHandler* streamed_unary_method) {
|
||||
GPR_CODEGEN_ASSERT(methods_[index] && methods_[index]->handler() &&
|
||||
"Cannot mark an async or generic method Streamed Unary");
|
||||
methods_[index]->SetHandler(streamed_unary_method);
|
||||
|
||||
// From the server's point of view, streamed unary is a special
|
||||
// case of BIDI_STREAMING that has 1 read and 1 write, in that order.
|
||||
methods_[index]->SetMethodType(::grpc::RpcMethod::BIDI_STREAMING);
|
||||
}
|
||||
|
||||
private:
|
||||
friend class Server;
|
||||
friend class ServerInterface;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
*
|
||||
* 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 GRPCXX_IMPL_CODEGEN_STATUS_HELPER_H
|
||||
#define GRPCXX_IMPL_CODEGEN_STATUS_HELPER_H
|
||||
|
||||
#include <grpc++/impl/codegen/status.h>
|
||||
|
||||
namespace grpc {
|
||||
|
||||
inline StatusCode GetCanonicalCode(const Status& status) {
|
||||
return status.error_code();
|
||||
}
|
||||
|
||||
} // namespace grpc
|
||||
|
||||
#endif // GRPCXX_IMPL_CODEGEN_STATUS_HELPER_H
|
||||
|
|
@ -34,18 +34,20 @@
|
|||
#ifndef GRPCXX_IMPL_CODEGEN_SYNC_NO_CXX11_H
|
||||
#define GRPCXX_IMPL_CODEGEN_SYNC_NO_CXX11_H
|
||||
|
||||
#include <grpc/impl/codegen/sync.h>
|
||||
#include <grpc++/impl/codegen/core_codegen_interface.h>
|
||||
|
||||
namespace grpc {
|
||||
|
||||
extern CoreCodegenInterface *g_core_codegen_interface;
|
||||
|
||||
template <class mutex>
|
||||
class lock_guard;
|
||||
class condition_variable;
|
||||
|
||||
class mutex {
|
||||
public:
|
||||
mutex() { gpr_mu_init(&mu_); }
|
||||
~mutex() { gpr_mu_destroy(&mu_); }
|
||||
mutex() { g_core_codegen_interface->gpr_mu_init(&mu_); }
|
||||
~mutex() { g_core_codegen_interface->gpr_mu_destroy(&mu_); }
|
||||
|
||||
private:
|
||||
::gpr_mu mu_;
|
||||
|
|
@ -57,16 +59,18 @@ class mutex {
|
|||
template <class mutex>
|
||||
class lock_guard {
|
||||
public:
|
||||
lock_guard(mutex &mu) : mu_(mu), locked(true) { gpr_mu_lock(&mu.mu_); }
|
||||
lock_guard(mutex &mu) : mu_(mu), locked(true) {
|
||||
g_core_codegen_interface->gpr_mu_lock(&mu.mu_);
|
||||
}
|
||||
~lock_guard() { unlock_internal(); }
|
||||
|
||||
protected:
|
||||
void lock_internal() {
|
||||
if (!locked) gpr_mu_lock(&mu_.mu_);
|
||||
if (!locked) g_core_codegen_interface->gpr_mu_lock(&mu_.mu_);
|
||||
locked = true;
|
||||
}
|
||||
void unlock_internal() {
|
||||
if (locked) gpr_mu_unlock(&mu_.mu_);
|
||||
if (locked) g_core_codegen_interface->gpr_mu_unlock(&mu_.mu_);
|
||||
locked = false;
|
||||
}
|
||||
|
||||
|
|
@ -86,15 +90,17 @@ class unique_lock : public lock_guard<mutex> {
|
|||
|
||||
class condition_variable {
|
||||
public:
|
||||
condition_variable() { gpr_cv_init(&cv_); }
|
||||
~condition_variable() { gpr_cv_destroy(&cv_); }
|
||||
condition_variable() { g_core_codegen_interface->gpr_cv_init(&cv_); }
|
||||
~condition_variable() { g_core_codegen_interface->gpr_cv_destroy(&cv_); }
|
||||
void wait(lock_guard<mutex> &mu) {
|
||||
mu.locked = false;
|
||||
gpr_cv_wait(&cv_, &mu.mu_.mu_, gpr_inf_future(GPR_CLOCK_REALTIME));
|
||||
g_core_codegen_interface->gpr_cv_wait(
|
||||
&cv_, &mu.mu_.mu_,
|
||||
g_core_codegen_interface->gpr_inf_future(GPR_CLOCK_REALTIME));
|
||||
mu.locked = true;
|
||||
}
|
||||
void notify_one() { gpr_cv_signal(&cv_); }
|
||||
void notify_all() { gpr_cv_broadcast(&cv_); }
|
||||
void notify_one() { g_core_codegen_interface->gpr_cv_signal(&cv_); }
|
||||
void notify_all() { g_core_codegen_interface->gpr_cv_broadcast(&cv_); }
|
||||
|
||||
private:
|
||||
gpr_cv cv_;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@
|
|||
#include <grpc++/impl/codegen/server_context.h>
|
||||
#include <grpc++/impl/codegen/service_type.h>
|
||||
#include <grpc++/impl/codegen/status.h>
|
||||
#include <grpc/impl/codegen/log.h>
|
||||
|
||||
namespace grpc {
|
||||
|
||||
|
|
@ -64,12 +63,24 @@ class ClientStreamingInterface {
|
|||
virtual Status Finish() = 0;
|
||||
};
|
||||
|
||||
/// Common interface for all synchronous server side streaming.
|
||||
class ServerStreamingInterface {
|
||||
public:
|
||||
virtual ~ServerStreamingInterface() {}
|
||||
|
||||
/// Blocking send initial metadata to client.
|
||||
virtual void SendInitialMetadata() = 0;
|
||||
};
|
||||
|
||||
/// An interface that yields a sequence of messages of type \a R.
|
||||
template <class R>
|
||||
class ReaderInterface {
|
||||
public:
|
||||
virtual ~ReaderInterface() {}
|
||||
|
||||
/// Upper bound on the next message size available for reading on this stream
|
||||
virtual bool NextMessageSize(uint32_t* sz) = 0;
|
||||
|
||||
/// Blocking read a message and parse to \a msg. Returns \a true on success.
|
||||
/// This is thread-safe with respect to \a Write or \WritesDone methods on
|
||||
/// the same stream. It should not be called concurrently with another \a
|
||||
|
|
@ -148,6 +159,11 @@ class ClientReader GRPC_FINAL : public ClientReaderInterface<R> {
|
|||
cq_.Pluck(&ops); /// status ignored
|
||||
}
|
||||
|
||||
bool NextMessageSize(uint32_t* sz) GRPC_OVERRIDE {
|
||||
*sz = call_.max_message_size();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Read(R* msg) GRPC_OVERRIDE {
|
||||
CallOpSet<CallOpRecvInitialMetadata, CallOpRecvMessage<R>> ops;
|
||||
if (!context_->initial_metadata_received_) {
|
||||
|
|
@ -293,6 +309,11 @@ class ClientReaderWriter GRPC_FINAL : public ClientReaderWriterInterface<W, R> {
|
|||
cq_.Pluck(&ops); // status ignored
|
||||
}
|
||||
|
||||
bool NextMessageSize(uint32_t* sz) GRPC_OVERRIDE {
|
||||
*sz = call_.max_message_size();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Read(R* msg) GRPC_OVERRIDE {
|
||||
CallOpSet<CallOpRecvInitialMetadata, CallOpRecvMessage<R>> ops;
|
||||
if (!context_->initial_metadata_received_) {
|
||||
|
|
@ -336,12 +357,17 @@ class ClientReaderWriter GRPC_FINAL : public ClientReaderWriterInterface<W, R> {
|
|||
Call call_;
|
||||
};
|
||||
|
||||
/// Server-side interface for streaming reads of message of type \a R.
|
||||
template <class R>
|
||||
class ServerReader GRPC_FINAL : public ReaderInterface<R> {
|
||||
class ServerReaderInterface : public ServerStreamingInterface,
|
||||
public ReaderInterface<R> {};
|
||||
|
||||
template <class R>
|
||||
class ServerReader GRPC_FINAL : public ServerReaderInterface<R> {
|
||||
public:
|
||||
ServerReader(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {}
|
||||
|
||||
void SendInitialMetadata() {
|
||||
void SendInitialMetadata() GRPC_OVERRIDE {
|
||||
GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
|
||||
|
||||
CallOpSet<CallOpSendInitialMetadata> ops;
|
||||
|
|
@ -355,6 +381,11 @@ class ServerReader GRPC_FINAL : public ReaderInterface<R> {
|
|||
call_->cq()->Pluck(&ops);
|
||||
}
|
||||
|
||||
bool NextMessageSize(uint32_t* sz) GRPC_OVERRIDE {
|
||||
*sz = call_->max_message_size();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Read(R* msg) GRPC_OVERRIDE {
|
||||
CallOpSet<CallOpRecvMessage<R>> ops;
|
||||
ops.RecvMessage(msg);
|
||||
|
|
@ -367,12 +398,17 @@ class ServerReader GRPC_FINAL : public ReaderInterface<R> {
|
|||
ServerContext* const ctx_;
|
||||
};
|
||||
|
||||
/// Server-side interface for streaming writes of message of type \a W.
|
||||
template <class W>
|
||||
class ServerWriter GRPC_FINAL : public WriterInterface<W> {
|
||||
class ServerWriterInterface : public ServerStreamingInterface,
|
||||
public WriterInterface<W> {};
|
||||
|
||||
template <class W>
|
||||
class ServerWriter GRPC_FINAL : public ServerWriterInterface<W> {
|
||||
public:
|
||||
ServerWriter(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {}
|
||||
|
||||
void SendInitialMetadata() {
|
||||
void SendInitialMetadata() GRPC_OVERRIDE {
|
||||
GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
|
||||
|
||||
CallOpSet<CallOpSendInitialMetadata> ops;
|
||||
|
|
@ -411,10 +447,17 @@ class ServerWriter GRPC_FINAL : public WriterInterface<W> {
|
|||
|
||||
/// Server-side interface for bi-directional streaming.
|
||||
template <class W, class R>
|
||||
class ServerReaderWriter GRPC_FINAL : public WriterInterface<W>,
|
||||
public ReaderInterface<R> {
|
||||
class ServerReaderWriterInterface : public ServerStreamingInterface,
|
||||
public WriterInterface<W>,
|
||||
public ReaderInterface<R> {};
|
||||
|
||||
// Actual implementation of bi-directional streaming
|
||||
namespace internal {
|
||||
template <class W, class R>
|
||||
class ServerReaderWriterBody GRPC_FINAL {
|
||||
public:
|
||||
ServerReaderWriter(Call* call, ServerContext* ctx) : call_(call), ctx_(ctx) {}
|
||||
ServerReaderWriterBody(Call* call, ServerContext* ctx)
|
||||
: call_(call), ctx_(ctx) {}
|
||||
|
||||
void SendInitialMetadata() {
|
||||
GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
|
||||
|
|
@ -430,15 +473,19 @@ class ServerReaderWriter GRPC_FINAL : public WriterInterface<W>,
|
|||
call_->cq()->Pluck(&ops);
|
||||
}
|
||||
|
||||
bool Read(R* msg) GRPC_OVERRIDE {
|
||||
bool NextMessageSize(uint32_t* sz) {
|
||||
*sz = call_->max_message_size();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Read(R* msg) {
|
||||
CallOpSet<CallOpRecvMessage<R>> ops;
|
||||
ops.RecvMessage(msg);
|
||||
call_->PerformOps(&ops);
|
||||
return call_->cq()->Pluck(&ops) && ops.got_message;
|
||||
}
|
||||
|
||||
using WriterInterface<W>::Write;
|
||||
bool Write(const W& msg, const WriteOptions& options) GRPC_OVERRIDE {
|
||||
bool Write(const W& msg, const WriteOptions& options) {
|
||||
CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage> ops;
|
||||
if (!ops.SendMessage(msg, options).ok()) {
|
||||
return false;
|
||||
|
|
@ -459,6 +506,76 @@ class ServerReaderWriter GRPC_FINAL : public WriterInterface<W>,
|
|||
Call* const call_;
|
||||
ServerContext* const ctx_;
|
||||
};
|
||||
}
|
||||
|
||||
// class to represent the user API for a bidirectional streaming call
|
||||
template <class W, class R>
|
||||
class ServerReaderWriter GRPC_FINAL : public ServerReaderWriterInterface<W, R> {
|
||||
public:
|
||||
ServerReaderWriter(Call* call, ServerContext* ctx) : body_(call, ctx) {}
|
||||
|
||||
void SendInitialMetadata() GRPC_OVERRIDE { body_.SendInitialMetadata(); }
|
||||
|
||||
bool NextMessageSize(uint32_t* sz) GRPC_OVERRIDE {
|
||||
return body_.NextMessageSize(sz);
|
||||
}
|
||||
|
||||
bool Read(R* msg) GRPC_OVERRIDE { return body_.Read(msg); }
|
||||
|
||||
using WriterInterface<W>::Write;
|
||||
bool Write(const W& msg, const WriteOptions& options) GRPC_OVERRIDE {
|
||||
return body_.Write(msg, options);
|
||||
}
|
||||
|
||||
private:
|
||||
internal::ServerReaderWriterBody<W, R> body_;
|
||||
};
|
||||
|
||||
/// A class to represent a flow-controlled unary call. This is something
|
||||
/// of a hybrid between conventional unary and streaming. This is invoked
|
||||
/// through a unary call on the client side, but the server responds to it
|
||||
/// as though it were a single-ping-pong streaming call. The server can use
|
||||
/// the \a NextMessageSize method to determine an upper-bound on the size of
|
||||
/// the message.
|
||||
/// A key difference relative to streaming: ServerUnaryStreamer
|
||||
/// must have exactly 1 Read and exactly 1 Write, in that order, to function
|
||||
/// correctly. Otherwise, the RPC is in error.
|
||||
template <class RequestType, class ResponseType>
|
||||
class ServerUnaryStreamer GRPC_FINAL
|
||||
: public ServerReaderWriterInterface<ResponseType, RequestType> {
|
||||
public:
|
||||
ServerUnaryStreamer(Call* call, ServerContext* ctx)
|
||||
: body_(call, ctx), read_done_(false), write_done_(false) {}
|
||||
|
||||
void SendInitialMetadata() GRPC_OVERRIDE { body_.SendInitialMetadata(); }
|
||||
|
||||
bool NextMessageSize(uint32_t* sz) GRPC_OVERRIDE {
|
||||
return body_.NextMessageSize(sz);
|
||||
}
|
||||
|
||||
bool Read(RequestType* request) GRPC_OVERRIDE {
|
||||
if (read_done_) {
|
||||
return false;
|
||||
}
|
||||
read_done_ = true;
|
||||
return body_.Read(request);
|
||||
}
|
||||
|
||||
using WriterInterface<ResponseType>::Write;
|
||||
bool Write(const ResponseType& response,
|
||||
const WriteOptions& options) GRPC_OVERRIDE {
|
||||
if (write_done_ || !read_done_) {
|
||||
return false;
|
||||
}
|
||||
write_done_ = true;
|
||||
return body_.Write(response, options);
|
||||
}
|
||||
|
||||
private:
|
||||
internal::ServerReaderWriterBody<ResponseType, RequestType> body_;
|
||||
bool read_done_;
|
||||
bool write_done_;
|
||||
};
|
||||
|
||||
} // namespace grpc
|
||||
|
||||
|
|
|
|||
|
|
@ -34,10 +34,8 @@
|
|||
#ifndef GRPCXX_IMPL_CODEGEN_THRIFT_SERIALIZER_H
|
||||
#define GRPCXX_IMPL_CODEGEN_THRIFT_SERIALIZER_H
|
||||
|
||||
#include <grpc/impl/codegen/byte_buffer.h>
|
||||
#include <grpc/impl/codegen/byte_buffer_reader.h>
|
||||
#include <grpc/impl/codegen/slice.h>
|
||||
#include <grpc/impl/codegen/slice_buffer.h>
|
||||
#include <thrift/protocol/TBinaryProtocol.h>
|
||||
#include <thrift/protocol/TCompactProtocol.h>
|
||||
#include <thrift/protocol/TProtocolException.h>
|
||||
|
|
@ -216,4 +214,4 @@ typedef ThriftSerializer<void, TCompactProtocolT<TBufferBase>>
|
|||
} // namespace thrift
|
||||
} // namespace apache
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -40,10 +40,8 @@
|
|||
#include <grpc++/impl/codegen/status.h>
|
||||
#include <grpc++/impl/codegen/status_code_enum.h>
|
||||
#include <grpc++/impl/codegen/thrift_serializer.h>
|
||||
#include <grpc/impl/codegen/byte_buffer.h>
|
||||
#include <grpc/impl/codegen/byte_buffer_reader.h>
|
||||
#include <grpc/impl/codegen/slice.h>
|
||||
#include <grpc/impl/codegen/slice_buffer.h>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
#define GRPCXX_IMPL_CODEGEN_TIME_H
|
||||
|
||||
#include <grpc++/impl/codegen/config.h>
|
||||
#include <grpc/impl/codegen/time.h>
|
||||
#include <grpc/impl/codegen/grpc_types.h>
|
||||
|
||||
namespace grpc {
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ class TimePoint<gpr_timespec> {
|
|||
|
||||
#include <chrono>
|
||||
|
||||
#include <grpc/impl/codegen/time.h>
|
||||
#include <grpc/impl/codegen/grpc_types.h>
|
||||
|
||||
namespace grpc {
|
||||
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
namespace grpc {
|
||||
|
||||
class ServerInitializer;
|
||||
class ChannelArguments;
|
||||
|
||||
class ServerBuilderPlugin {
|
||||
public:
|
||||
|
|
@ -58,6 +59,10 @@ class ServerBuilderPlugin {
|
|||
// ServerBuilderOption::UpdatePlugins
|
||||
virtual void ChangeArguments(const grpc::string& name, void* value) = 0;
|
||||
|
||||
// UpdateChannelArguments will be called in ServerBuilder::BuildAndStart(),
|
||||
// before the Server instance is created.
|
||||
virtual void UpdateChannelArguments(ChannelArguments* args) {}
|
||||
|
||||
virtual bool has_sync_methods() const { return false; }
|
||||
virtual bool has_async_methods() const { return false; }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -34,6 +34,69 @@
|
|||
#ifndef GRPC_BYTE_BUFFER_H
|
||||
#define GRPC_BYTE_BUFFER_H
|
||||
|
||||
#include <grpc/impl/codegen/byte_buffer.h>
|
||||
#include <grpc/impl/codegen/grpc_types.h>
|
||||
#include <grpc/support/slice_buffer.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Returns a RAW byte buffer instance over the given slices (up to \a nslices).
|
||||
*
|
||||
* Increases the reference count for all \a slices processed. The user is
|
||||
* responsible for invoking grpc_byte_buffer_destroy on the returned instance.*/
|
||||
GRPCAPI grpc_byte_buffer *grpc_raw_byte_buffer_create(gpr_slice *slices,
|
||||
size_t nslices);
|
||||
|
||||
/** Returns a *compressed* RAW byte buffer instance over the given slices (up to
|
||||
* \a nslices). The \a compression argument defines the compression algorithm
|
||||
* used to generate the data in \a slices.
|
||||
*
|
||||
* Increases the reference count for all \a slices processed. The user is
|
||||
* responsible for invoking grpc_byte_buffer_destroy on the returned instance.*/
|
||||
GRPCAPI grpc_byte_buffer *grpc_raw_compressed_byte_buffer_create(
|
||||
gpr_slice *slices, size_t nslices, grpc_compression_algorithm compression);
|
||||
|
||||
/** Copies input byte buffer \a bb.
|
||||
*
|
||||
* Increases the reference count of all the source slices. The user is
|
||||
* responsible for calling grpc_byte_buffer_destroy over the returned copy. */
|
||||
GRPCAPI grpc_byte_buffer *grpc_byte_buffer_copy(grpc_byte_buffer *bb);
|
||||
|
||||
/** Returns the size of the given byte buffer, in bytes. */
|
||||
GRPCAPI size_t grpc_byte_buffer_length(grpc_byte_buffer *bb);
|
||||
|
||||
/** Destroys \a byte_buffer deallocating all its memory. */
|
||||
GRPCAPI void grpc_byte_buffer_destroy(grpc_byte_buffer *byte_buffer);
|
||||
|
||||
/** Reader for byte buffers. Iterates over slices in the byte buffer */
|
||||
struct grpc_byte_buffer_reader;
|
||||
typedef struct grpc_byte_buffer_reader grpc_byte_buffer_reader;
|
||||
|
||||
/** Initialize \a reader to read over \a buffer.
|
||||
* Returns 1 upon success, 0 otherwise. */
|
||||
GRPCAPI int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader *reader,
|
||||
grpc_byte_buffer *buffer);
|
||||
|
||||
/** Cleanup and destroy \a reader */
|
||||
GRPCAPI void grpc_byte_buffer_reader_destroy(grpc_byte_buffer_reader *reader);
|
||||
|
||||
/** Updates \a slice with the next piece of data from from \a reader and returns
|
||||
* 1. Returns 0 at the end of the stream. Caller is responsible for calling
|
||||
* gpr_slice_unref on the result. */
|
||||
GRPCAPI int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader *reader,
|
||||
gpr_slice *slice);
|
||||
|
||||
/** Merge all data from \a reader into single slice */
|
||||
GRPCAPI gpr_slice
|
||||
grpc_byte_buffer_reader_readall(grpc_byte_buffer_reader *reader);
|
||||
|
||||
/** Returns a RAW byte buffer instance from the output of \a reader. */
|
||||
GRPCAPI grpc_byte_buffer *grpc_raw_byte_buffer_from_reader(
|
||||
grpc_byte_buffer_reader *reader);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GRPC_BYTE_BUFFER_H */
|
||||
|
|
|
|||
|
|
@ -36,9 +36,10 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <grpc/impl/codegen/compression_types.h>
|
||||
#include <grpc/impl/codegen/port_platform.h>
|
||||
|
||||
#include <grpc/impl/codegen/compression_types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -90,6 +90,9 @@ GRPCAPI void grpc_shutdown(void);
|
|||
/** Return a string representing the current version of grpc */
|
||||
GRPCAPI const char *grpc_version_string(void);
|
||||
|
||||
/** Return a string specifying what the 'g' in gRPC stands for */
|
||||
GRPCAPI const char *grpc_g_stands_for(void);
|
||||
|
||||
/** Create a completion queue */
|
||||
GRPCAPI grpc_completion_queue *grpc_completion_queue_create(void *reserved);
|
||||
|
||||
|
|
|
|||
|
|
@ -75,6 +75,9 @@
|
|||
int gpr_atm_no_barrier_cas(gpr_atm *p, gpr_atm o, gpr_atm n);
|
||||
int gpr_atm_acq_cas(gpr_atm *p, gpr_atm o, gpr_atm n);
|
||||
int gpr_atm_rel_cas(gpr_atm *p, gpr_atm o, gpr_atm n);
|
||||
|
||||
// Atomically, set *p=n and return the old value of *p
|
||||
gpr_atm gpr_atm_full_xchg(gpr_atm *p, gpr_atm n);
|
||||
*/
|
||||
|
||||
#include <grpc/impl/codegen/port_platform.h>
|
||||
|
|
|
|||
|
|
@ -69,4 +69,6 @@ static __inline int gpr_atm_rel_cas(gpr_atm *p, gpr_atm o, gpr_atm n) {
|
|||
__ATOMIC_RELAXED);
|
||||
}
|
||||
|
||||
#define gpr_atm_full_xchg(p, n) __atomic_exchange_n((p), (n), __ATOMIC_ACQ_REL)
|
||||
|
||||
#endif /* GRPC_IMPL_CODEGEN_ATM_GCC_ATOMIC_H */
|
||||
|
|
|
|||
|
|
@ -84,4 +84,12 @@ static __inline void gpr_atm_no_barrier_store(gpr_atm *p, gpr_atm value) {
|
|||
#define gpr_atm_acq_cas(p, o, n) (__sync_bool_compare_and_swap((p), (o), (n)))
|
||||
#define gpr_atm_rel_cas(p, o, n) gpr_atm_acq_cas((p), (o), (n))
|
||||
|
||||
static __inline gpr_atm gpr_atm_full_xchg(gpr_atm *p, gpr_atm n) {
|
||||
gpr_atm cur;
|
||||
do {
|
||||
cur = gpr_atm_acq_load(p);
|
||||
} while (!gpr_atm_rel_cas(p, cur, n));
|
||||
return cur;
|
||||
}
|
||||
|
||||
#endif /* GRPC_IMPL_CODEGEN_ATM_GCC_SYNC_H */
|
||||
|
|
|
|||
|
|
@ -122,4 +122,8 @@ static __inline gpr_atm gpr_atm_full_fetch_add(gpr_atm *p, gpr_atm delta) {
|
|||
return old;
|
||||
}
|
||||
|
||||
static __inline gpr_atm gpr_atm_full_xchg(gpr_atm *p, gpr_atm n) {
|
||||
return (gpr_atm)InterlockedExchangePointer((PVOID *)p, (PVOID)n);
|
||||
}
|
||||
|
||||
#endif /* GRPC_IMPL_CODEGEN_ATM_WINDOWS_H */
|
||||
|
|
|
|||
|
|
@ -1,122 +0,0 @@
|
|||
/*
|
||||
*
|
||||
* Copyright 2015-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_IMPL_CODEGEN_BYTE_BUFFER_H
|
||||
#define GRPC_IMPL_CODEGEN_BYTE_BUFFER_H
|
||||
|
||||
#include <grpc/impl/codegen/compression_types.h>
|
||||
#include <grpc/impl/codegen/slice_buffer.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
GRPC_BB_RAW
|
||||
/* Future types may include GRPC_BB_PROTOBUF, etc. */
|
||||
} grpc_byte_buffer_type;
|
||||
|
||||
struct grpc_byte_buffer {
|
||||
void *reserved;
|
||||
grpc_byte_buffer_type type;
|
||||
union {
|
||||
struct {
|
||||
void *reserved[8];
|
||||
} reserved;
|
||||
struct {
|
||||
grpc_compression_algorithm compression;
|
||||
gpr_slice_buffer slice_buffer;
|
||||
} raw;
|
||||
} data;
|
||||
};
|
||||
typedef struct grpc_byte_buffer grpc_byte_buffer;
|
||||
|
||||
/** Returns a RAW byte buffer instance over the given slices (up to \a nslices).
|
||||
*
|
||||
* Increases the reference count for all \a slices processed. The user is
|
||||
* responsible for invoking grpc_byte_buffer_destroy on the returned instance.*/
|
||||
GRPCAPI grpc_byte_buffer *grpc_raw_byte_buffer_create(gpr_slice *slices,
|
||||
size_t nslices);
|
||||
|
||||
/** Returns a *compressed* RAW byte buffer instance over the given slices (up to
|
||||
* \a nslices). The \a compression argument defines the compression algorithm
|
||||
* used to generate the data in \a slices.
|
||||
*
|
||||
* Increases the reference count for all \a slices processed. The user is
|
||||
* responsible for invoking grpc_byte_buffer_destroy on the returned instance.*/
|
||||
GRPCAPI grpc_byte_buffer *grpc_raw_compressed_byte_buffer_create(
|
||||
gpr_slice *slices, size_t nslices, grpc_compression_algorithm compression);
|
||||
|
||||
/** Copies input byte buffer \a bb.
|
||||
*
|
||||
* Increases the reference count of all the source slices. The user is
|
||||
* responsible for calling grpc_byte_buffer_destroy over the returned copy. */
|
||||
GRPCAPI grpc_byte_buffer *grpc_byte_buffer_copy(grpc_byte_buffer *bb);
|
||||
|
||||
/** Returns the size of the given byte buffer, in bytes. */
|
||||
GRPCAPI size_t grpc_byte_buffer_length(grpc_byte_buffer *bb);
|
||||
|
||||
/** Destroys \a byte_buffer deallocating all its memory. */
|
||||
GRPCAPI void grpc_byte_buffer_destroy(grpc_byte_buffer *byte_buffer);
|
||||
|
||||
/** Reader for byte buffers. Iterates over slices in the byte buffer */
|
||||
struct grpc_byte_buffer_reader;
|
||||
typedef struct grpc_byte_buffer_reader grpc_byte_buffer_reader;
|
||||
|
||||
/** Initialize \a reader to read over \a buffer.
|
||||
* Returns 1 upon success, 0 otherwise. */
|
||||
GRPCAPI int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader *reader,
|
||||
grpc_byte_buffer *buffer);
|
||||
|
||||
/** Cleanup and destroy \a reader */
|
||||
GRPCAPI void grpc_byte_buffer_reader_destroy(grpc_byte_buffer_reader *reader);
|
||||
|
||||
/** Updates \a slice with the next piece of data from from \a reader and returns
|
||||
* 1. Returns 0 at the end of the stream. Caller is responsible for calling
|
||||
* gpr_slice_unref on the result. */
|
||||
GRPCAPI int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader *reader,
|
||||
gpr_slice *slice);
|
||||
|
||||
/** Merge all data from \a reader into single slice */
|
||||
GRPCAPI gpr_slice
|
||||
grpc_byte_buffer_reader_readall(grpc_byte_buffer_reader *reader);
|
||||
|
||||
/** Returns a RAW byte buffer instance from the output of \a reader. */
|
||||
GRPCAPI grpc_byte_buffer *grpc_raw_byte_buffer_from_reader(
|
||||
grpc_byte_buffer_reader *reader);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GRPC_IMPL_CODEGEN_BYTE_BUFFER_H */
|
||||
|
|
@ -34,15 +34,15 @@
|
|||
#ifndef GRPC_IMPL_CODEGEN_BYTE_BUFFER_READER_H
|
||||
#define GRPC_IMPL_CODEGEN_BYTE_BUFFER_READER_H
|
||||
|
||||
#include <grpc/impl/codegen/byte_buffer.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct grpc_byte_buffer;
|
||||
|
||||
struct grpc_byte_buffer_reader {
|
||||
grpc_byte_buffer *buffer_in;
|
||||
grpc_byte_buffer *buffer_out;
|
||||
struct grpc_byte_buffer *buffer_in;
|
||||
struct grpc_byte_buffer *buffer_out;
|
||||
/* Different current objects correspond to different types of byte buffers */
|
||||
union {
|
||||
/* Index into a slice buffer's array of slices */
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@
|
|||
#ifndef GRPC_IMPL_CODEGEN_COMPRESSION_TYPES_H
|
||||
#define GRPC_IMPL_CODEGEN_COMPRESSION_TYPES_H
|
||||
|
||||
#include <grpc/impl/codegen/port_platform.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,140 @@
|
|||
/*
|
||||
*
|
||||
* 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_IMPL_CODEGEN_GPR_TYPES_H
|
||||
#define GRPC_IMPL_CODEGEN_GPR_TYPES_H
|
||||
|
||||
#include <grpc/impl/codegen/port_platform.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* The clocks we support. */
|
||||
typedef enum {
|
||||
/* Monotonic clock. Epoch undefined. Always moves forwards. */
|
||||
GPR_CLOCK_MONOTONIC = 0,
|
||||
/* Realtime clock. May jump forwards or backwards. Settable by
|
||||
the system administrator. Has its epoch at 0:00:00 UTC 1 Jan 1970. */
|
||||
GPR_CLOCK_REALTIME,
|
||||
/* CPU cycle time obtained by rdtsc instruction on x86 platforms. Epoch
|
||||
undefined. Degrades to GPR_CLOCK_REALTIME on other platforms. */
|
||||
GPR_CLOCK_PRECISE,
|
||||
/* Unmeasurable clock type: no base, created by taking the difference
|
||||
between two times */
|
||||
GPR_TIMESPAN
|
||||
} gpr_clock_type;
|
||||
|
||||
/* Analogous to struct timespec. On some machines, absolute times may be in
|
||||
* local time. */
|
||||
typedef struct gpr_timespec {
|
||||
int64_t tv_sec;
|
||||
int32_t tv_nsec;
|
||||
/** Against which clock was this time measured? (or GPR_TIMESPAN if
|
||||
this is a relative time meaure) */
|
||||
gpr_clock_type clock_type;
|
||||
} gpr_timespec;
|
||||
|
||||
/* Slice API
|
||||
|
||||
A slice represents a contiguous reference counted array of bytes.
|
||||
It is cheap to take references to a slice, and it is cheap to create a
|
||||
slice pointing to a subset of another slice.
|
||||
|
||||
The data-structure for slices is exposed here to allow non-gpr code to
|
||||
build slices from whatever data they have available.
|
||||
|
||||
When defining interfaces that handle slices, care should be taken to define
|
||||
reference ownership semantics (who should call unref?) and mutability
|
||||
constraints (is the callee allowed to modify the slice?) */
|
||||
|
||||
/* Reference count container for gpr_slice. Contains function pointers to
|
||||
increment and decrement reference counts. Implementations should cleanup
|
||||
when the reference count drops to zero.
|
||||
Typically client code should not touch this, and use gpr_slice_malloc,
|
||||
gpr_slice_new, or gpr_slice_new_with_len instead. */
|
||||
typedef struct gpr_slice_refcount {
|
||||
void (*ref)(void *);
|
||||
void (*unref)(void *);
|
||||
} gpr_slice_refcount;
|
||||
|
||||
#define GPR_SLICE_INLINED_SIZE (sizeof(size_t) + sizeof(uint8_t *) - 1)
|
||||
|
||||
/* A gpr_slice s, if initialized, represents the byte range
|
||||
s.bytes[0..s.length-1].
|
||||
|
||||
It can have an associated ref count which has a destruction routine to be run
|
||||
when the ref count reaches zero (see gpr_slice_new() and grp_slice_unref()).
|
||||
Multiple gpr_slice values may share a ref count.
|
||||
|
||||
If the slice does not have a refcount, it represents an inlined small piece
|
||||
of data that is copied by value. */
|
||||
typedef struct gpr_slice {
|
||||
struct gpr_slice_refcount *refcount;
|
||||
union {
|
||||
struct {
|
||||
uint8_t *bytes;
|
||||
size_t length;
|
||||
} refcounted;
|
||||
struct {
|
||||
uint8_t length;
|
||||
uint8_t bytes[GPR_SLICE_INLINED_SIZE];
|
||||
} inlined;
|
||||
} data;
|
||||
} gpr_slice;
|
||||
|
||||
#define GRPC_SLICE_BUFFER_INLINE_ELEMENTS 8
|
||||
|
||||
/* Represents an expandable array of slices, to be interpreted as a
|
||||
single item. */
|
||||
typedef struct {
|
||||
/* slices in the array */
|
||||
gpr_slice *slices;
|
||||
/* the number of slices in the array */
|
||||
size_t count;
|
||||
/* the number of slices allocated in the array */
|
||||
size_t capacity;
|
||||
/* the combined length of all slices in the array */
|
||||
size_t length;
|
||||
/* inlined elements to avoid allocations */
|
||||
gpr_slice inlined[GRPC_SLICE_BUFFER_INLINE_ELEMENTS];
|
||||
} gpr_slice_buffer;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GRPC_IMPL_CODEGEN_GPR_TYPES_H */
|
||||
|
|
@ -34,15 +34,37 @@
|
|||
#ifndef GRPC_IMPL_CODEGEN_GRPC_TYPES_H
|
||||
#define GRPC_IMPL_CODEGEN_GRPC_TYPES_H
|
||||
|
||||
#include <grpc/impl/codegen/byte_buffer.h>
|
||||
#include <grpc/impl/codegen/gpr_types.h>
|
||||
|
||||
#include <grpc/impl/codegen/compression_types.h>
|
||||
#include <grpc/impl/codegen/status.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
GRPC_BB_RAW
|
||||
/* Future types may include GRPC_BB_PROTOBUF, etc. */
|
||||
} grpc_byte_buffer_type;
|
||||
|
||||
typedef struct grpc_byte_buffer {
|
||||
void *reserved;
|
||||
grpc_byte_buffer_type type;
|
||||
union {
|
||||
struct {
|
||||
void *reserved[8];
|
||||
} reserved;
|
||||
struct {
|
||||
grpc_compression_algorithm compression;
|
||||
gpr_slice_buffer slice_buffer;
|
||||
} raw;
|
||||
} data;
|
||||
} grpc_byte_buffer;
|
||||
|
||||
/** Completion Queues enable notification of the completion of asynchronous
|
||||
actions. */
|
||||
typedef struct grpc_completion_queue grpc_completion_queue;
|
||||
|
|
@ -142,6 +164,11 @@ typedef struct {
|
|||
/** How much memory to use for hpack encoding. Int valued, bytes. */
|
||||
#define GRPC_ARG_HTTP2_HPACK_TABLE_SIZE_ENCODER \
|
||||
"grpc.http2.hpack_table_size.encoder"
|
||||
/** How big a frame are we willing to receive via HTTP2.
|
||||
Min 16384, max 16777215.
|
||||
Larger values give lower CPU usage for large messages, but more head of line
|
||||
blocking for small messages. */
|
||||
#define GRPC_ARG_HTTP2_MAX_FRAME_SIZE "grpc.http2.max_frame_size"
|
||||
/** Default authority to pass if none specified on call construction. A string.
|
||||
* */
|
||||
#define GRPC_ARG_DEFAULT_AUTHORITY "grpc.default_authority"
|
||||
|
|
@ -222,10 +249,14 @@ typedef enum grpc_call_error {
|
|||
#define GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST (0x00000010u)
|
||||
/** Signal that the call should not return UNAVAILABLE before it has started */
|
||||
#define GRPC_INITIAL_METADATA_IGNORE_CONNECTIVITY (0x00000020u)
|
||||
/** Signal that the call is cacheable. GRPC is free to use GET verb */
|
||||
#define GRPC_INITIAL_METADATA_CACHEABLE_REQUEST (0x00000040u)
|
||||
|
||||
/** Mask of all valid flags */
|
||||
#define GRPC_INITIAL_METADATA_USED_MASK \
|
||||
(GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST | \
|
||||
GRPC_INITIAL_METADATA_IGNORE_CONNECTIVITY)
|
||||
#define GRPC_INITIAL_METADATA_USED_MASK \
|
||||
(GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST | \
|
||||
GRPC_INITIAL_METADATA_IGNORE_CONNECTIVITY | \
|
||||
GRPC_INITIAL_METADATA_CACHEABLE_REQUEST)
|
||||
|
||||
/** A single metadata element */
|
||||
typedef struct grpc_metadata {
|
||||
|
|
@ -327,6 +358,8 @@ typedef enum {
|
|||
GRPC_OP_RECV_CLOSE_ON_SERVER
|
||||
} grpc_op_type;
|
||||
|
||||
struct grpc_byte_buffer;
|
||||
|
||||
/** Operation data: one field for each op type (except SEND_CLOSE_FROM_CLIENT
|
||||
which has no arguments) */
|
||||
typedef struct grpc_op {
|
||||
|
|
@ -351,7 +384,7 @@ typedef struct grpc_op {
|
|||
grpc_compression_level level;
|
||||
} maybe_compression_level;
|
||||
} send_initial_metadata;
|
||||
grpc_byte_buffer *send_message;
|
||||
struct grpc_byte_buffer *send_message;
|
||||
struct {
|
||||
size_t trailing_metadata_count;
|
||||
grpc_metadata *trailing_metadata;
|
||||
|
|
@ -367,7 +400,7 @@ typedef struct grpc_op {
|
|||
/** ownership of the byte buffer is moved to the caller; the caller must
|
||||
call grpc_byte_buffer_destroy on this value, or reuse it in a future op.
|
||||
*/
|
||||
grpc_byte_buffer **recv_message;
|
||||
struct grpc_byte_buffer **recv_message;
|
||||
struct {
|
||||
/** ownership of the array is with the caller, but ownership of the
|
||||
elements stays with the call object (ie key, value members are owned
|
||||
|
|
|
|||
|
|
@ -1,118 +0,0 @@
|
|||
/*
|
||||
*
|
||||
* Copyright 2015, 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_IMPL_CODEGEN_LOG_H
|
||||
#define GRPC_IMPL_CODEGEN_LOG_H
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h> /* for abort() */
|
||||
|
||||
#include <grpc/impl/codegen/port_platform.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* GPR log API.
|
||||
|
||||
Usage (within grpc):
|
||||
|
||||
int argument1 = 3;
|
||||
char* argument2 = "hello";
|
||||
gpr_log(GPR_DEBUG, "format string %d", argument1);
|
||||
gpr_log(GPR_INFO, "hello world");
|
||||
gpr_log(GPR_ERROR, "%d %s!!", argument1, argument2); */
|
||||
|
||||
/* The severity of a log message - use the #defines below when calling into
|
||||
gpr_log to additionally supply file and line data */
|
||||
typedef enum gpr_log_severity {
|
||||
GPR_LOG_SEVERITY_DEBUG,
|
||||
GPR_LOG_SEVERITY_INFO,
|
||||
GPR_LOG_SEVERITY_ERROR
|
||||
} gpr_log_severity;
|
||||
|
||||
#define GPR_LOG_VERBOSITY_UNSET -1
|
||||
|
||||
/* Returns a string representation of the log severity */
|
||||
const char *gpr_log_severity_string(gpr_log_severity severity);
|
||||
|
||||
/* Macros to build log contexts at various severity levels */
|
||||
#define GPR_DEBUG __FILE__, __LINE__, GPR_LOG_SEVERITY_DEBUG
|
||||
#define GPR_INFO __FILE__, __LINE__, GPR_LOG_SEVERITY_INFO
|
||||
#define GPR_ERROR __FILE__, __LINE__, GPR_LOG_SEVERITY_ERROR
|
||||
|
||||
/* Log a message. It's advised to use GPR_xxx above to generate the context
|
||||
* for each message */
|
||||
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity,
|
||||
const char *format, ...) GPRC_PRINT_FORMAT_CHECK(4, 5);
|
||||
|
||||
GPRAPI void gpr_log_message(const char *file, int line,
|
||||
gpr_log_severity severity, const char *message);
|
||||
|
||||
/* Set global log verbosity */
|
||||
GPRAPI void gpr_set_log_verbosity(gpr_log_severity min_severity_to_print);
|
||||
|
||||
GPRAPI void gpr_log_verbosity_init();
|
||||
|
||||
/* Log overrides: applications can use this API to intercept logging calls
|
||||
and use their own implementations */
|
||||
|
||||
typedef struct {
|
||||
const char *file;
|
||||
int line;
|
||||
gpr_log_severity severity;
|
||||
const char *message;
|
||||
} gpr_log_func_args;
|
||||
|
||||
typedef void (*gpr_log_func)(gpr_log_func_args *args);
|
||||
GPRAPI void gpr_set_log_function(gpr_log_func func);
|
||||
|
||||
/* abort() the process if x is zero, having written a line to the log.
|
||||
|
||||
Intended for internal invariants. If the error can be recovered from,
|
||||
without the possibility of corruption, or might best be reflected via
|
||||
an exception in a higher-level language, consider returning error code. */
|
||||
#define GPR_ASSERT(x) \
|
||||
do { \
|
||||
if (!(x)) { \
|
||||
gpr_log(GPR_ERROR, "assertion failed: %s", #x); \
|
||||
abort(); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GRPC_IMPL_CODEGEN_LOG_H */
|
||||
|
|
@ -188,6 +188,7 @@
|
|||
#define GPR_ARCH_32 1
|
||||
#endif /* _LP64 */
|
||||
#elif defined(__APPLE__)
|
||||
#include <Availability.h>
|
||||
#include <TargetConditionals.h>
|
||||
#ifndef _BSD_SOURCE
|
||||
#define _BSD_SOURCE
|
||||
|
|
@ -199,8 +200,18 @@
|
|||
#define GPR_PTHREAD_TLS 1
|
||||
#else /* TARGET_OS_IPHONE */
|
||||
#define GPR_PLATFORM_STRING "osx"
|
||||
#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED
|
||||
#if __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_7
|
||||
#define GPR_CPU_IPHONE 1
|
||||
#define GPR_PTHREAD_TLS 1
|
||||
#else /* __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_7 */
|
||||
#define GPR_CPU_POSIX 1
|
||||
#define GPR_GCC_TLS 1
|
||||
#endif
|
||||
#else /* __MAC_OS_X_VERSION_MIN_REQUIRED */
|
||||
#define GPR_CPU_POSIX 1
|
||||
#define GPR_GCC_TLS 1
|
||||
#endif
|
||||
#define GPR_POSIX_CRASH_HANDLER 1
|
||||
#endif
|
||||
#define GPR_APPLE 1
|
||||
|
|
|
|||
|
|
@ -34,62 +34,8 @@
|
|||
#ifndef GRPC_IMPL_CODEGEN_SLICE_H
|
||||
#define GRPC_IMPL_CODEGEN_SLICE_H
|
||||
|
||||
#include <grpc/impl/codegen/sync.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Slice API
|
||||
|
||||
A slice represents a contiguous reference counted array of bytes.
|
||||
It is cheap to take references to a slice, and it is cheap to create a
|
||||
slice pointing to a subset of another slice.
|
||||
|
||||
The data-structure for slices is exposed here to allow non-gpr code to
|
||||
build slices from whatever data they have available.
|
||||
|
||||
When defining interfaces that handle slices, care should be taken to define
|
||||
reference ownership semantics (who should call unref?) and mutability
|
||||
constraints (is the callee allowed to modify the slice?) */
|
||||
|
||||
/* Reference count container for gpr_slice. Contains function pointers to
|
||||
increment and decrement reference counts. Implementations should cleanup
|
||||
when the reference count drops to zero.
|
||||
Typically client code should not touch this, and use gpr_slice_malloc,
|
||||
gpr_slice_new, or gpr_slice_new_with_len instead. */
|
||||
typedef struct gpr_slice_refcount {
|
||||
void (*ref)(void *);
|
||||
void (*unref)(void *);
|
||||
} gpr_slice_refcount;
|
||||
|
||||
#define GPR_SLICE_INLINED_SIZE (sizeof(size_t) + sizeof(uint8_t *) - 1)
|
||||
|
||||
/* A gpr_slice s, if initialized, represents the byte range
|
||||
s.bytes[0..s.length-1].
|
||||
|
||||
It can have an associated ref count which has a destruction routine to be run
|
||||
when the ref count reaches zero (see gpr_slice_new() and grp_slice_unref()).
|
||||
Multiple gpr_slice values may share a ref count.
|
||||
|
||||
If the slice does not have a refcount, it represents an inlined small piece
|
||||
of data that is copied by value. */
|
||||
typedef struct gpr_slice {
|
||||
struct gpr_slice_refcount *refcount;
|
||||
union {
|
||||
struct {
|
||||
uint8_t *bytes;
|
||||
size_t length;
|
||||
} refcounted;
|
||||
struct {
|
||||
uint8_t length;
|
||||
uint8_t bytes[GPR_SLICE_INLINED_SIZE];
|
||||
} inlined;
|
||||
} data;
|
||||
} gpr_slice;
|
||||
|
||||
#define GPR_SLICE_START_PTR(slice) \
|
||||
((slice).refcount ? (slice).data.refcounted.bytes \
|
||||
: (slice).data.inlined.bytes)
|
||||
|
|
@ -103,88 +49,4 @@ typedef struct gpr_slice {
|
|||
GPR_SLICE_START_PTR(slice) + GPR_SLICE_LENGTH(slice)
|
||||
#define GPR_SLICE_IS_EMPTY(slice) (GPR_SLICE_LENGTH(slice) == 0)
|
||||
|
||||
/* Increment the refcount of s. Requires slice is initialized.
|
||||
Returns s. */
|
||||
GPRAPI gpr_slice gpr_slice_ref(gpr_slice s);
|
||||
|
||||
/* Decrement the ref count of s. If the ref count of s reaches zero, all
|
||||
slices sharing the ref count are destroyed, and considered no longer
|
||||
initialized. If s is ultimately derived from a call to gpr_slice_new(start,
|
||||
len, dest) where dest!=NULL , then (*dest)(start) is called, else if s is
|
||||
ultimately derived from a call to gpr_slice_new_with_len(start, len, dest)
|
||||
where dest!=NULL , then (*dest)(start, len). Requires s initialized. */
|
||||
GPRAPI void gpr_slice_unref(gpr_slice s);
|
||||
|
||||
/* Create a slice pointing at some data. Calls malloc to allocate a refcount
|
||||
for the object, and arranges that destroy will be called with the pointer
|
||||
passed in at destruction. */
|
||||
GPRAPI gpr_slice gpr_slice_new(void *p, size_t len, void (*destroy)(void *));
|
||||
|
||||
/* Equivalent to gpr_slice_new, but with a separate pointer that is
|
||||
passed to the destroy function. This function can be useful when
|
||||
the data is part of a larger structure that must be destroyed when
|
||||
the data is no longer needed. */
|
||||
GPRAPI gpr_slice gpr_slice_new_with_user_data(void *p, size_t len,
|
||||
void (*destroy)(void *),
|
||||
void *user_data);
|
||||
|
||||
/* Equivalent to gpr_slice_new, but with a two argument destroy function that
|
||||
also takes the slice length. */
|
||||
GPRAPI gpr_slice gpr_slice_new_with_len(void *p, size_t len,
|
||||
void (*destroy)(void *, size_t));
|
||||
|
||||
/* Equivalent to gpr_slice_new(malloc(len), len, free), but saves one malloc()
|
||||
call.
|
||||
Aborts if malloc() fails. */
|
||||
GPRAPI gpr_slice gpr_slice_malloc(size_t length);
|
||||
|
||||
/* Create a slice by copying a string.
|
||||
Does not preserve null terminators.
|
||||
Equivalent to:
|
||||
size_t len = strlen(source);
|
||||
gpr_slice slice = gpr_slice_malloc(len);
|
||||
memcpy(slice->data, source, len); */
|
||||
GPRAPI gpr_slice gpr_slice_from_copied_string(const char *source);
|
||||
|
||||
/* Create a slice by copying a buffer.
|
||||
Equivalent to:
|
||||
gpr_slice slice = gpr_slice_malloc(len);
|
||||
memcpy(slice->data, source, len); */
|
||||
GPRAPI gpr_slice gpr_slice_from_copied_buffer(const char *source, size_t len);
|
||||
|
||||
/* Create a slice pointing to constant memory */
|
||||
GPRAPI gpr_slice gpr_slice_from_static_string(const char *source);
|
||||
|
||||
/* Return a result slice derived from s, which shares a ref count with s, where
|
||||
result.data==s.data+begin, and result.length==end-begin.
|
||||
The ref count of s is increased by one.
|
||||
Requires s initialized, begin <= end, begin <= s.length, and
|
||||
end <= source->length. */
|
||||
GPRAPI gpr_slice gpr_slice_sub(gpr_slice s, size_t begin, size_t end);
|
||||
|
||||
/* The same as gpr_slice_sub, but without altering the ref count */
|
||||
GPRAPI gpr_slice gpr_slice_sub_no_ref(gpr_slice s, size_t begin, size_t end);
|
||||
|
||||
/* Splits s into two: modifies s to be s[0:split], and returns a new slice,
|
||||
sharing a refcount with s, that contains s[split:s.length].
|
||||
Requires s intialized, split <= s.length */
|
||||
GPRAPI gpr_slice gpr_slice_split_tail(gpr_slice *s, size_t split);
|
||||
|
||||
/* Splits s into two: modifies s to be s[split:s.length], and returns a new
|
||||
slice, sharing a refcount with s, that contains s[0:split].
|
||||
Requires s intialized, split <= s.length */
|
||||
GPRAPI gpr_slice gpr_slice_split_head(gpr_slice *s, size_t split);
|
||||
|
||||
GPRAPI gpr_slice gpr_empty_slice(void);
|
||||
|
||||
/* Returns <0 if a < b, ==0 if a == b, >0 if a > b
|
||||
The order is arbitrary, and is not guaranteed to be stable across different
|
||||
versions of the API. */
|
||||
GPRAPI int gpr_slice_cmp(gpr_slice a, gpr_slice b);
|
||||
GPRAPI int gpr_slice_str_cmp(gpr_slice a, const char *b);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GRPC_IMPL_CODEGEN_SLICE_H */
|
||||
|
|
|
|||
|
|
@ -1,104 +0,0 @@
|
|||
/*
|
||||
*
|
||||
* Copyright 2015, 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_IMPL_CODEGEN_SLICE_BUFFER_H
|
||||
#define GRPC_IMPL_CODEGEN_SLICE_BUFFER_H
|
||||
|
||||
#include <grpc/impl/codegen/slice.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define GRPC_SLICE_BUFFER_INLINE_ELEMENTS 8
|
||||
|
||||
/* Represents an expandable array of slices, to be interpreted as a
|
||||
single item. */
|
||||
typedef struct {
|
||||
/* slices in the array */
|
||||
gpr_slice *slices;
|
||||
/* the number of slices in the array */
|
||||
size_t count;
|
||||
/* the number of slices allocated in the array */
|
||||
size_t capacity;
|
||||
/* the combined length of all slices in the array */
|
||||
size_t length;
|
||||
/* inlined elements to avoid allocations */
|
||||
gpr_slice inlined[GRPC_SLICE_BUFFER_INLINE_ELEMENTS];
|
||||
} gpr_slice_buffer;
|
||||
|
||||
/* initialize a slice buffer */
|
||||
GPRAPI void gpr_slice_buffer_init(gpr_slice_buffer *sb);
|
||||
/* destroy a slice buffer - unrefs any held elements */
|
||||
GPRAPI void gpr_slice_buffer_destroy(gpr_slice_buffer *sb);
|
||||
/* Add an element to a slice buffer - takes ownership of the slice.
|
||||
This function is allowed to concatenate the passed in slice to the end of
|
||||
some other slice if desired by the slice buffer. */
|
||||
GPRAPI void gpr_slice_buffer_add(gpr_slice_buffer *sb, gpr_slice slice);
|
||||
/* add an element to a slice buffer - takes ownership of the slice and returns
|
||||
the index of the slice.
|
||||
Guarantees that the slice will not be concatenated at the end of another
|
||||
slice (i.e. the data for this slice will begin at the first byte of the
|
||||
slice at the returned index in sb->slices)
|
||||
The implementation MAY decide to concatenate data at the end of a small
|
||||
slice added in this fashion. */
|
||||
GPRAPI size_t gpr_slice_buffer_add_indexed(gpr_slice_buffer *sb,
|
||||
gpr_slice slice);
|
||||
GPRAPI void gpr_slice_buffer_addn(gpr_slice_buffer *sb, gpr_slice *slices,
|
||||
size_t n);
|
||||
/* add a very small (less than 8 bytes) amount of data to the end of a slice
|
||||
buffer: returns a pointer into which to add the data */
|
||||
GPRAPI uint8_t *gpr_slice_buffer_tiny_add(gpr_slice_buffer *sb, size_t len);
|
||||
/* pop the last buffer, but don't unref it */
|
||||
GPRAPI void gpr_slice_buffer_pop(gpr_slice_buffer *sb);
|
||||
/* clear a slice buffer, unref all elements */
|
||||
GPRAPI void gpr_slice_buffer_reset_and_unref(gpr_slice_buffer *sb);
|
||||
/* swap the contents of two slice buffers */
|
||||
GPRAPI void gpr_slice_buffer_swap(gpr_slice_buffer *a, gpr_slice_buffer *b);
|
||||
/* move all of the elements of src into dst */
|
||||
GPRAPI void gpr_slice_buffer_move_into(gpr_slice_buffer *src,
|
||||
gpr_slice_buffer *dst);
|
||||
/* remove n bytes from the end of a slice buffer */
|
||||
GPRAPI void gpr_slice_buffer_trim_end(gpr_slice_buffer *src, size_t n,
|
||||
gpr_slice_buffer *garbage);
|
||||
/* move the first n bytes of src into dst */
|
||||
GPRAPI void gpr_slice_buffer_move_first(gpr_slice_buffer *src, size_t n,
|
||||
gpr_slice_buffer *dst);
|
||||
/* take the first slice in the slice buffer */
|
||||
GPRAPI gpr_slice gpr_slice_buffer_take_first(gpr_slice_buffer *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GRPC_IMPL_CODEGEN_SLICE_BUFFER_H */
|
||||
|
|
@ -64,257 +64,4 @@
|
|||
#error Unable to determine platform for sync
|
||||
#endif
|
||||
|
||||
#include <grpc/impl/codegen/time.h> /* for gpr_timespec */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* --- Mutex interface ---
|
||||
|
||||
At most one thread may hold an exclusive lock on a mutex at any given time.
|
||||
Actions taken by a thread that holds a mutex exclusively happen after
|
||||
actions taken by all previous holders of the mutex. Variables of type
|
||||
gpr_mu are uninitialized when first declared. */
|
||||
|
||||
/* Initialize *mu. Requires: *mu uninitialized. */
|
||||
GPRAPI void gpr_mu_init(gpr_mu *mu);
|
||||
|
||||
/* Cause *mu no longer to be initialized, freeing any memory in use. Requires:
|
||||
*mu initialized; no other concurrent operation on *mu. */
|
||||
GPRAPI void gpr_mu_destroy(gpr_mu *mu);
|
||||
|
||||
/* Wait until no thread has a lock on *mu, cause the calling thread to own an
|
||||
exclusive lock on *mu, then return. May block indefinitely or crash if the
|
||||
calling thread has a lock on *mu. Requires: *mu initialized. */
|
||||
GPRAPI void gpr_mu_lock(gpr_mu *mu);
|
||||
|
||||
/* Release an exclusive lock on *mu held by the calling thread. Requires: *mu
|
||||
initialized; the calling thread holds an exclusive lock on *mu. */
|
||||
GPRAPI void gpr_mu_unlock(gpr_mu *mu);
|
||||
|
||||
/* Without blocking, attempt to acquire an exclusive lock on *mu for the
|
||||
calling thread, then return non-zero iff success. Fail, if any thread holds
|
||||
the lock; succeeds with high probability if no thread holds the lock.
|
||||
Requires: *mu initialized. */
|
||||
GPRAPI int gpr_mu_trylock(gpr_mu *mu);
|
||||
|
||||
/* --- Condition variable interface ---
|
||||
|
||||
A while-loop should be used with gpr_cv_wait() when waiting for conditions
|
||||
to become true. See the example below. Variables of type gpr_cv are
|
||||
uninitialized when first declared. */
|
||||
|
||||
/* Initialize *cv. Requires: *cv uninitialized. */
|
||||
GPRAPI void gpr_cv_init(gpr_cv *cv);
|
||||
|
||||
/* Cause *cv no longer to be initialized, freeing any memory in use. Requires:
|
||||
*cv initialized; no other concurrent operation on *cv.*/
|
||||
GPRAPI void gpr_cv_destroy(gpr_cv *cv);
|
||||
|
||||
/* Atomically release *mu and wait on *cv. When the calling thread is woken
|
||||
from *cv or the deadline abs_deadline is exceeded, execute gpr_mu_lock(mu)
|
||||
and return whether the deadline was exceeded. Use
|
||||
abs_deadline==gpr_inf_future for no deadline. abs_deadline can be either
|
||||
an absolute deadline, or a GPR_TIMESPAN. May return even when not
|
||||
woken explicitly. Requires: *mu and *cv initialized; the calling thread
|
||||
holds an exclusive lock on *mu. */
|
||||
GPRAPI int gpr_cv_wait(gpr_cv *cv, gpr_mu *mu, gpr_timespec abs_deadline);
|
||||
|
||||
/* If any threads are waiting on *cv, wake at least one.
|
||||
Clients may treat this as an optimization of gpr_cv_broadcast()
|
||||
for use in the case where waking more than one waiter is not useful.
|
||||
Requires: *cv initialized. */
|
||||
GPRAPI void gpr_cv_signal(gpr_cv *cv);
|
||||
|
||||
/* Wake all threads waiting on *cv. Requires: *cv initialized. */
|
||||
GPRAPI void gpr_cv_broadcast(gpr_cv *cv);
|
||||
|
||||
/* --- One-time initialization ---
|
||||
|
||||
gpr_once must be declared with static storage class, and initialized with
|
||||
GPR_ONCE_INIT. e.g.,
|
||||
static gpr_once once_var = GPR_ONCE_INIT; */
|
||||
|
||||
/* Ensure that (*init_routine)() has been called exactly once (for the
|
||||
specified gpr_once instance) and then return.
|
||||
If multiple threads call gpr_once() on the same gpr_once instance, one of
|
||||
them will call (*init_routine)(), and the others will block until that call
|
||||
finishes.*/
|
||||
GPRAPI void gpr_once_init(gpr_once *once, void (*init_routine)(void));
|
||||
|
||||
/* --- One-time event notification ---
|
||||
|
||||
These operations act on a gpr_event, which should be initialized with
|
||||
gpr_ev_init(), or with GPR_EVENT_INIT if static, e.g.,
|
||||
static gpr_event event_var = GPR_EVENT_INIT;
|
||||
It requires no destruction. */
|
||||
|
||||
/* Initialize *ev. */
|
||||
GPRAPI void gpr_event_init(gpr_event *ev);
|
||||
|
||||
/* Set *ev so that gpr_event_get() and gpr_event_wait() will return value.
|
||||
Requires: *ev initialized; value != NULL; no prior or concurrent calls to
|
||||
gpr_event_set(ev, ...) since initialization. */
|
||||
GPRAPI void gpr_event_set(gpr_event *ev, void *value);
|
||||
|
||||
/* Return the value set by gpr_event_set(ev, ...), or NULL if no such call has
|
||||
completed. If the result is non-NULL, all operations that occurred prior to
|
||||
the gpr_event_set(ev, ...) set will be visible after this call returns.
|
||||
Requires: *ev initialized. This operation is faster than acquiring a mutex
|
||||
on most platforms. */
|
||||
GPRAPI void *gpr_event_get(gpr_event *ev);
|
||||
|
||||
/* Wait until *ev is set by gpr_event_set(ev, ...), or abs_deadline is
|
||||
exceeded, then return gpr_event_get(ev). Requires: *ev initialized. Use
|
||||
abs_deadline==gpr_inf_future for no deadline. When the event has been
|
||||
signalled before the call, this operation is faster than acquiring a mutex
|
||||
on most platforms. */
|
||||
GPRAPI void *gpr_event_wait(gpr_event *ev, gpr_timespec abs_deadline);
|
||||
|
||||
/* --- Reference counting ---
|
||||
|
||||
These calls act on the type gpr_refcount. It requires no destruction. */
|
||||
|
||||
/* Initialize *r to value n. */
|
||||
GPRAPI void gpr_ref_init(gpr_refcount *r, int n);
|
||||
|
||||
/* Increment the reference count *r. Requires *r initialized. */
|
||||
GPRAPI void gpr_ref(gpr_refcount *r);
|
||||
|
||||
/* Increment the reference count *r. Requires *r initialized.
|
||||
Crashes if refcount is zero */
|
||||
GPRAPI void gpr_ref_non_zero(gpr_refcount *r);
|
||||
|
||||
/* Increment the reference count *r by n. Requires *r initialized, n > 0. */
|
||||
GPRAPI void gpr_refn(gpr_refcount *r, int n);
|
||||
|
||||
/* Decrement the reference count *r and return non-zero iff it has reached
|
||||
zero. . Requires *r initialized. */
|
||||
GPRAPI int gpr_unref(gpr_refcount *r);
|
||||
|
||||
/* --- Stats counters ---
|
||||
|
||||
These calls act on the integral type gpr_stats_counter. It requires no
|
||||
destruction. Static instances may be initialized with
|
||||
gpr_stats_counter c = GPR_STATS_INIT;
|
||||
Beware: These operations do not imply memory barriers. Do not use them to
|
||||
synchronize other events. */
|
||||
|
||||
/* Initialize *c to the value n. */
|
||||
GPRAPI void gpr_stats_init(gpr_stats_counter *c, intptr_t n);
|
||||
|
||||
/* *c += inc. Requires: *c initialized. */
|
||||
GPRAPI void gpr_stats_inc(gpr_stats_counter *c, intptr_t inc);
|
||||
|
||||
/* Return *c. Requires: *c initialized. */
|
||||
GPRAPI intptr_t gpr_stats_read(const gpr_stats_counter *c);
|
||||
|
||||
/* ==================Example use of interface===================
|
||||
A producer-consumer queue of up to N integers,
|
||||
illustrating the use of the calls in this interface. */
|
||||
#if 0
|
||||
|
||||
#define N 4
|
||||
|
||||
typedef struct queue {
|
||||
gpr_cv non_empty; /* Signalled when length becomes non-zero. */
|
||||
gpr_cv non_full; /* Signalled when length becomes non-N. */
|
||||
gpr_mu mu; /* Protects all fields below.
|
||||
(That is, except during initialization or
|
||||
destruction, the fields below should be accessed
|
||||
only by a thread that holds mu.) */
|
||||
int head; /* Index of head of queue 0..N-1. */
|
||||
int length; /* Number of valid elements in queue 0..N. */
|
||||
int elem[N]; /* elem[head .. head+length-1] are queue elements. */
|
||||
} queue;
|
||||
|
||||
/* Initialize *q. */
|
||||
void queue_init(queue *q) {
|
||||
gpr_mu_init(&q->mu);
|
||||
gpr_cv_init(&q->non_empty);
|
||||
gpr_cv_init(&q->non_full);
|
||||
q->head = 0;
|
||||
q->length = 0;
|
||||
}
|
||||
|
||||
/* Free storage associated with *q. */
|
||||
void queue_destroy(queue *q) {
|
||||
gpr_mu_destroy(&q->mu);
|
||||
gpr_cv_destroy(&q->non_empty);
|
||||
gpr_cv_destroy(&q->non_full);
|
||||
}
|
||||
|
||||
/* Wait until there is room in *q, then append x to *q. */
|
||||
void queue_append(queue *q, int x) {
|
||||
gpr_mu_lock(&q->mu);
|
||||
/* To wait for a predicate without a deadline, loop on the negation of the
|
||||
predicate, and use gpr_cv_wait(..., gpr_inf_future) inside the loop
|
||||
to release the lock, wait, and reacquire on each iteration. Code that
|
||||
makes the condition true should use gpr_cv_broadcast() on the
|
||||
corresponding condition variable. The predicate must be on state
|
||||
protected by the lock. */
|
||||
while (q->length == N) {
|
||||
gpr_cv_wait(&q->non_full, &q->mu, gpr_inf_future);
|
||||
}
|
||||
if (q->length == 0) { /* Wake threads blocked in queue_remove(). */
|
||||
/* It's normal to use gpr_cv_broadcast() or gpr_signal() while
|
||||
holding the lock. */
|
||||
gpr_cv_broadcast(&q->non_empty);
|
||||
}
|
||||
q->elem[(q->head + q->length) % N] = x;
|
||||
q->length++;
|
||||
gpr_mu_unlock(&q->mu);
|
||||
}
|
||||
|
||||
/* If it can be done without blocking, append x to *q and return non-zero.
|
||||
Otherwise return 0. */
|
||||
int queue_try_append(queue *q, int x) {
|
||||
int result = 0;
|
||||
if (gpr_mu_trylock(&q->mu)) {
|
||||
if (q->length != N) {
|
||||
if (q->length == 0) { /* Wake threads blocked in queue_remove(). */
|
||||
gpr_cv_broadcast(&q->non_empty);
|
||||
}
|
||||
q->elem[(q->head + q->length) % N] = x;
|
||||
q->length++;
|
||||
result = 1;
|
||||
}
|
||||
gpr_mu_unlock(&q->mu);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Wait until the *q is non-empty or deadline abs_deadline passes. If the
|
||||
queue is non-empty, remove its head entry, place it in *head, and return
|
||||
non-zero. Otherwise return 0. */
|
||||
int queue_remove(queue *q, int *head, gpr_timespec abs_deadline) {
|
||||
int result = 0;
|
||||
gpr_mu_lock(&q->mu);
|
||||
/* To wait for a predicate with a deadline, loop on the negation of the
|
||||
predicate or until gpr_cv_wait() returns true. Code that makes
|
||||
the condition true should use gpr_cv_broadcast() on the corresponding
|
||||
condition variable. The predicate must be on state protected by the
|
||||
lock. */
|
||||
while (q->length == 0 &&
|
||||
!gpr_cv_wait(&q->non_empty, &q->mu, abs_deadline)) {
|
||||
}
|
||||
if (q->length != 0) { /* Queue is non-empty. */
|
||||
result = 1;
|
||||
if (q->length == N) { /* Wake threads blocked in queue_append(). */
|
||||
gpr_cv_broadcast(&q->non_full);
|
||||
}
|
||||
*head = q->elem[q->head];
|
||||
q->head = (q->head + 1) % N;
|
||||
q->length--;
|
||||
} /* else deadline exceeded */
|
||||
gpr_mu_unlock(&q->mu);
|
||||
return result;
|
||||
}
|
||||
#endif /* 0 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GRPC_IMPL_CODEGEN_SYNC_H */
|
||||
|
|
|
|||
|
|
@ -1,130 +0,0 @@
|
|||
/*
|
||||
*
|
||||
* Copyright 2015, 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_IMPL_CODEGEN_TIME_H
|
||||
#define GRPC_IMPL_CODEGEN_TIME_H
|
||||
/* Time support.
|
||||
We use gpr_timespec, which is analogous to struct timespec. On some
|
||||
machines, absolute times may be in local time. */
|
||||
|
||||
#include <grpc/impl/codegen/port_platform.h>
|
||||
#include <stddef.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* The clocks we support. */
|
||||
typedef enum {
|
||||
/* Monotonic clock. Epoch undefined. Always moves forwards. */
|
||||
GPR_CLOCK_MONOTONIC = 0,
|
||||
/* Realtime clock. May jump forwards or backwards. Settable by
|
||||
the system administrator. Has its epoch at 0:00:00 UTC 1 Jan 1970. */
|
||||
GPR_CLOCK_REALTIME,
|
||||
/* CPU cycle time obtained by rdtsc instruction on x86 platforms. Epoch
|
||||
undefined. Degrades to GPR_CLOCK_REALTIME on other platforms. */
|
||||
GPR_CLOCK_PRECISE,
|
||||
/* Unmeasurable clock type: no base, created by taking the difference
|
||||
between two times */
|
||||
GPR_TIMESPAN
|
||||
} gpr_clock_type;
|
||||
|
||||
typedef struct gpr_timespec {
|
||||
int64_t tv_sec;
|
||||
int32_t tv_nsec;
|
||||
/** Against which clock was this time measured? (or GPR_TIMESPAN if
|
||||
this is a relative time meaure) */
|
||||
gpr_clock_type clock_type;
|
||||
} gpr_timespec;
|
||||
|
||||
/* Time constants. */
|
||||
GPRAPI gpr_timespec
|
||||
gpr_time_0(gpr_clock_type type); /* The zero time interval. */
|
||||
GPRAPI gpr_timespec gpr_inf_future(gpr_clock_type type); /* The far future */
|
||||
GPRAPI gpr_timespec gpr_inf_past(gpr_clock_type type); /* The far past. */
|
||||
|
||||
#define GPR_MS_PER_SEC 1000
|
||||
#define GPR_US_PER_SEC 1000000
|
||||
#define GPR_NS_PER_SEC 1000000000
|
||||
#define GPR_NS_PER_MS 1000000
|
||||
#define GPR_NS_PER_US 1000
|
||||
#define GPR_US_PER_MS 1000
|
||||
|
||||
/* initialize time subsystem */
|
||||
GPRAPI void gpr_time_init(void);
|
||||
|
||||
/* Return the current time measured from the given clocks epoch. */
|
||||
GPRAPI gpr_timespec gpr_now(gpr_clock_type clock);
|
||||
|
||||
/* Convert a timespec from one clock to another */
|
||||
GPRAPI gpr_timespec gpr_convert_clock_type(gpr_timespec t,
|
||||
gpr_clock_type target_clock);
|
||||
|
||||
/* Return -ve, 0, or +ve according to whether a < b, a == b, or a > b
|
||||
respectively. */
|
||||
GPRAPI int gpr_time_cmp(gpr_timespec a, gpr_timespec b);
|
||||
|
||||
GPRAPI gpr_timespec gpr_time_max(gpr_timespec a, gpr_timespec b);
|
||||
GPRAPI gpr_timespec gpr_time_min(gpr_timespec a, gpr_timespec b);
|
||||
|
||||
/* Add and subtract times. Calculations saturate at infinities. */
|
||||
GPRAPI gpr_timespec gpr_time_add(gpr_timespec a, gpr_timespec b);
|
||||
GPRAPI gpr_timespec gpr_time_sub(gpr_timespec a, gpr_timespec b);
|
||||
|
||||
/* Return a timespec representing a given number of time units. INT64_MIN is
|
||||
interpreted as gpr_inf_past, and INT64_MAX as gpr_inf_future. */
|
||||
GPRAPI gpr_timespec gpr_time_from_micros(int64_t x, gpr_clock_type clock_type);
|
||||
GPRAPI gpr_timespec gpr_time_from_nanos(int64_t x, gpr_clock_type clock_type);
|
||||
GPRAPI gpr_timespec gpr_time_from_millis(int64_t x, gpr_clock_type clock_type);
|
||||
GPRAPI gpr_timespec gpr_time_from_seconds(int64_t x, gpr_clock_type clock_type);
|
||||
GPRAPI gpr_timespec gpr_time_from_minutes(int64_t x, gpr_clock_type clock_type);
|
||||
GPRAPI gpr_timespec gpr_time_from_hours(int64_t x, gpr_clock_type clock_type);
|
||||
|
||||
GPRAPI int32_t gpr_time_to_millis(gpr_timespec timespec);
|
||||
|
||||
/* Return 1 if two times are equal or within threshold of each other,
|
||||
0 otherwise */
|
||||
GPRAPI int gpr_time_similar(gpr_timespec a, gpr_timespec b,
|
||||
gpr_timespec threshold);
|
||||
|
||||
/* Sleep until at least 'until' - an absolute timeout */
|
||||
GPRAPI void gpr_sleep_until(gpr_timespec until);
|
||||
|
||||
GPRAPI double gpr_timespec_to_micros(gpr_timespec t);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GRPC_IMPL_CODEGEN_TIME_H */
|
||||
|
|
@ -4,8 +4,6 @@ framework module grpc {
|
|||
header "byte_buffer_reader.h"
|
||||
header "grpc_security.h"
|
||||
header "grpc_security_constants.h"
|
||||
header "impl/codegen/alloc.h"
|
||||
header "impl/codegen/byte_buffer_reader.h"
|
||||
header "support/alloc.h"
|
||||
header "support/port_platform.h"
|
||||
header "support/string_util.h"
|
||||
|
|
|
|||
|
|
@ -34,6 +34,41 @@
|
|||
#ifndef GRPC_SUPPORT_ALLOC_H
|
||||
#define GRPC_SUPPORT_ALLOC_H
|
||||
|
||||
#include <grpc/impl/codegen/alloc.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <grpc/impl/codegen/port_platform.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct gpr_allocation_functions {
|
||||
void *(*malloc_fn)(size_t size);
|
||||
void *(*realloc_fn)(void *ptr, size_t size);
|
||||
void (*free_fn)(void *ptr);
|
||||
} gpr_allocation_functions;
|
||||
|
||||
/* malloc, never returns NULL */
|
||||
GPRAPI void *gpr_malloc(size_t size);
|
||||
/* free */
|
||||
GPRAPI void gpr_free(void *ptr);
|
||||
/* realloc, never returns NULL */
|
||||
GPRAPI void *gpr_realloc(void *p, size_t size);
|
||||
/* aligned malloc, never returns NULL, will align to 1 << alignment_log */
|
||||
GPRAPI void *gpr_malloc_aligned(size_t size, size_t alignment_log);
|
||||
/* free memory allocated by gpr_malloc_aligned */
|
||||
GPRAPI void gpr_free_aligned(void *ptr);
|
||||
|
||||
/** Request the family of allocation functions in \a functions be used. NOTE
|
||||
* that this request will be honored in a *best effort* basis and that no
|
||||
* guarantees are made about the default functions (eg, malloc) being called. */
|
||||
GPRAPI void gpr_set_allocation_functions(gpr_allocation_functions functions);
|
||||
|
||||
/** Return the family of allocation functions currently in effect. */
|
||||
GPRAPI gpr_allocation_functions gpr_get_allocation_functions();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GRPC_SUPPORT_ALLOC_H */
|
||||
|
|
|
|||
|
|
@ -34,6 +34,85 @@
|
|||
#ifndef GRPC_SUPPORT_LOG_H
|
||||
#define GRPC_SUPPORT_LOG_H
|
||||
|
||||
#include <grpc/impl/codegen/log.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h> /* for abort() */
|
||||
|
||||
#include <grpc/impl/codegen/port_platform.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* GPR log API.
|
||||
|
||||
Usage (within grpc):
|
||||
|
||||
int argument1 = 3;
|
||||
char* argument2 = "hello";
|
||||
gpr_log(GPR_DEBUG, "format string %d", argument1);
|
||||
gpr_log(GPR_INFO, "hello world");
|
||||
gpr_log(GPR_ERROR, "%d %s!!", argument1, argument2); */
|
||||
|
||||
/* The severity of a log message - use the #defines below when calling into
|
||||
gpr_log to additionally supply file and line data */
|
||||
typedef enum gpr_log_severity {
|
||||
GPR_LOG_SEVERITY_DEBUG,
|
||||
GPR_LOG_SEVERITY_INFO,
|
||||
GPR_LOG_SEVERITY_ERROR
|
||||
} gpr_log_severity;
|
||||
|
||||
#define GPR_LOG_VERBOSITY_UNSET -1
|
||||
|
||||
/* Returns a string representation of the log severity */
|
||||
const char *gpr_log_severity_string(gpr_log_severity severity);
|
||||
|
||||
/* Macros to build log contexts at various severity levels */
|
||||
#define GPR_DEBUG __FILE__, __LINE__, GPR_LOG_SEVERITY_DEBUG
|
||||
#define GPR_INFO __FILE__, __LINE__, GPR_LOG_SEVERITY_INFO
|
||||
#define GPR_ERROR __FILE__, __LINE__, GPR_LOG_SEVERITY_ERROR
|
||||
|
||||
/* Log a message. It's advised to use GPR_xxx above to generate the context
|
||||
* for each message */
|
||||
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity,
|
||||
const char *format, ...) GPRC_PRINT_FORMAT_CHECK(4, 5);
|
||||
|
||||
GPRAPI void gpr_log_message(const char *file, int line,
|
||||
gpr_log_severity severity, const char *message);
|
||||
|
||||
/* Set global log verbosity */
|
||||
GPRAPI void gpr_set_log_verbosity(gpr_log_severity min_severity_to_print);
|
||||
|
||||
GPRAPI void gpr_log_verbosity_init();
|
||||
|
||||
/* Log overrides: applications can use this API to intercept logging calls
|
||||
and use their own implementations */
|
||||
|
||||
typedef struct {
|
||||
const char *file;
|
||||
int line;
|
||||
gpr_log_severity severity;
|
||||
const char *message;
|
||||
} gpr_log_func_args;
|
||||
|
||||
typedef void (*gpr_log_func)(gpr_log_func_args *args);
|
||||
GPRAPI void gpr_set_log_function(gpr_log_func func);
|
||||
|
||||
/* abort() the process if x is zero, having written a line to the log.
|
||||
|
||||
Intended for internal invariants. If the error can be recovered from,
|
||||
without the possibility of corruption, or might best be reflected via
|
||||
an exception in a higher-level language, consider returning error code. */
|
||||
#define GPR_ASSERT(x) \
|
||||
do { \
|
||||
if (!(x)) { \
|
||||
gpr_log(GPR_ERROR, "assertion failed: %s", #x); \
|
||||
abort(); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GRPC_SUPPORT_LOG_H */
|
||||
|
|
|
|||
|
|
@ -35,5 +35,94 @@
|
|||
#define GRPC_SUPPORT_SLICE_H
|
||||
|
||||
#include <grpc/impl/codegen/slice.h>
|
||||
#include <grpc/support/sync.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Increment the refcount of s. Requires slice is initialized.
|
||||
Returns s. */
|
||||
GPRAPI gpr_slice gpr_slice_ref(gpr_slice s);
|
||||
|
||||
/* Decrement the ref count of s. If the ref count of s reaches zero, all
|
||||
slices sharing the ref count are destroyed, and considered no longer
|
||||
initialized. If s is ultimately derived from a call to gpr_slice_new(start,
|
||||
len, dest) where dest!=NULL , then (*dest)(start) is called, else if s is
|
||||
ultimately derived from a call to gpr_slice_new_with_len(start, len, dest)
|
||||
where dest!=NULL , then (*dest)(start, len). Requires s initialized. */
|
||||
GPRAPI void gpr_slice_unref(gpr_slice s);
|
||||
|
||||
/* Create a slice pointing at some data. Calls malloc to allocate a refcount
|
||||
for the object, and arranges that destroy will be called with the pointer
|
||||
passed in at destruction. */
|
||||
GPRAPI gpr_slice gpr_slice_new(void *p, size_t len, void (*destroy)(void *));
|
||||
|
||||
/* Equivalent to gpr_slice_new, but with a separate pointer that is
|
||||
passed to the destroy function. This function can be useful when
|
||||
the data is part of a larger structure that must be destroyed when
|
||||
the data is no longer needed. */
|
||||
GPRAPI gpr_slice gpr_slice_new_with_user_data(void *p, size_t len,
|
||||
void (*destroy)(void *),
|
||||
void *user_data);
|
||||
|
||||
/* Equivalent to gpr_slice_new, but with a two argument destroy function that
|
||||
also takes the slice length. */
|
||||
GPRAPI gpr_slice gpr_slice_new_with_len(void *p, size_t len,
|
||||
void (*destroy)(void *, size_t));
|
||||
|
||||
/* Equivalent to gpr_slice_new(malloc(len), len, free), but saves one malloc()
|
||||
call.
|
||||
Aborts if malloc() fails. */
|
||||
GPRAPI gpr_slice gpr_slice_malloc(size_t length);
|
||||
|
||||
/* Create a slice by copying a string.
|
||||
Does not preserve null terminators.
|
||||
Equivalent to:
|
||||
size_t len = strlen(source);
|
||||
gpr_slice slice = gpr_slice_malloc(len);
|
||||
memcpy(slice->data, source, len); */
|
||||
GPRAPI gpr_slice gpr_slice_from_copied_string(const char *source);
|
||||
|
||||
/* Create a slice by copying a buffer.
|
||||
Equivalent to:
|
||||
gpr_slice slice = gpr_slice_malloc(len);
|
||||
memcpy(slice->data, source, len); */
|
||||
GPRAPI gpr_slice gpr_slice_from_copied_buffer(const char *source, size_t len);
|
||||
|
||||
/* Create a slice pointing to constant memory */
|
||||
GPRAPI gpr_slice gpr_slice_from_static_string(const char *source);
|
||||
|
||||
/* Return a result slice derived from s, which shares a ref count with s, where
|
||||
result.data==s.data+begin, and result.length==end-begin.
|
||||
The ref count of s is increased by one.
|
||||
Requires s initialized, begin <= end, begin <= s.length, and
|
||||
end <= source->length. */
|
||||
GPRAPI gpr_slice gpr_slice_sub(gpr_slice s, size_t begin, size_t end);
|
||||
|
||||
/* The same as gpr_slice_sub, but without altering the ref count */
|
||||
GPRAPI gpr_slice gpr_slice_sub_no_ref(gpr_slice s, size_t begin, size_t end);
|
||||
|
||||
/* Splits s into two: modifies s to be s[0:split], and returns a new slice,
|
||||
sharing a refcount with s, that contains s[split:s.length].
|
||||
Requires s intialized, split <= s.length */
|
||||
GPRAPI gpr_slice gpr_slice_split_tail(gpr_slice *s, size_t split);
|
||||
|
||||
/* Splits s into two: modifies s to be s[split:s.length], and returns a new
|
||||
slice, sharing a refcount with s, that contains s[0:split].
|
||||
Requires s intialized, split <= s.length */
|
||||
GPRAPI gpr_slice gpr_slice_split_head(gpr_slice *s, size_t split);
|
||||
|
||||
GPRAPI gpr_slice gpr_empty_slice(void);
|
||||
|
||||
/* Returns <0 if a < b, ==0 if a == b, >0 if a > b
|
||||
The order is arbitrary, and is not guaranteed to be stable across different
|
||||
versions of the API. */
|
||||
GPRAPI int gpr_slice_cmp(gpr_slice a, gpr_slice b);
|
||||
GPRAPI int gpr_slice_str_cmp(gpr_slice a, const char *b);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GRPC_SUPPORT_SLICE_H */
|
||||
|
|
|
|||
|
|
@ -34,6 +34,54 @@
|
|||
#ifndef GRPC_SUPPORT_SLICE_BUFFER_H
|
||||
#define GRPC_SUPPORT_SLICE_BUFFER_H
|
||||
|
||||
#include <grpc/impl/codegen/slice_buffer.h>
|
||||
#include <grpc/support/slice.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* initialize a slice buffer */
|
||||
GPRAPI void gpr_slice_buffer_init(gpr_slice_buffer *sb);
|
||||
/* destroy a slice buffer - unrefs any held elements */
|
||||
GPRAPI void gpr_slice_buffer_destroy(gpr_slice_buffer *sb);
|
||||
/* Add an element to a slice buffer - takes ownership of the slice.
|
||||
This function is allowed to concatenate the passed in slice to the end of
|
||||
some other slice if desired by the slice buffer. */
|
||||
GPRAPI void gpr_slice_buffer_add(gpr_slice_buffer *sb, gpr_slice slice);
|
||||
/* add an element to a slice buffer - takes ownership of the slice and returns
|
||||
the index of the slice.
|
||||
Guarantees that the slice will not be concatenated at the end of another
|
||||
slice (i.e. the data for this slice will begin at the first byte of the
|
||||
slice at the returned index in sb->slices)
|
||||
The implementation MAY decide to concatenate data at the end of a small
|
||||
slice added in this fashion. */
|
||||
GPRAPI size_t gpr_slice_buffer_add_indexed(gpr_slice_buffer *sb,
|
||||
gpr_slice slice);
|
||||
GPRAPI void gpr_slice_buffer_addn(gpr_slice_buffer *sb, gpr_slice *slices,
|
||||
size_t n);
|
||||
/* add a very small (less than 8 bytes) amount of data to the end of a slice
|
||||
buffer: returns a pointer into which to add the data */
|
||||
GPRAPI uint8_t *gpr_slice_buffer_tiny_add(gpr_slice_buffer *sb, size_t len);
|
||||
/* pop the last buffer, but don't unref it */
|
||||
GPRAPI void gpr_slice_buffer_pop(gpr_slice_buffer *sb);
|
||||
/* clear a slice buffer, unref all elements */
|
||||
GPRAPI void gpr_slice_buffer_reset_and_unref(gpr_slice_buffer *sb);
|
||||
/* swap the contents of two slice buffers */
|
||||
GPRAPI void gpr_slice_buffer_swap(gpr_slice_buffer *a, gpr_slice_buffer *b);
|
||||
/* move all of the elements of src into dst */
|
||||
GPRAPI void gpr_slice_buffer_move_into(gpr_slice_buffer *src,
|
||||
gpr_slice_buffer *dst);
|
||||
/* remove n bytes from the end of a slice buffer */
|
||||
GPRAPI void gpr_slice_buffer_trim_end(gpr_slice_buffer *src, size_t n,
|
||||
gpr_slice_buffer *garbage);
|
||||
/* move the first n bytes of src into dst */
|
||||
GPRAPI void gpr_slice_buffer_move_first(gpr_slice_buffer *src, size_t n,
|
||||
gpr_slice_buffer *dst);
|
||||
/* take the first slice in the slice buffer */
|
||||
GPRAPI gpr_slice gpr_slice_buffer_take_first(gpr_slice_buffer *src);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GRPC_SUPPORT_SLICE_BUFFER_H */
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue