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
@@ -290,6 +290,12 @@
|
|
290
290
|
#endif
|
291
291
|
#endif /* GPR_NO_AUTODETECT_PLATFORM */
|
292
292
|
|
293
|
+
#if defined(__has_include)
|
294
|
+
#if __has_include(<atomic>)
|
295
|
+
#define GRPC_HAS_CXX11_ATOMIC
|
296
|
+
#endif /* __has_include(<atomic>) */
|
297
|
+
#endif /* defined(__has_include) */
|
298
|
+
|
293
299
|
#ifndef GPR_PLATFORM_STRING
|
294
300
|
#warning "GPR_PLATFORM_STRING not auto-detected"
|
295
301
|
#define GPR_PLATFORM_STRING "unknown"
|
@@ -40,7 +40,7 @@
|
|
40
40
|
extern "C" {
|
41
41
|
#endif
|
42
42
|
|
43
|
-
|
43
|
+
/** Propagation bits: this can be bitwise or-ed to form propagation_mask for
|
44
44
|
* grpc_call */
|
45
45
|
/** Propagate deadline */
|
46
46
|
#define GRPC_PROPAGATE_DEADLINE ((uint32_t)1)
|
@@ -50,7 +50,7 @@ extern "C" {
|
|
50
50
|
/** Propagate cancellation */
|
51
51
|
#define GRPC_PROPAGATE_CANCELLATION ((uint32_t)8)
|
52
52
|
|
53
|
-
|
53
|
+
/** Default propagation mask: clients of the core API are encouraged to encode
|
54
54
|
deltas from this in their implementations... ie write:
|
55
55
|
GRPC_PROPAGATE_DEFAULTS & ~GRPC_PROPAGATE_DEADLINE to disable deadline
|
56
56
|
propagation. Doing so gives flexibility in the future to define new
|
@@ -34,15 +34,16 @@
|
|
34
34
|
#ifndef GRPC_IMPL_CODEGEN_SLICE_H
|
35
35
|
#define GRPC_IMPL_CODEGEN_SLICE_H
|
36
36
|
|
37
|
+
#include <grpc/impl/codegen/port_platform.h>
|
38
|
+
|
37
39
|
#include <stddef.h>
|
38
|
-
#include <stdint.h>
|
39
40
|
|
40
41
|
#include <grpc/impl/codegen/exec_ctx_fwd.h>
|
41
42
|
#include <grpc/impl/codegen/gpr_slice.h>
|
42
43
|
|
43
44
|
typedef struct grpc_slice grpc_slice;
|
44
45
|
|
45
|
-
|
46
|
+
/** Slice API
|
46
47
|
|
47
48
|
A slice represents a contiguous reference counted array of bytes.
|
48
49
|
It is cheap to take references to a slice, and it is cheap to create a
|
@@ -62,14 +63,14 @@ typedef struct grpc_slice_refcount_vtable {
|
|
62
63
|
uint32_t (*hash)(grpc_slice slice);
|
63
64
|
} grpc_slice_refcount_vtable;
|
64
65
|
|
65
|
-
|
66
|
+
/** Reference count container for grpc_slice. Contains function pointers to
|
66
67
|
increment and decrement reference counts. Implementations should cleanup
|
67
68
|
when the reference count drops to zero.
|
68
69
|
Typically client code should not touch this, and use grpc_slice_malloc,
|
69
70
|
grpc_slice_new, or grpc_slice_new_with_len instead. */
|
70
71
|
typedef struct grpc_slice_refcount {
|
71
72
|
const grpc_slice_refcount_vtable *vtable;
|
72
|
-
|
73
|
+
/** If a subset of this slice is taken, use this pointer for the refcount.
|
73
74
|
Typically points back to the refcount itself, however iterning
|
74
75
|
implementations can use this to avoid a verification step on each hash
|
75
76
|
or equality check */
|
@@ -78,7 +79,7 @@ typedef struct grpc_slice_refcount {
|
|
78
79
|
|
79
80
|
#define GRPC_SLICE_INLINED_SIZE (sizeof(size_t) + sizeof(uint8_t *) - 1)
|
80
81
|
|
81
|
-
|
82
|
+
/** A grpc_slice s, if initialized, represents the byte range
|
82
83
|
s.bytes[0..s.length-1].
|
83
84
|
|
84
85
|
It can have an associated ref count which has a destruction routine to be run
|
@@ -103,23 +104,23 @@ struct grpc_slice {
|
|
103
104
|
|
104
105
|
#define GRPC_SLICE_BUFFER_INLINE_ELEMENTS 8
|
105
106
|
|
106
|
-
|
107
|
+
/** Represents an expandable array of slices, to be interpreted as a
|
107
108
|
single item. */
|
108
109
|
typedef struct {
|
109
|
-
|
110
|
+
/** This is for internal use only. External users (i.e any code outside grpc
|
110
111
|
* core) MUST NOT use this field */
|
111
112
|
grpc_slice *base_slices;
|
112
113
|
|
113
|
-
|
114
|
+
/** slices in the array (Points to the first valid grpc_slice in the array) */
|
114
115
|
grpc_slice *slices;
|
115
|
-
|
116
|
+
/** the number of slices in the array */
|
116
117
|
size_t count;
|
117
|
-
|
118
|
+
/** the number of slices allocated in the array. External users (i.e any code
|
118
119
|
* outside grpc core) MUST NOT use this field */
|
119
120
|
size_t capacity;
|
120
|
-
|
121
|
+
/** the combined length of all slices in the array */
|
121
122
|
size_t length;
|
122
|
-
|
123
|
+
/** inlined elements to avoid allocations */
|
123
124
|
grpc_slice inlined[GRPC_SLICE_BUFFER_INLINE_ELEMENTS];
|
124
125
|
} grpc_slice_buffer;
|
125
126
|
|
@@ -39,40 +39,40 @@ extern "C" {
|
|
39
39
|
#endif
|
40
40
|
|
41
41
|
typedef enum {
|
42
|
-
|
42
|
+
/** Not an error; returned on success */
|
43
43
|
GRPC_STATUS_OK = 0,
|
44
44
|
|
45
|
-
|
45
|
+
/** The operation was cancelled (typically by the caller). */
|
46
46
|
GRPC_STATUS_CANCELLED = 1,
|
47
47
|
|
48
|
-
|
48
|
+
/** Unknown error. An example of where this error may be returned is
|
49
49
|
if a Status value received from another address space belongs to
|
50
50
|
an error-space that is not known in this address space. Also
|
51
51
|
errors raised by APIs that do not return enough error information
|
52
52
|
may be converted to this error. */
|
53
53
|
GRPC_STATUS_UNKNOWN = 2,
|
54
54
|
|
55
|
-
|
55
|
+
/** Client specified an invalid argument. Note that this differs
|
56
56
|
from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments
|
57
57
|
that are problematic regardless of the state of the system
|
58
58
|
(e.g., a malformed file name). */
|
59
59
|
GRPC_STATUS_INVALID_ARGUMENT = 3,
|
60
60
|
|
61
|
-
|
61
|
+
/** Deadline expired before operation could complete. For operations
|
62
62
|
that change the state of the system, this error may be returned
|
63
63
|
even if the operation has completed successfully. For example, a
|
64
64
|
successful response from a server could have been delayed long
|
65
65
|
enough for the deadline to expire. */
|
66
66
|
GRPC_STATUS_DEADLINE_EXCEEDED = 4,
|
67
67
|
|
68
|
-
|
68
|
+
/** Some requested entity (e.g., file or directory) was not found. */
|
69
69
|
GRPC_STATUS_NOT_FOUND = 5,
|
70
70
|
|
71
|
-
|
71
|
+
/** Some entity that we attempted to create (e.g., file or directory)
|
72
72
|
already exists. */
|
73
73
|
GRPC_STATUS_ALREADY_EXISTS = 6,
|
74
74
|
|
75
|
-
|
75
|
+
/** The caller does not have permission to execute the specified
|
76
76
|
operation. PERMISSION_DENIED must not be used for rejections
|
77
77
|
caused by exhausting some resource (use RESOURCE_EXHAUSTED
|
78
78
|
instead for those errors). PERMISSION_DENIED must not be
|
@@ -80,15 +80,15 @@ typedef enum {
|
|
80
80
|
instead for those errors). */
|
81
81
|
GRPC_STATUS_PERMISSION_DENIED = 7,
|
82
82
|
|
83
|
-
|
83
|
+
/** The request does not have valid authentication credentials for the
|
84
84
|
operation. */
|
85
85
|
GRPC_STATUS_UNAUTHENTICATED = 16,
|
86
86
|
|
87
|
-
|
87
|
+
/** Some resource has been exhausted, perhaps a per-user quota, or
|
88
88
|
perhaps the entire file system is out of space. */
|
89
89
|
GRPC_STATUS_RESOURCE_EXHAUSTED = 8,
|
90
90
|
|
91
|
-
|
91
|
+
/** Operation was rejected because the system is not in a state
|
92
92
|
required for the operation's execution. For example, directory
|
93
93
|
to be deleted may be non-empty, an rmdir operation is applied to
|
94
94
|
a non-directory, etc.
|
@@ -109,14 +109,14 @@ typedef enum {
|
|
109
109
|
read-modify-write on the same resource. */
|
110
110
|
GRPC_STATUS_FAILED_PRECONDITION = 9,
|
111
111
|
|
112
|
-
|
112
|
+
/** The operation was aborted, typically due to a concurrency issue
|
113
113
|
like sequencer check failures, transaction aborts, etc.
|
114
114
|
|
115
115
|
See litmus test above for deciding between FAILED_PRECONDITION,
|
116
116
|
ABORTED, and UNAVAILABLE. */
|
117
117
|
GRPC_STATUS_ABORTED = 10,
|
118
118
|
|
119
|
-
|
119
|
+
/** Operation was attempted past the valid range. E.g., seeking or
|
120
120
|
reading past end of file.
|
121
121
|
|
122
122
|
Unlike INVALID_ARGUMENT, this error indicates a problem that may
|
@@ -133,26 +133,31 @@ typedef enum {
|
|
133
133
|
they are done. */
|
134
134
|
GRPC_STATUS_OUT_OF_RANGE = 11,
|
135
135
|
|
136
|
-
|
136
|
+
/** Operation is not implemented or not supported/enabled in this service. */
|
137
137
|
GRPC_STATUS_UNIMPLEMENTED = 12,
|
138
138
|
|
139
|
-
|
139
|
+
/** Internal errors. Means some invariants expected by underlying
|
140
140
|
system has been broken. If you see one of these errors,
|
141
141
|
something is very broken. */
|
142
142
|
GRPC_STATUS_INTERNAL = 13,
|
143
143
|
|
144
|
-
|
144
|
+
/** The service is currently unavailable. This is a most likely a
|
145
145
|
transient condition and may be corrected by retrying with
|
146
146
|
a backoff.
|
147
147
|
|
148
|
+
WARNING: Although data MIGHT not have been transmitted when this
|
149
|
+
status occurs, there is NOT A GUARANTEE that the server has not seen
|
150
|
+
anything. So in general it is unsafe to retry on this status code
|
151
|
+
if the call is non-idempotent.
|
152
|
+
|
148
153
|
See litmus test above for deciding between FAILED_PRECONDITION,
|
149
154
|
ABORTED, and UNAVAILABLE. */
|
150
155
|
GRPC_STATUS_UNAVAILABLE = 14,
|
151
156
|
|
152
|
-
|
157
|
+
/** Unrecoverable data loss or corruption. */
|
153
158
|
GRPC_STATUS_DATA_LOSS = 15,
|
154
159
|
|
155
|
-
|
160
|
+
/** Force users to include a default branch: */
|
156
161
|
GRPC_STATUS__DO_NOT_USE = -1
|
157
162
|
} grpc_status_code;
|
158
163
|
|
@@ -35,7 +35,6 @@
|
|
35
35
|
#define GRPC_LOAD_REPORTING_H
|
36
36
|
|
37
37
|
#include <grpc/impl/codegen/port_platform.h>
|
38
|
-
#include <grpc/slice.h>
|
39
38
|
|
40
39
|
#ifdef __cplusplus
|
41
40
|
extern "C" {
|
@@ -50,11 +49,12 @@ extern "C" {
|
|
50
49
|
* gRPC LB system. */
|
51
50
|
#define GRPC_LB_TOKEN_MD_KEY "lb-token"
|
52
51
|
|
53
|
-
/**
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
52
|
+
/** Metadata key for gRPC LB cost reporting.
|
53
|
+
*
|
54
|
+
* The value corresponding to this key is an opaque binary blob reported by the
|
55
|
+
* backend as part of its trailing metadata containing cost information for the
|
56
|
+
* call. */
|
57
|
+
#define GRPC_LB_COST_MD_KEY "lb-cost-bin"
|
58
58
|
|
59
59
|
#ifdef __cplusplus
|
60
60
|
}
|
data/include/grpc/slice.h
CHANGED
@@ -41,11 +41,11 @@
|
|
41
41
|
extern "C" {
|
42
42
|
#endif
|
43
43
|
|
44
|
-
|
44
|
+
/** Increment the refcount of s. Requires slice is initialized.
|
45
45
|
Returns s. */
|
46
46
|
GPRAPI grpc_slice grpc_slice_ref(grpc_slice s);
|
47
47
|
|
48
|
-
|
48
|
+
/** Decrement the ref count of s. If the ref count of s reaches zero, all
|
49
49
|
slices sharing the ref count are destroyed, and considered no longer
|
50
50
|
initialized. If s is ultimately derived from a call to grpc_slice_new(start,
|
51
51
|
len, dest) where dest!=NULL , then (*dest)(start) is called, else if s is
|
@@ -53,12 +53,15 @@ GPRAPI grpc_slice grpc_slice_ref(grpc_slice s);
|
|
53
53
|
where dest!=NULL , then (*dest)(start, len). Requires s initialized. */
|
54
54
|
GPRAPI void grpc_slice_unref(grpc_slice s);
|
55
55
|
|
56
|
-
|
56
|
+
/** Copy slice - create a new slice that contains the same data as s */
|
57
|
+
GPRAPI grpc_slice grpc_slice_copy(grpc_slice s);
|
58
|
+
|
59
|
+
/** Create a slice pointing at some data. Calls malloc to allocate a refcount
|
57
60
|
for the object, and arranges that destroy will be called with the pointer
|
58
61
|
passed in at destruction. */
|
59
62
|
GPRAPI grpc_slice grpc_slice_new(void *p, size_t len, void (*destroy)(void *));
|
60
63
|
|
61
|
-
|
64
|
+
/** Equivalent to grpc_slice_new, but with a separate pointer that is
|
62
65
|
passed to the destroy function. This function can be useful when
|
63
66
|
the data is part of a larger structure that must be destroyed when
|
64
67
|
the data is no longer needed. */
|
@@ -66,23 +69,30 @@ GPRAPI grpc_slice grpc_slice_new_with_user_data(void *p, size_t len,
|
|
66
69
|
void (*destroy)(void *),
|
67
70
|
void *user_data);
|
68
71
|
|
69
|
-
|
72
|
+
/** Equivalent to grpc_slice_new, but with a two argument destroy function that
|
70
73
|
also takes the slice length. */
|
71
74
|
GPRAPI grpc_slice grpc_slice_new_with_len(void *p, size_t len,
|
72
75
|
void (*destroy)(void *, size_t));
|
73
76
|
|
74
|
-
|
77
|
+
/** Equivalent to grpc_slice_new(malloc(len), len, free), but saves one malloc()
|
75
78
|
call.
|
76
79
|
Aborts if malloc() fails. */
|
77
80
|
GPRAPI grpc_slice grpc_slice_malloc(size_t length);
|
81
|
+
GPRAPI grpc_slice grpc_slice_malloc_large(size_t length);
|
82
|
+
|
83
|
+
#define GRPC_SLICE_MALLOC(len) \
|
84
|
+
((len) <= GRPC_SLICE_INLINED_SIZE \
|
85
|
+
? (grpc_slice){.refcount = NULL, \
|
86
|
+
.data.inlined = {.length = (uint8_t)(len)}} \
|
87
|
+
: grpc_slice_malloc_large((len)))
|
78
88
|
|
79
|
-
|
89
|
+
/** Intern a slice:
|
80
90
|
|
81
91
|
The return value for two invocations of this function with the same sequence
|
82
92
|
of bytes is a slice which points to the same memory. */
|
83
93
|
GPRAPI grpc_slice grpc_slice_intern(grpc_slice slice);
|
84
94
|
|
85
|
-
|
95
|
+
/** Create a slice by copying a string.
|
86
96
|
Does not preserve null terminators.
|
87
97
|
Equivalent to:
|
88
98
|
size_t len = strlen(source);
|
@@ -90,34 +100,46 @@ GPRAPI grpc_slice grpc_slice_intern(grpc_slice slice);
|
|
90
100
|
memcpy(slice->data, source, len); */
|
91
101
|
GPRAPI grpc_slice grpc_slice_from_copied_string(const char *source);
|
92
102
|
|
93
|
-
|
103
|
+
/** Create a slice by copying a buffer.
|
94
104
|
Equivalent to:
|
95
105
|
grpc_slice slice = grpc_slice_malloc(len);
|
96
106
|
memcpy(slice->data, source, len); */
|
97
107
|
GPRAPI grpc_slice grpc_slice_from_copied_buffer(const char *source, size_t len);
|
98
108
|
|
99
|
-
|
109
|
+
/** Create a slice pointing to constant memory */
|
100
110
|
GPRAPI grpc_slice grpc_slice_from_static_string(const char *source);
|
101
111
|
|
102
|
-
|
112
|
+
/** Create a slice pointing to constant memory */
|
103
113
|
GPRAPI grpc_slice grpc_slice_from_static_buffer(const void *source, size_t len);
|
104
114
|
|
105
|
-
|
106
|
-
result.data==s.data+begin, and result.length==end-begin.
|
107
|
-
|
115
|
+
/** Return a result slice derived from s, which shares a ref count with \a s,
|
116
|
+
where result.data==s.data+begin, and result.length==end-begin. The ref count
|
117
|
+
of \a s is increased by one. Do not assign result back to \a s.
|
108
118
|
Requires s initialized, begin <= end, begin <= s.length, and
|
109
119
|
end <= source->length. */
|
110
120
|
GPRAPI grpc_slice grpc_slice_sub(grpc_slice s, size_t begin, size_t end);
|
111
121
|
|
112
|
-
|
122
|
+
/** The same as grpc_slice_sub, but without altering the ref count */
|
113
123
|
GPRAPI grpc_slice grpc_slice_sub_no_ref(grpc_slice s, size_t begin, size_t end);
|
114
124
|
|
115
|
-
|
125
|
+
/** Splits s into two: modifies s to be s[0:split], and returns a new slice,
|
116
126
|
sharing a refcount with s, that contains s[split:s.length].
|
117
127
|
Requires s intialized, split <= s.length */
|
118
128
|
GPRAPI grpc_slice grpc_slice_split_tail(grpc_slice *s, size_t split);
|
119
129
|
|
120
|
-
|
130
|
+
typedef enum {
|
131
|
+
GRPC_SLICE_REF_TAIL = 1,
|
132
|
+
GRPC_SLICE_REF_HEAD = 2,
|
133
|
+
GRPC_SLICE_REF_BOTH = 1 + 2
|
134
|
+
} grpc_slice_ref_whom;
|
135
|
+
|
136
|
+
/** The same as grpc_slice_split_tail, but with an option to skip altering
|
137
|
+
* refcounts (grpc_slice_split_tail_maybe_ref(..., true) is equivalent to
|
138
|
+
* grpc_slice_split_tail(...)) */
|
139
|
+
GPRAPI grpc_slice grpc_slice_split_tail_maybe_ref(grpc_slice *s, size_t split,
|
140
|
+
grpc_slice_ref_whom ref_whom);
|
141
|
+
|
142
|
+
/** Splits s into two: modifies s to be s[split:s.length], and returns a new
|
121
143
|
slice, sharing a refcount with s, that contains s[0:split].
|
122
144
|
Requires s intialized, split <= s.length */
|
123
145
|
GPRAPI grpc_slice grpc_slice_split_head(grpc_slice *s, size_t split);
|
@@ -129,35 +151,35 @@ GPRAPI int grpc_slice_default_eq_impl(grpc_slice a, grpc_slice b);
|
|
129
151
|
|
130
152
|
GPRAPI int grpc_slice_eq(grpc_slice a, grpc_slice b);
|
131
153
|
|
132
|
-
|
154
|
+
/** Returns <0 if a < b, ==0 if a == b, >0 if a > b
|
133
155
|
The order is arbitrary, and is not guaranteed to be stable across different
|
134
156
|
versions of the API. */
|
135
157
|
GPRAPI int grpc_slice_cmp(grpc_slice a, grpc_slice b);
|
136
158
|
GPRAPI int grpc_slice_str_cmp(grpc_slice a, const char *b);
|
137
159
|
GPRAPI int grpc_slice_buf_cmp(grpc_slice a, const void *b, size_t blen);
|
138
160
|
|
139
|
-
|
161
|
+
/** return non-zero if the first blen bytes of a are equal to b */
|
140
162
|
GPRAPI int grpc_slice_buf_start_eq(grpc_slice a, const void *b, size_t blen);
|
141
163
|
|
142
|
-
|
164
|
+
/** return the index of the last instance of \a c in \a s, or -1 if not found */
|
143
165
|
GPRAPI int grpc_slice_rchr(grpc_slice s, char c);
|
144
166
|
GPRAPI int grpc_slice_chr(grpc_slice s, char c);
|
145
167
|
|
146
|
-
|
147
|
-
|
168
|
+
/** return the index of the first occurance of \a needle in \a haystack, or -1
|
169
|
+
if it's not found */
|
148
170
|
GPRAPI int grpc_slice_slice(grpc_slice haystack, grpc_slice needle);
|
149
171
|
|
150
172
|
GPRAPI uint32_t grpc_slice_hash(grpc_slice s);
|
151
173
|
|
152
|
-
|
174
|
+
/** Do two slices point at the same memory, with the same length
|
153
175
|
If a or b is inlined, actually compares data */
|
154
176
|
GPRAPI int grpc_slice_is_equivalent(grpc_slice a, grpc_slice b);
|
155
177
|
|
156
|
-
|
178
|
+
/** Return a slice pointing to newly allocated memory that has the same contents
|
157
179
|
* as \a s */
|
158
180
|
GPRAPI grpc_slice grpc_slice_dup(grpc_slice a);
|
159
181
|
|
160
|
-
|
182
|
+
/** Return a copy of slice as a C string. Offers no protection against embedded
|
161
183
|
NULL's. Returned string must be freed with gpr_free. */
|
162
184
|
GPRAPI char *grpc_slice_to_c_string(grpc_slice s);
|
163
185
|
|
data/include/grpc/slice_buffer.h
CHANGED
@@ -40,15 +40,15 @@
|
|
40
40
|
extern "C" {
|
41
41
|
#endif
|
42
42
|
|
43
|
-
|
43
|
+
/** initialize a slice buffer */
|
44
44
|
GPRAPI void grpc_slice_buffer_init(grpc_slice_buffer *sb);
|
45
|
-
|
45
|
+
/** destroy a slice buffer - unrefs any held elements */
|
46
46
|
GPRAPI void grpc_slice_buffer_destroy(grpc_slice_buffer *sb);
|
47
|
-
|
47
|
+
/** Add an element to a slice buffer - takes ownership of the slice.
|
48
48
|
This function is allowed to concatenate the passed in slice to the end of
|
49
49
|
some other slice if desired by the slice buffer. */
|
50
50
|
GPRAPI void grpc_slice_buffer_add(grpc_slice_buffer *sb, grpc_slice slice);
|
51
|
-
|
51
|
+
/** add an element to a slice buffer - takes ownership of the slice and returns
|
52
52
|
the index of the slice.
|
53
53
|
Guarantees that the slice will not be concatenated at the end of another
|
54
54
|
slice (i.e. the data for this slice will begin at the first byte of the
|
@@ -59,31 +59,35 @@ GPRAPI size_t grpc_slice_buffer_add_indexed(grpc_slice_buffer *sb,
|
|
59
59
|
grpc_slice slice);
|
60
60
|
GPRAPI void grpc_slice_buffer_addn(grpc_slice_buffer *sb, grpc_slice *slices,
|
61
61
|
size_t n);
|
62
|
-
|
62
|
+
/** add a very small (less than 8 bytes) amount of data to the end of a slice
|
63
63
|
buffer: returns a pointer into which to add the data */
|
64
64
|
GPRAPI uint8_t *grpc_slice_buffer_tiny_add(grpc_slice_buffer *sb, size_t len);
|
65
|
-
|
65
|
+
/** pop the last buffer, but don't unref it */
|
66
66
|
GPRAPI void grpc_slice_buffer_pop(grpc_slice_buffer *sb);
|
67
|
-
|
67
|
+
/** clear a slice buffer, unref all elements */
|
68
68
|
GPRAPI void grpc_slice_buffer_reset_and_unref(grpc_slice_buffer *sb);
|
69
|
-
|
69
|
+
/** swap the contents of two slice buffers */
|
70
70
|
GPRAPI void grpc_slice_buffer_swap(grpc_slice_buffer *a, grpc_slice_buffer *b);
|
71
|
-
|
71
|
+
/** move all of the elements of src into dst */
|
72
72
|
GPRAPI void grpc_slice_buffer_move_into(grpc_slice_buffer *src,
|
73
73
|
grpc_slice_buffer *dst);
|
74
|
-
|
74
|
+
/** remove n bytes from the end of a slice buffer */
|
75
75
|
GPRAPI void grpc_slice_buffer_trim_end(grpc_slice_buffer *src, size_t n,
|
76
76
|
grpc_slice_buffer *garbage);
|
77
|
-
|
77
|
+
/** move the first n bytes of src into dst */
|
78
78
|
GPRAPI void grpc_slice_buffer_move_first(grpc_slice_buffer *src, size_t n,
|
79
79
|
grpc_slice_buffer *dst);
|
80
|
-
|
80
|
+
/** move the first n bytes of src into dst without adding references */
|
81
|
+
GPRAPI void grpc_slice_buffer_move_first_no_ref(grpc_slice_buffer *src,
|
82
|
+
size_t n,
|
83
|
+
grpc_slice_buffer *dst);
|
84
|
+
/** move the first n bytes of src into dst (copying them) */
|
81
85
|
GPRAPI void grpc_slice_buffer_move_first_into_buffer(grpc_exec_ctx *exec_ctx,
|
82
86
|
grpc_slice_buffer *src,
|
83
87
|
size_t n, void *dst);
|
84
|
-
|
88
|
+
/** take the first slice in the slice buffer */
|
85
89
|
GPRAPI grpc_slice grpc_slice_buffer_take_first(grpc_slice_buffer *src);
|
86
|
-
|
90
|
+
/** undo the above with (a possibly different) \a slice */
|
87
91
|
GPRAPI void grpc_slice_buffer_undo_take_first(grpc_slice_buffer *src,
|
88
92
|
grpc_slice slice);
|
89
93
|
|