grpc 1.3.4 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +581 -450
- data/include/grpc/census.h +49 -49
- data/include/grpc/grpc.h +16 -70
- data/include/grpc/grpc_security.h +59 -59
- data/include/grpc/grpc_security_constants.h +9 -9
- data/include/grpc/impl/codegen/atm.h +1 -1
- data/include/grpc/impl/codegen/atm_windows.h +4 -4
- data/include/grpc/impl/codegen/byte_buffer_reader.h +2 -2
- data/include/grpc/impl/codegen/compression_types.h +4 -5
- data/include/grpc/impl/codegen/gpr_slice.h +5 -5
- data/include/grpc/impl/codegen/gpr_types.h +6 -7
- data/include/grpc/impl/codegen/grpc_types.h +128 -59
- data/include/grpc/impl/codegen/port_platform.h +6 -0
- data/include/grpc/impl/codegen/propagation_bits.h +2 -2
- data/include/grpc/impl/codegen/slice.h +13 -12
- data/include/grpc/impl/codegen/status.h +23 -18
- data/include/grpc/impl/codegen/sync.h +1 -1
- data/include/grpc/load_reporting.h +6 -6
- data/include/grpc/slice.h +47 -25
- data/include/grpc/slice_buffer.h +18 -14
- data/include/grpc/support/alloc.h +7 -7
- data/include/grpc/support/cmdline.h +10 -10
- data/include/grpc/support/cpu.h +3 -3
- data/include/grpc/support/histogram.h +1 -1
- data/include/grpc/support/host_port.h +2 -2
- data/include/grpc/support/log.h +9 -9
- data/include/grpc/support/log_windows.h +1 -1
- data/include/grpc/support/string_util.h +3 -3
- data/include/grpc/support/subprocess.h +3 -3
- data/include/grpc/support/sync.h +31 -31
- data/include/grpc/support/thd.h +11 -11
- data/include/grpc/support/time.h +12 -12
- data/include/grpc/support/tls.h +1 -1
- data/include/grpc/support/tls_gcc.h +2 -2
- data/include/grpc/support/tls_msvc.h +1 -1
- data/include/grpc/support/tls_pthread.h +1 -1
- data/include/grpc/support/useful.h +2 -2
- data/include/grpc/support/workaround_list.h +46 -0
- data/src/core/ext/census/context.c +1 -1
- data/src/core/ext/census/intrusive_hash_map.c +319 -0
- data/src/core/ext/census/intrusive_hash_map.h +167 -0
- data/src/core/ext/census/intrusive_hash_map_internal.h +63 -0
- data/src/core/ext/census/resource.c +3 -1
- data/src/core/ext/filters/client_channel/channel_connectivity.c +1 -1
- data/src/core/ext/filters/client_channel/client_channel.c +173 -103
- data/src/core/ext/filters/client_channel/client_channel_plugin.c +3 -2
- data/src/core/ext/filters/client_channel/lb_policy.c +2 -1
- data/src/core/ext/filters/client_channel/lb_policy.h +8 -7
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.c +153 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h +42 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c +405 -102
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.c +133 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +65 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.c +90 -51
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +7 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +19 -8
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +63 -34
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c +2 -1
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c +188 -294
- data/src/core/ext/filters/client_channel/lb_policy_factory.c +28 -5
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +18 -4
- data/src/core/ext/filters/client_channel/parse_address.c +90 -59
- data/src/core/ext/filters/client_channel/parse_address.h +17 -8
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.c +11 -7
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c +59 -14
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +6 -0
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.c +3 -3
- data/src/core/ext/filters/client_channel/subchannel.c +20 -17
- data/src/core/ext/filters/client_channel/subchannel.h +1 -0
- data/src/core/ext/filters/client_channel/subchannel_index.c +11 -1
- data/src/core/ext/filters/client_channel/uri_parser.c +36 -22
- data/src/core/ext/filters/client_channel/uri_parser.h +1 -1
- data/src/core/{lib/channel → ext/filters/deadline}/deadline_filter.c +42 -17
- data/src/core/{lib/channel → ext/filters/deadline}/deadline_filter.h +8 -9
- data/src/core/{lib/channel → ext/filters/http/client}/http_client_filter.c +19 -11
- data/src/core/{lib/channel → ext/filters/http/client}/http_client_filter.h +3 -6
- data/src/core/ext/filters/http/http_filters_plugin.c +104 -0
- data/src/core/{lib/channel/compress_filter.c → ext/filters/http/message_compress/message_compress_filter.c} +124 -23
- data/src/core/{lib/channel/compress_filter.h → ext/filters/http/message_compress/message_compress_filter.h} +5 -6
- data/src/core/{lib/channel → ext/filters/http/server}/http_server_filter.c +4 -6
- data/src/core/{lib/channel → ext/filters/http/server}/http_server_filter.h +3 -3
- data/src/core/ext/filters/load_reporting/load_reporting.c +2 -25
- data/src/core/ext/filters/load_reporting/load_reporting_filter.c +26 -1
- data/src/core/ext/filters/max_age/max_age_filter.c +14 -14
- data/src/core/{lib/channel → ext/filters/message_size}/message_size_filter.c +91 -47
- data/src/core/{lib/channel → ext/filters/message_size}/message_size_filter.h +3 -3
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c +223 -0
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h +40 -0
- data/src/core/ext/filters/workarounds/workaround_utils.c +65 -0
- data/src/core/ext/filters/workarounds/workaround_utils.h +52 -0
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.c +1 -1
- data/src/core/ext/transport/chttp2/server/chttp2_server.c +3 -2
- data/src/core/ext/transport/chttp2/transport/bin_decoder.c +2 -2
- data/src/core/ext/transport/chttp2/transport/bin_encoder.c +3 -3
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +319 -175
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +3 -2
- data/src/core/ext/transport/chttp2/transport/frame_data.c +203 -164
- data/src/core/ext/transport/chttp2/transport/frame_data.h +8 -14
- data/src/core/ext/transport/chttp2/transport/frame_goaway.c +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_ping.c +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_settings.c +5 -5
- data/src/core/ext/transport/chttp2/transport/frame_window_update.c +1 -1
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.c +4 -4
- data/src/core/ext/transport/chttp2/transport/hpack_parser.c +2 -4
- data/src/core/ext/transport/chttp2/transport/hpack_table.c +4 -3
- data/src/core/ext/transport/chttp2/transport/internal.h +50 -33
- data/src/core/ext/transport/chttp2/transport/parsing.c +10 -11
- data/src/core/ext/transport/chttp2/transport/writing.c +32 -13
- data/src/core/lib/channel/channel_args.c +30 -9
- data/src/core/lib/channel/channel_args.h +5 -1
- data/src/core/lib/channel/channel_stack.c +1 -1
- data/src/core/lib/channel/channel_stack.h +2 -2
- data/src/core/lib/channel/channel_stack_builder.c +13 -1
- data/src/core/lib/channel/channel_stack_builder.h +5 -1
- data/src/core/lib/channel/connected_channel.c +3 -1
- data/src/core/lib/channel/context.h +2 -2
- data/src/core/lib/compression/message_compress.c +2 -2
- data/src/core/lib/debug/trace.c +13 -6
- data/src/core/lib/debug/trace.h +27 -1
- data/src/core/lib/http/httpcli.c +1 -1
- data/src/core/lib/http/httpcli_security_connector.c +9 -11
- data/src/core/lib/http/parser.c +2 -2
- data/src/core/lib/http/parser.h +2 -1
- data/src/core/lib/iomgr/combiner.c +6 -6
- data/src/core/lib/iomgr/combiner.h +2 -1
- data/src/core/lib/iomgr/error.c +12 -5
- data/src/core/lib/iomgr/error.h +13 -13
- data/src/core/lib/iomgr/ev_epoll1_linux.c +984 -0
- data/src/core/lib/iomgr/ev_epoll1_linux.h +44 -0
- data/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.c +2146 -0
- data/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.h +43 -0
- data/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c +1337 -0
- data/src/core/lib/iomgr/ev_epoll_thread_pool_linux.h +43 -0
- data/src/core/lib/iomgr/ev_epollex_linux.c +1511 -0
- data/src/core/lib/iomgr/ev_epollex_linux.h +43 -0
- data/src/core/lib/iomgr/{ev_epoll_linux.c → ev_epollsig_linux.c} +41 -33
- data/src/core/lib/iomgr/{ev_epoll_linux.h → ev_epollsig_linux.h} +4 -4
- data/src/core/lib/iomgr/ev_poll_posix.c +12 -27
- data/src/core/lib/iomgr/ev_poll_posix.h +2 -2
- data/src/core/lib/iomgr/ev_posix.c +22 -8
- data/src/core/lib/iomgr/ev_posix.h +4 -3
- data/src/core/lib/iomgr/ev_windows.c +43 -0
- data/src/core/lib/iomgr/exec_ctx.c +5 -0
- data/src/core/lib/iomgr/exec_ctx.h +2 -0
- data/src/core/lib/iomgr/iomgr.c +4 -0
- data/src/core/lib/iomgr/iomgr.h +3 -0
- data/src/core/lib/iomgr/is_epollexclusive_available.c +116 -0
- data/src/core/lib/iomgr/is_epollexclusive_available.h +41 -0
- data/src/core/lib/iomgr/lockfree_event.c +16 -0
- data/src/core/lib/iomgr/pollset.h +2 -5
- data/src/core/lib/iomgr/pollset_uv.c +1 -1
- data/src/core/lib/iomgr/pollset_windows.c +3 -3
- data/src/core/lib/iomgr/resource_quota.c +9 -8
- data/src/core/lib/iomgr/resource_quota.h +2 -1
- data/src/core/lib/iomgr/sockaddr_utils.h +1 -1
- data/src/core/lib/iomgr/socket_mutator.h +2 -0
- data/src/core/lib/iomgr/sys_epoll_wrapper.h +43 -0
- data/src/core/lib/iomgr/tcp_client_posix.c +6 -6
- data/src/core/lib/iomgr/tcp_client_uv.c +3 -3
- data/src/core/lib/iomgr/tcp_posix.c +7 -7
- data/src/core/lib/iomgr/tcp_posix.h +2 -1
- data/src/core/lib/iomgr/tcp_server_posix.c +1 -1
- data/src/core/lib/iomgr/tcp_uv.c +6 -6
- data/src/core/lib/iomgr/tcp_uv.h +2 -1
- data/src/core/lib/iomgr/tcp_windows.c +1 -1
- data/src/core/lib/iomgr/timer_generic.c +24 -25
- data/src/core/lib/iomgr/timer_manager.c +276 -0
- data/src/core/lib/iomgr/timer_manager.h +52 -0
- data/src/core/lib/iomgr/timer_uv.c +6 -0
- data/src/core/lib/iomgr/udp_server.c +42 -9
- data/src/core/lib/iomgr/udp_server.h +3 -1
- data/src/core/lib/security/credentials/credentials.c +0 -1
- data/src/core/lib/security/credentials/fake/fake_credentials.c +23 -0
- data/src/core/lib/security/credentials/fake/fake_credentials.h +12 -9
- data/src/core/lib/security/credentials/google_default/google_default_credentials.c +1 -1
- data/src/core/lib/security/credentials/jwt/jwt_credentials.c +1 -1
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.c +1 -1
- data/src/core/lib/security/credentials/ssl/ssl_credentials.c +24 -53
- data/src/core/lib/security/transport/client_auth_filter.c +9 -3
- data/src/core/lib/security/transport/secure_endpoint.c +7 -7
- data/src/core/lib/security/transport/secure_endpoint.h +1 -1
- data/src/core/lib/security/transport/security_connector.c +45 -57
- data/src/core/lib/security/transport/security_connector.h +10 -14
- data/src/core/lib/security/transport/security_handshaker.c +123 -97
- data/src/core/lib/slice/b64.c +1 -1
- data/src/core/lib/slice/percent_encoding.c +3 -3
- data/src/core/lib/slice/slice.c +66 -33
- data/src/core/lib/slice/slice_buffer.c +25 -6
- data/src/core/lib/slice/slice_hash_table.c +33 -35
- data/src/core/lib/slice/slice_hash_table.h +7 -12
- data/src/core/lib/support/atomic.h +45 -0
- data/src/core/lib/support/atomic_with_atm.h +70 -0
- data/src/core/lib/support/atomic_with_std.h +48 -0
- data/src/core/lib/support/avl.c +14 -14
- data/src/core/lib/support/cmdline.c +3 -3
- data/src/core/lib/support/histogram.c +2 -2
- data/src/core/lib/support/host_port.c +1 -1
- data/src/core/lib/support/memory.h +74 -0
- data/src/core/lib/support/mpscq.c +36 -2
- data/src/core/lib/support/mpscq.h +28 -1
- data/src/core/lib/support/stack_lockfree.c +3 -36
- data/src/core/lib/support/string.c +12 -12
- data/src/core/lib/support/string_posix.c +1 -1
- data/src/core/lib/support/subprocess_posix.c +2 -2
- data/src/core/lib/support/thd_posix.c +1 -1
- data/src/core/lib/support/time_posix.c +8 -0
- data/src/core/lib/support/tmpfile_posix.c +10 -10
- data/src/core/lib/surface/alarm.c +3 -1
- data/src/core/lib/surface/api_trace.c +2 -1
- data/src/core/lib/surface/api_trace.h +2 -2
- data/src/core/lib/surface/byte_buffer_reader.c +1 -1
- data/src/core/lib/surface/call.c +65 -22
- data/src/core/lib/surface/call.h +4 -2
- data/src/core/lib/surface/channel_init.c +2 -19
- data/src/core/lib/surface/channel_stack_type.c +18 -0
- data/src/core/lib/surface/channel_stack_type.h +2 -0
- data/src/core/lib/surface/completion_queue.c +694 -247
- data/src/core/lib/surface/completion_queue.h +30 -13
- data/src/core/lib/surface/completion_queue_factory.c +24 -9
- data/src/core/lib/surface/init.c +1 -52
- data/src/core/lib/surface/{lame_client.c → lame_client.cc} +37 -26
- data/src/core/lib/surface/server.c +79 -110
- data/src/core/lib/surface/server.h +2 -1
- data/src/core/lib/surface/version.c +2 -2
- data/src/core/lib/transport/bdp_estimator.c +25 -9
- data/src/core/lib/transport/bdp_estimator.h +7 -1
- data/src/core/lib/transport/byte_stream.c +23 -9
- data/src/core/lib/transport/byte_stream.h +15 -6
- data/src/core/lib/transport/connectivity_state.c +6 -6
- data/src/core/lib/transport/connectivity_state.h +2 -1
- data/src/core/lib/transport/service_config.c +6 -13
- data/src/core/lib/transport/service_config.h +2 -2
- data/src/core/lib/transport/static_metadata.c +403 -389
- data/src/core/lib/transport/static_metadata.h +127 -114
- data/src/core/plugin_registry/grpc_plugin_registry.c +16 -0
- data/src/core/tsi/fake_transport_security.c +5 -4
- data/src/core/tsi/ssl_transport_security.c +71 -82
- data/src/core/tsi/ssl_transport_security.h +39 -61
- data/src/core/tsi/transport_security.c +83 -2
- data/src/core/tsi/transport_security.h +27 -2
- data/src/core/tsi/transport_security_adapter.c +236 -0
- data/src/core/tsi/transport_security_adapter.h +62 -0
- data/src/core/tsi/transport_security_interface.h +179 -66
- data/src/ruby/ext/grpc/extconf.rb +2 -1
- data/src/ruby/ext/grpc/rb_byte_buffer.c +8 -6
- data/src/ruby/ext/grpc/rb_call.c +56 -48
- data/src/ruby/ext/grpc/rb_call.h +3 -4
- data/src/ruby/ext/grpc/rb_call_credentials.c +23 -22
- data/src/ruby/ext/grpc/rb_channel.c +2 -3
- data/src/ruby/ext/grpc/rb_channel_args.c +11 -9
- data/src/ruby/ext/grpc/rb_channel_credentials.c +16 -12
- data/src/ruby/ext/grpc/rb_completion_queue.c +7 -9
- data/src/ruby/ext/grpc/rb_compression_options.c +7 -6
- data/src/ruby/ext/grpc/rb_event_thread.c +10 -12
- data/src/ruby/ext/grpc/rb_event_thread.h +1 -2
- data/src/ruby/ext/grpc/rb_grpc.c +11 -15
- data/src/ruby/ext/grpc/rb_grpc.h +2 -2
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +16 -6
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +25 -10
- data/src/ruby/ext/grpc/rb_server.c +26 -28
- data/src/ruby/lib/grpc/grpc.rb +1 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/third_party/cares/config_linux/ares_config.h +36 -2
- data/third_party/zlib/adler32.c +14 -7
- data/third_party/zlib/compress.c +24 -18
- data/third_party/zlib/crc32.c +29 -12
- data/third_party/zlib/deflate.c +499 -303
- data/third_party/zlib/deflate.h +19 -16
- data/third_party/zlib/gzguts.h +16 -7
- data/third_party/zlib/gzlib.c +17 -14
- data/third_party/zlib/gzread.c +108 -48
- data/third_party/zlib/gzwrite.c +210 -122
- data/third_party/zlib/infback.c +2 -2
- data/third_party/zlib/inffast.c +34 -51
- data/third_party/zlib/inflate.c +86 -37
- data/third_party/zlib/inflate.h +7 -4
- data/third_party/zlib/inftrees.c +12 -14
- data/third_party/zlib/trees.c +38 -61
- data/third_party/zlib/uncompr.c +66 -32
- data/third_party/zlib/zconf.h +32 -9
- data/third_party/zlib/zlib.h +298 -154
- data/third_party/zlib/zutil.c +25 -24
- data/third_party/zlib/zutil.h +35 -17
- metadata +63 -30
@@ -44,26 +44,26 @@ extern "C" {
|
|
44
44
|
|
45
45
|
typedef struct gpr_allocation_functions {
|
46
46
|
void *(*malloc_fn)(size_t size);
|
47
|
-
void *(*zalloc_fn)(size_t size);
|
47
|
+
void *(*zalloc_fn)(size_t size); /** if NULL, uses malloc_fn then memset */
|
48
48
|
void *(*realloc_fn)(void *ptr, size_t size);
|
49
49
|
void (*free_fn)(void *ptr);
|
50
50
|
} gpr_allocation_functions;
|
51
51
|
|
52
|
-
|
52
|
+
/** malloc.
|
53
53
|
* If size==0, always returns NULL. Otherwise this function never returns NULL.
|
54
54
|
* The pointer returned is suitably aligned for any kind of variable it could
|
55
55
|
* contain.
|
56
56
|
*/
|
57
57
|
GPRAPI void *gpr_malloc(size_t size);
|
58
|
-
|
58
|
+
/** like malloc, but zero all bytes before returning them */
|
59
59
|
GPRAPI void *gpr_zalloc(size_t size);
|
60
|
-
|
60
|
+
/** free */
|
61
61
|
GPRAPI void gpr_free(void *ptr);
|
62
|
-
|
62
|
+
/** realloc, never returns NULL */
|
63
63
|
GPRAPI void *gpr_realloc(void *p, size_t size);
|
64
|
-
|
64
|
+
/** aligned malloc, never returns NULL, will align to 1 << alignment_log */
|
65
65
|
GPRAPI void *gpr_malloc_aligned(size_t size, size_t alignment_log);
|
66
|
-
|
66
|
+
/** free memory allocated by gpr_malloc_aligned */
|
67
67
|
GPRAPI void gpr_free_aligned(void *ptr);
|
68
68
|
|
69
69
|
/** Request the family of allocation functions in \a functions be used. NOTE
|
@@ -40,7 +40,7 @@
|
|
40
40
|
extern "C" {
|
41
41
|
#endif
|
42
42
|
|
43
|
-
|
43
|
+
/** Simple command line parser.
|
44
44
|
|
45
45
|
Supports flags that can be specified as -foo, --foo, --no-foo, -no-foo, etc
|
46
46
|
And integers, strings that can be specified as -foo=4, -foo blah, etc
|
@@ -68,32 +68,32 @@ extern "C" {
|
|
68
68
|
|
69
69
|
typedef struct gpr_cmdline gpr_cmdline;
|
70
70
|
|
71
|
-
|
71
|
+
/** Construct a command line parser: takes a short description of the tool
|
72
72
|
doing the parsing */
|
73
73
|
GPRAPI gpr_cmdline *gpr_cmdline_create(const char *description);
|
74
|
-
|
74
|
+
/** Add an integer parameter, with a name (used on the command line) and some
|
75
75
|
helpful text (used in the command usage) */
|
76
76
|
GPRAPI void gpr_cmdline_add_int(gpr_cmdline *cl, const char *name,
|
77
77
|
const char *help, int *value);
|
78
|
-
|
78
|
+
/** The same, for a boolean flag */
|
79
79
|
GPRAPI void gpr_cmdline_add_flag(gpr_cmdline *cl, const char *name,
|
80
80
|
const char *help, int *value);
|
81
|
-
|
81
|
+
/** And for a string */
|
82
82
|
GPRAPI void gpr_cmdline_add_string(gpr_cmdline *cl, const char *name,
|
83
83
|
const char *help, char **value);
|
84
|
-
|
84
|
+
/** Set a callback for non-named arguments */
|
85
85
|
GPRAPI void gpr_cmdline_on_extra_arg(
|
86
86
|
gpr_cmdline *cl, const char *name, const char *help,
|
87
87
|
void (*on_extra_arg)(void *user_data, const char *arg), void *user_data);
|
88
|
-
|
88
|
+
/** Enable surviving failure: default behavior is to exit the process */
|
89
89
|
GPRAPI void gpr_cmdline_set_survive_failure(gpr_cmdline *cl);
|
90
|
-
|
90
|
+
/** Parse the command line; returns 1 on success, on failure either dies
|
91
91
|
(by default) or returns 0 if gpr_cmdline_set_survive_failure() has been
|
92
92
|
called */
|
93
93
|
GPRAPI int gpr_cmdline_parse(gpr_cmdline *cl, int argc, char **argv);
|
94
|
-
|
94
|
+
/** Destroy the parser */
|
95
95
|
GPRAPI void gpr_cmdline_destroy(gpr_cmdline *cl);
|
96
|
-
|
96
|
+
/** Get a string describing usage */
|
97
97
|
GPRAPI char *gpr_cmdline_usage_string(gpr_cmdline *cl, const char *argv0);
|
98
98
|
|
99
99
|
#ifdef __cplusplus
|
data/include/grpc/support/cpu.h
CHANGED
@@ -40,13 +40,13 @@
|
|
40
40
|
extern "C" {
|
41
41
|
#endif
|
42
42
|
|
43
|
-
|
43
|
+
/** Interface providing CPU information for currently running system */
|
44
44
|
|
45
|
-
|
45
|
+
/** Return the number of CPU cores on the current system. Will return 0 if
|
46
46
|
the information is not available. */
|
47
47
|
GPRAPI unsigned gpr_cpu_num_cores(void);
|
48
48
|
|
49
|
-
|
49
|
+
/** Return the CPU on which the current thread is executing; N.B. This should
|
50
50
|
be considered advisory only - it is possible that the thread is switched
|
51
51
|
to a different CPU at any time. Returns a value in range
|
52
52
|
[0, gpr_cpu_num_cores() - 1] */
|
@@ -48,7 +48,7 @@ GPRAPI gpr_histogram *gpr_histogram_create(double resolution,
|
|
48
48
|
GPRAPI void gpr_histogram_destroy(gpr_histogram *h);
|
49
49
|
GPRAPI void gpr_histogram_add(gpr_histogram *h, double x);
|
50
50
|
|
51
|
-
|
51
|
+
/** The following merges the second histogram into the first. It only works
|
52
52
|
if they have the same buckets and resolution. Returns 0 on failure, 1
|
53
53
|
on success */
|
54
54
|
GPRAPI int gpr_histogram_merge(gpr_histogram *dst, const gpr_histogram *src);
|
@@ -40,7 +40,7 @@
|
|
40
40
|
extern "C" {
|
41
41
|
#endif
|
42
42
|
|
43
|
-
|
43
|
+
/** Given a host and port, creates a newly-allocated string of the form
|
44
44
|
"host:port" or "[ho:st]:port", depending on whether the host contains colons
|
45
45
|
like an IPv6 literal. If the host is already bracketed, then additional
|
46
46
|
brackets will not be added.
|
@@ -52,7 +52,7 @@ extern "C" {
|
|
52
52
|
In the unlikely event of an error, returns -1 and sets *out to NULL. */
|
53
53
|
GPRAPI int gpr_join_host_port(char **out, const char *host, int port);
|
54
54
|
|
55
|
-
|
55
|
+
/** Given a name in the form "host:port" or "[ho:st]:port", split into hostname
|
56
56
|
and port number, into newly allocated strings, which must later be
|
57
57
|
destroyed using gpr_free().
|
58
58
|
Return 1 on success, 0 on failure. Guarantees *host and *port == NULL on
|
data/include/grpc/support/log.h
CHANGED
@@ -44,7 +44,7 @@
|
|
44
44
|
extern "C" {
|
45
45
|
#endif
|
46
46
|
|
47
|
-
|
47
|
+
/** GPR log API.
|
48
48
|
|
49
49
|
Usage (within grpc):
|
50
50
|
|
@@ -54,7 +54,7 @@ extern "C" {
|
|
54
54
|
gpr_log(GPR_INFO, "hello world");
|
55
55
|
gpr_log(GPR_ERROR, "%d %s!!", argument1, argument2); */
|
56
56
|
|
57
|
-
|
57
|
+
/** The severity of a log message - use the #defines below when calling into
|
58
58
|
gpr_log to additionally supply file and line data */
|
59
59
|
typedef enum gpr_log_severity {
|
60
60
|
GPR_LOG_SEVERITY_DEBUG,
|
@@ -64,15 +64,15 @@ typedef enum gpr_log_severity {
|
|
64
64
|
|
65
65
|
#define GPR_LOG_VERBOSITY_UNSET -1
|
66
66
|
|
67
|
-
|
68
|
-
const char *gpr_log_severity_string(gpr_log_severity severity);
|
67
|
+
/** Returns a string representation of the log severity */
|
68
|
+
GPRAPI const char *gpr_log_severity_string(gpr_log_severity severity);
|
69
69
|
|
70
|
-
|
70
|
+
/** Macros to build log contexts at various severity levels */
|
71
71
|
#define GPR_DEBUG __FILE__, __LINE__, GPR_LOG_SEVERITY_DEBUG
|
72
72
|
#define GPR_INFO __FILE__, __LINE__, GPR_LOG_SEVERITY_INFO
|
73
73
|
#define GPR_ERROR __FILE__, __LINE__, GPR_LOG_SEVERITY_ERROR
|
74
74
|
|
75
|
-
|
75
|
+
/** Log a message. It's advised to use GPR_xxx above to generate the context
|
76
76
|
* for each message */
|
77
77
|
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity,
|
78
78
|
const char *format, ...) GPR_PRINT_FORMAT_CHECK(4, 5);
|
@@ -80,12 +80,12 @@ GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity,
|
|
80
80
|
GPRAPI void gpr_log_message(const char *file, int line,
|
81
81
|
gpr_log_severity severity, const char *message);
|
82
82
|
|
83
|
-
|
83
|
+
/** Set global log verbosity */
|
84
84
|
GPRAPI void gpr_set_log_verbosity(gpr_log_severity min_severity_to_print);
|
85
85
|
|
86
86
|
GPRAPI void gpr_log_verbosity_init();
|
87
87
|
|
88
|
-
|
88
|
+
/** Log overrides: applications can use this API to intercept logging calls
|
89
89
|
and use their own implementations */
|
90
90
|
|
91
91
|
typedef struct {
|
@@ -98,7 +98,7 @@ typedef struct {
|
|
98
98
|
typedef void (*gpr_log_func)(gpr_log_func_args *args);
|
99
99
|
GPRAPI void gpr_set_log_function(gpr_log_func func);
|
100
100
|
|
101
|
-
|
101
|
+
/** abort() the process if x is zero, having written a line to the log.
|
102
102
|
|
103
103
|
Intended for internal invariants. If the error can be recovered from,
|
104
104
|
without the possibility of corruption, or might best be reflected via
|
@@ -40,7 +40,7 @@
|
|
40
40
|
extern "C" {
|
41
41
|
#endif
|
42
42
|
|
43
|
-
|
43
|
+
/** Returns a string allocated with gpr_malloc that contains a UTF-8
|
44
44
|
* formatted error message, corresponding to the error messageid.
|
45
45
|
* Use in conjunction with GetLastError() et al.
|
46
46
|
*/
|
@@ -40,13 +40,13 @@
|
|
40
40
|
extern "C" {
|
41
41
|
#endif
|
42
42
|
|
43
|
-
|
43
|
+
/** String utility functions */
|
44
44
|
|
45
|
-
|
45
|
+
/** Returns a copy of src that can be passed to gpr_free().
|
46
46
|
If allocation fails or if src is NULL, returns NULL. */
|
47
47
|
GPRAPI char *gpr_strdup(const char *src);
|
48
48
|
|
49
|
-
|
49
|
+
/** printf to a newly-allocated string. The set of supported formats may vary
|
50
50
|
between platforms.
|
51
51
|
|
52
52
|
On success, returns the number of bytes printed (excluding the final '\0'),
|
@@ -42,13 +42,13 @@ extern "C" {
|
|
42
42
|
|
43
43
|
typedef struct gpr_subprocess gpr_subprocess;
|
44
44
|
|
45
|
-
|
45
|
+
/** .exe on windows, empty on unices */
|
46
46
|
GPRAPI const char *gpr_subprocess_binary_extension();
|
47
47
|
|
48
48
|
GPRAPI gpr_subprocess *gpr_subprocess_create(int argc, const char **argv);
|
49
|
-
|
49
|
+
/** if subprocess has not been joined, kill it */
|
50
50
|
GPRAPI void gpr_subprocess_destroy(gpr_subprocess *p);
|
51
|
-
|
51
|
+
/** returns exit status; can be called at most once */
|
52
52
|
GPRAPI int gpr_subprocess_join(gpr_subprocess *p);
|
53
53
|
GPRAPI void gpr_subprocess_interrupt(gpr_subprocess *p);
|
54
54
|
|
data/include/grpc/support/sync.h
CHANGED
@@ -41,49 +41,49 @@
|
|
41
41
|
extern "C" {
|
42
42
|
#endif
|
43
43
|
|
44
|
-
|
44
|
+
/** --- Mutex interface ---
|
45
45
|
|
46
46
|
At most one thread may hold an exclusive lock on a mutex at any given time.
|
47
47
|
Actions taken by a thread that holds a mutex exclusively happen after
|
48
48
|
actions taken by all previous holders of the mutex. Variables of type
|
49
49
|
gpr_mu are uninitialized when first declared. */
|
50
50
|
|
51
|
-
|
51
|
+
/** Initialize *mu. Requires: *mu uninitialized. */
|
52
52
|
GPRAPI void gpr_mu_init(gpr_mu *mu);
|
53
53
|
|
54
|
-
|
54
|
+
/** Cause *mu no longer to be initialized, freeing any memory in use. Requires:
|
55
55
|
*mu initialized; no other concurrent operation on *mu. */
|
56
56
|
GPRAPI void gpr_mu_destroy(gpr_mu *mu);
|
57
57
|
|
58
|
-
|
58
|
+
/** Wait until no thread has a lock on *mu, cause the calling thread to own an
|
59
59
|
exclusive lock on *mu, then return. May block indefinitely or crash if the
|
60
60
|
calling thread has a lock on *mu. Requires: *mu initialized. */
|
61
61
|
GPRAPI void gpr_mu_lock(gpr_mu *mu);
|
62
62
|
|
63
|
-
|
63
|
+
/** Release an exclusive lock on *mu held by the calling thread. Requires: *mu
|
64
64
|
initialized; the calling thread holds an exclusive lock on *mu. */
|
65
65
|
GPRAPI void gpr_mu_unlock(gpr_mu *mu);
|
66
66
|
|
67
|
-
|
67
|
+
/** Without blocking, attempt to acquire an exclusive lock on *mu for the
|
68
68
|
calling thread, then return non-zero iff success. Fail, if any thread holds
|
69
69
|
the lock; succeeds with high probability if no thread holds the lock.
|
70
70
|
Requires: *mu initialized. */
|
71
71
|
GPRAPI int gpr_mu_trylock(gpr_mu *mu);
|
72
72
|
|
73
|
-
|
73
|
+
/** --- Condition variable interface ---
|
74
74
|
|
75
75
|
A while-loop should be used with gpr_cv_wait() when waiting for conditions
|
76
76
|
to become true. See the example below. Variables of type gpr_cv are
|
77
77
|
uninitialized when first declared. */
|
78
78
|
|
79
|
-
|
79
|
+
/** Initialize *cv. Requires: *cv uninitialized. */
|
80
80
|
GPRAPI void gpr_cv_init(gpr_cv *cv);
|
81
81
|
|
82
|
-
|
82
|
+
/** Cause *cv no longer to be initialized, freeing any memory in use. Requires:
|
83
83
|
*cv initialized; no other concurrent operation on *cv.*/
|
84
84
|
GPRAPI void gpr_cv_destroy(gpr_cv *cv);
|
85
85
|
|
86
|
-
|
86
|
+
/** Atomically release *mu and wait on *cv. When the calling thread is woken
|
87
87
|
from *cv or the deadline abs_deadline is exceeded, execute gpr_mu_lock(mu)
|
88
88
|
and return whether the deadline was exceeded. Use
|
89
89
|
abs_deadline==gpr_inf_future for no deadline. abs_deadline can be either
|
@@ -92,83 +92,83 @@ GPRAPI void gpr_cv_destroy(gpr_cv *cv);
|
|
92
92
|
holds an exclusive lock on *mu. */
|
93
93
|
GPRAPI int gpr_cv_wait(gpr_cv *cv, gpr_mu *mu, gpr_timespec abs_deadline);
|
94
94
|
|
95
|
-
|
95
|
+
/** If any threads are waiting on *cv, wake at least one.
|
96
96
|
Clients may treat this as an optimization of gpr_cv_broadcast()
|
97
97
|
for use in the case where waking more than one waiter is not useful.
|
98
98
|
Requires: *cv initialized. */
|
99
99
|
GPRAPI void gpr_cv_signal(gpr_cv *cv);
|
100
100
|
|
101
|
-
|
101
|
+
/** Wake all threads waiting on *cv. Requires: *cv initialized. */
|
102
102
|
GPRAPI void gpr_cv_broadcast(gpr_cv *cv);
|
103
103
|
|
104
|
-
|
104
|
+
/** --- One-time initialization ---
|
105
105
|
|
106
106
|
gpr_once must be declared with static storage class, and initialized with
|
107
107
|
GPR_ONCE_INIT. e.g.,
|
108
108
|
static gpr_once once_var = GPR_ONCE_INIT; */
|
109
109
|
|
110
|
-
|
110
|
+
/** Ensure that (*init_routine)() has been called exactly once (for the
|
111
111
|
specified gpr_once instance) and then return.
|
112
112
|
If multiple threads call gpr_once() on the same gpr_once instance, one of
|
113
113
|
them will call (*init_routine)(), and the others will block until that call
|
114
114
|
finishes.*/
|
115
115
|
GPRAPI void gpr_once_init(gpr_once *once, void (*init_routine)(void));
|
116
116
|
|
117
|
-
|
117
|
+
/** --- One-time event notification ---
|
118
118
|
|
119
119
|
These operations act on a gpr_event, which should be initialized with
|
120
120
|
gpr_ev_init(), or with GPR_EVENT_INIT if static, e.g.,
|
121
121
|
static gpr_event event_var = GPR_EVENT_INIT;
|
122
122
|
It requires no destruction. */
|
123
123
|
|
124
|
-
|
124
|
+
/** Initialize *ev. */
|
125
125
|
GPRAPI void gpr_event_init(gpr_event *ev);
|
126
126
|
|
127
|
-
|
127
|
+
/** Set *ev so that gpr_event_get() and gpr_event_wait() will return value.
|
128
128
|
Requires: *ev initialized; value != NULL; no prior or concurrent calls to
|
129
129
|
gpr_event_set(ev, ...) since initialization. */
|
130
130
|
GPRAPI void gpr_event_set(gpr_event *ev, void *value);
|
131
131
|
|
132
|
-
|
132
|
+
/** Return the value set by gpr_event_set(ev, ...), or NULL if no such call has
|
133
133
|
completed. If the result is non-NULL, all operations that occurred prior to
|
134
134
|
the gpr_event_set(ev, ...) set will be visible after this call returns.
|
135
135
|
Requires: *ev initialized. This operation is faster than acquiring a mutex
|
136
136
|
on most platforms. */
|
137
137
|
GPRAPI void *gpr_event_get(gpr_event *ev);
|
138
138
|
|
139
|
-
|
139
|
+
/** Wait until *ev is set by gpr_event_set(ev, ...), or abs_deadline is
|
140
140
|
exceeded, then return gpr_event_get(ev). Requires: *ev initialized. Use
|
141
141
|
abs_deadline==gpr_inf_future for no deadline. When the event has been
|
142
142
|
signalled before the call, this operation is faster than acquiring a mutex
|
143
143
|
on most platforms. */
|
144
144
|
GPRAPI void *gpr_event_wait(gpr_event *ev, gpr_timespec abs_deadline);
|
145
145
|
|
146
|
-
|
146
|
+
/** --- Reference counting ---
|
147
147
|
|
148
148
|
These calls act on the type gpr_refcount. It requires no destruction. */
|
149
149
|
|
150
|
-
|
150
|
+
/** Initialize *r to value n. */
|
151
151
|
GPRAPI void gpr_ref_init(gpr_refcount *r, int n);
|
152
152
|
|
153
|
-
|
153
|
+
/** Increment the reference count *r. Requires *r initialized. */
|
154
154
|
GPRAPI void gpr_ref(gpr_refcount *r);
|
155
155
|
|
156
|
-
|
156
|
+
/** Increment the reference count *r. Requires *r initialized.
|
157
157
|
Crashes if refcount is zero */
|
158
158
|
GPRAPI void gpr_ref_non_zero(gpr_refcount *r);
|
159
159
|
|
160
|
-
|
160
|
+
/** Increment the reference count *r by n. Requires *r initialized, n > 0. */
|
161
161
|
GPRAPI void gpr_refn(gpr_refcount *r, int n);
|
162
162
|
|
163
|
-
|
163
|
+
/** Decrement the reference count *r and return non-zero iff it has reached
|
164
164
|
zero. . Requires *r initialized. */
|
165
165
|
GPRAPI int gpr_unref(gpr_refcount *r);
|
166
166
|
|
167
|
-
|
167
|
+
/** Return non-zero iff the reference count of *r is one, and thus is owned
|
168
168
|
by exactly one object. */
|
169
169
|
GPRAPI int gpr_ref_is_unique(gpr_refcount *r);
|
170
170
|
|
171
|
-
|
171
|
+
/** --- Stats counters ---
|
172
172
|
|
173
173
|
These calls act on the integral type gpr_stats_counter. It requires no
|
174
174
|
destruction. Static instances may be initialized with
|
@@ -176,16 +176,16 @@ GPRAPI int gpr_ref_is_unique(gpr_refcount *r);
|
|
176
176
|
Beware: These operations do not imply memory barriers. Do not use them to
|
177
177
|
synchronize other events. */
|
178
178
|
|
179
|
-
|
179
|
+
/** Initialize *c to the value n. */
|
180
180
|
GPRAPI void gpr_stats_init(gpr_stats_counter *c, intptr_t n);
|
181
181
|
|
182
|
-
|
182
|
+
/** *c += inc. Requires: *c initialized. */
|
183
183
|
GPRAPI void gpr_stats_inc(gpr_stats_counter *c, intptr_t inc);
|
184
184
|
|
185
|
-
|
185
|
+
/** Return *c. Requires: *c initialized. */
|
186
186
|
GPRAPI intptr_t gpr_stats_read(const gpr_stats_counter *c);
|
187
187
|
|
188
|
-
|
188
|
+
/** ==================Example use of interface===================
|
189
189
|
A producer-consumer queue of up to N integers,
|
190
190
|
illustrating the use of the calls in this interface. */
|
191
191
|
#if 0
|
data/include/grpc/support/thd.h
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
|
34
34
|
#ifndef GRPC_SUPPORT_THD_H
|
35
35
|
#define GRPC_SUPPORT_THD_H
|
36
|
-
|
36
|
+
/** Thread interface for GPR.
|
37
37
|
|
38
38
|
Types
|
39
39
|
gpr_thd_id a thread identifier.
|
@@ -50,37 +50,37 @@ extern "C" {
|
|
50
50
|
|
51
51
|
typedef uintptr_t gpr_thd_id;
|
52
52
|
|
53
|
-
|
53
|
+
/** Thread creation options. */
|
54
54
|
typedef struct {
|
55
|
-
int flags;
|
55
|
+
int flags; /** Opaque field. Get and set with accessors below. */
|
56
56
|
} gpr_thd_options;
|
57
57
|
|
58
|
-
|
58
|
+
/** Create a new thread running (*thd_body)(arg) and place its thread identifier
|
59
59
|
in *t, and return true. If there are insufficient resources, return false.
|
60
60
|
If options==NULL, default options are used.
|
61
61
|
The thread is immediately runnable, and exits when (*thd_body)() returns. */
|
62
62
|
GPRAPI int gpr_thd_new(gpr_thd_id *t, void (*thd_body)(void *arg), void *arg,
|
63
63
|
const gpr_thd_options *options);
|
64
64
|
|
65
|
-
|
65
|
+
/** Return a gpr_thd_options struct with all fields set to defaults. */
|
66
66
|
GPRAPI gpr_thd_options gpr_thd_options_default(void);
|
67
67
|
|
68
|
-
|
68
|
+
/** Set the thread to become detached on startup - this is the default. */
|
69
69
|
GPRAPI void gpr_thd_options_set_detached(gpr_thd_options *options);
|
70
70
|
|
71
|
-
|
71
|
+
/** Set the thread to become joinable - mutually exclusive with detached. */
|
72
72
|
GPRAPI void gpr_thd_options_set_joinable(gpr_thd_options *options);
|
73
73
|
|
74
|
-
|
74
|
+
/** Returns non-zero if the option detached is set. */
|
75
75
|
GPRAPI int gpr_thd_options_is_detached(const gpr_thd_options *options);
|
76
76
|
|
77
|
-
|
77
|
+
/** Returns non-zero if the option joinable is set. */
|
78
78
|
GPRAPI int gpr_thd_options_is_joinable(const gpr_thd_options *options);
|
79
79
|
|
80
|
-
|
80
|
+
/** Returns the identifier of the current thread. */
|
81
81
|
GPRAPI gpr_thd_id gpr_thd_currentid(void);
|
82
82
|
|
83
|
-
|
83
|
+
/** Blocks until the specified thread properly terminates.
|
84
84
|
Calling this on a detached thread has unpredictable results. */
|
85
85
|
GPRAPI void gpr_thd_join(gpr_thd_id t);
|
86
86
|
|