grpc 1.82.2 → 1.83.0.pre1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Makefile +8 -5
- data/etc/roots.pem +10400 -3855
- data/include/grpc/grpc_audit_logging.h +2 -2
- data/include/grpc/grpc_security_constants.h +2 -0
- data/include/grpc/impl/channel_arg_names.h +23 -0
- data/src/core/call/call_filters.h +19 -3
- data/src/core/call/call_spine.h +4 -4
- data/src/core/call/client_call.cc +1 -1
- data/src/core/call/metadata.cc +7 -2
- data/src/core/call/server_call.cc +13 -3
- data/src/core/call/server_call.h +5 -3
- data/src/core/client_channel/backup_poller.cc +2 -17
- data/src/core/client_channel/client_channel.cc +17 -14
- data/src/core/client_channel/client_channel.h +3 -1
- data/src/core/client_channel/client_channel_filter.cc +11 -13
- data/src/core/client_channel/client_channel_service_config.cc +5 -13
- data/src/core/client_channel/direct_channel.cc +5 -1
- data/src/core/client_channel/direct_channel.h +3 -1
- data/src/core/config/experiment_env_var.cc +30 -0
- data/src/core/config/experiment_env_var.h +26 -0
- data/src/core/credentials/call/regional_access_boundary_fetcher.cc +6 -6
- data/src/core/credentials/transport/ssl/ssl_security_connector.cc +14 -2
- data/src/core/credentials/transport/tls/grpc_tls_certificate_selector.cc +172 -0
- data/src/core/credentials/transport/tls/grpc_tls_certificate_selector.h +103 -0
- data/src/core/credentials/transport/tls/load_system_roots_fallback.cc +3 -2
- data/src/core/credentials/transport/tls/load_system_roots_supported.cc +10 -3
- data/src/core/credentials/transport/tls/tls_security_connector.cc +14 -2
- data/src/core/credentials/transport/xds/xds_credentials.cc +4 -12
- data/src/core/ext/filters/http/message_compress/compression_filter.cc +32 -25
- data/src/core/ext/filters/http/message_compress/compression_filter.h +1 -0
- data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +2 -1
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +19 -13
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +14 -57
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +2 -2
- data/src/core/ext/transport/chttp2/transport/flow_control.h +3 -2
- data/src/core/ext/transport/chttp2/transport/frame.cc +58 -1
- data/src/core/ext/transport/chttp2/transport/frame.h +13 -1
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +2 -34
- data/src/core/ext/transport/chttp2/transport/frame_goaway.cc +23 -55
- data/src/core/ext/transport/chttp2/transport/frame_goaway.h +0 -1
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc +2 -4
- data/src/core/ext/transport/chttp2/transport/frame_security.cc +10 -1
- data/src/core/ext/transport/chttp2/transport/frame_security.h +2 -1
- data/src/core/ext/transport/chttp2/transport/goaway.cc +11 -1
- data/src/core/ext/transport/chttp2/transport/goaway.h +17 -1
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +9 -0
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +117 -276
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +44 -17
- data/src/core/ext/transport/chttp2/transport/http2_server_transport.cc +382 -496
- data/src/core/ext/transport/chttp2/transport/http2_server_transport.h +75 -77
- data/src/core/ext/transport/chttp2/transport/http2_settings.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/http2_settings.h +30 -11
- data/src/core/ext/transport/chttp2/transport/http2_settings_promises.h +24 -9
- data/src/core/ext/transport/chttp2/transport/http2_transport.cc +26 -0
- data/src/core/ext/transport/chttp2/transport/http2_transport.h +2 -0
- data/src/core/ext/transport/chttp2/transport/internal.h +4 -6
- data/src/core/ext/transport/chttp2/transport/parsing.cc +3 -10
- data/src/core/ext/transport/chttp2/transport/ping_promise.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/ping_rate_policy.cc +4 -10
- data/src/core/ext/transport/chttp2/transport/read_context.h +62 -20
- data/src/core/ext/transport/chttp2/transport/security_frame.h +1 -0
- data/src/core/ext/transport/chttp2/transport/stream.h +271 -120
- data/src/core/ext/transport/chttp2/transport/stream_data_queue.h +77 -61
- data/src/core/handshaker/security/secure_endpoint.cc +0 -13
- data/src/core/lib/channel/promise_based_filter.cc +77 -3
- data/src/core/lib/channel/promise_based_filter.h +238 -184
- data/src/core/lib/compression/message_compress.cc +97 -132
- data/src/core/lib/compression/message_compress.h +0 -24
- data/src/core/lib/event_engine/extensions/receive_coalescing_extension.h +0 -4
- data/src/core/lib/event_engine/extensions/tcp_trace.h +1 -1
- data/src/core/lib/event_engine/posix_engine/posix_engine.cc +2 -12
- data/src/core/lib/event_engine/shim.cc +2 -16
- data/src/core/lib/event_engine/shim.h +0 -4
- data/src/core/lib/experiments/experiments.cc +57 -123
- data/src/core/lib/experiments/experiments.h +43 -82
- data/src/core/lib/iomgr/error.cc +3 -73
- data/src/core/lib/iomgr/error.h +8 -6
- data/src/core/lib/iomgr/error_cfstream.cc +1 -2
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +2 -6
- data/src/core/lib/iomgr/ev_poll_posix.cc +2 -6
- data/src/core/lib/iomgr/tcp_posix.cc +2 -6
- data/src/core/lib/security/authorization/audit_logging.cc +2 -2
- data/src/core/lib/security/authorization/audit_logging.h +3 -3
- data/src/core/lib/security/authorization/grpc_authorization_engine.cc +11 -13
- data/src/core/lib/security/authorization/grpc_authorization_engine.h +1 -1
- data/src/core/lib/security/authorization/matchers.cc +20 -20
- data/src/core/lib/security/authorization/matchers.h +15 -16
- data/src/core/lib/security/authorization/rbac_policy.h +1 -1
- data/src/core/lib/security/authorization/stdout_logger.cc +3 -3
- data/src/core/lib/security/authorization/stdout_logger.h +6 -5
- data/src/core/lib/surface/call.cc +0 -8
- data/src/core/lib/surface/call.h +2 -0
- data/src/core/lib/surface/channel.cc +21 -2
- data/src/core/lib/surface/channel.h +14 -6
- data/src/core/lib/surface/filter_stack_call.cc +10 -29
- data/src/core/lib/surface/legacy_channel.cc +7 -7
- data/src/core/lib/surface/legacy_channel.h +3 -1
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/bdp_estimator.cc +13 -13
- data/src/core/lib/transport/bdp_estimator.h +9 -5
- data/src/core/lib/transport/error_utils.cc +26 -138
- data/src/core/lib/transport/promise_endpoint.h +2 -4
- data/src/core/load_balancing/grpclb/grpclb.cc +2 -1
- data/src/core/load_balancing/pick_first/pick_first.cc +33 -2
- data/src/core/load_balancing/pick_first/pick_first.h +6 -0
- data/src/core/load_balancing/ring_hash/ring_hash.cc +3 -10
- data/src/core/load_balancing/rls/rls.cc +2 -1
- data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc +2 -7
- data/src/core/load_balancing/xds/cds.cc +80 -56
- data/src/core/load_balancing/xds/cds.h +21 -0
- data/src/core/mitigation_engine/mitigation.h +53 -0
- data/src/core/mitigation_engine/mitigation_provider.h +62 -0
- data/src/core/resolver/dns/dns_resolver_plugin.cc +1 -6
- data/src/core/resolver/xds/xds_resolver.cc +14 -11
- data/src/core/server/server.h +1 -4
- data/src/core/server/server_config_selector.h +5 -4
- data/src/core/server/server_config_selector_filter.cc +67 -80
- data/src/core/server/xds_server_config_fetcher.cc +681 -692
- data/src/core/server/xds_server_config_fetcher_legacy.cc +15 -12
- data/src/core/telemetry/call_tracer.cc +49 -2
- data/src/core/telemetry/call_tracer.h +1 -0
- data/src/core/telemetry/tcp_tracer.h +38 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +1 -1
- data/src/core/tsi/ssl_telemetry_utils.cc +343 -0
- data/src/core/tsi/ssl_telemetry_utils.h +74 -0
- data/src/core/tsi/ssl_transport_security.cc +577 -301
- data/src/core/tsi/ssl_transport_security.h +22 -6
- data/src/core/tsi/ssl_transport_security_utils.cc +2 -0
- data/src/core/tsi/transport_security.h +7 -0
- data/src/core/util/http_client/httpcli.cc +1 -4
- data/src/core/util/http_client/httpcli_security_connector.cc +2 -1
- data/src/core/util/status_helper.cc +71 -192
- data/src/core/util/status_helper.h +16 -21
- data/src/core/xds/grpc/file_watcher_certificate_provider_factory.cc +2 -11
- data/src/core/xds/grpc/xds_bootstrap_grpc.cc +2 -7
- data/src/core/xds/grpc/xds_cluster_parser.cc +5 -16
- data/src/core/xds/grpc/xds_common_types.cc +94 -38
- data/src/core/xds/grpc/xds_common_types.h +33 -18
- data/src/core/xds/grpc/xds_common_types_parser.cc +168 -100
- data/src/core/xds/grpc/xds_common_types_parser.h +18 -1
- data/src/core/xds/grpc/xds_endpoint_parser.cc +6 -17
- data/src/core/xds/grpc/xds_http_filter_registry.cc +2 -10
- data/src/core/xds/grpc/xds_http_rbac_filter.cc +3 -12
- data/src/core/xds/grpc/xds_metadata_parser.cc +0 -2
- data/src/core/xds/grpc/xds_route_config_parser.cc +7 -11
- data/src/core/xds/grpc/xds_routing.cc +113 -82
- data/src/core/xds/grpc/xds_routing.h +70 -20
- data/src/core/xds/grpc/xds_server_grpc.cc +22 -13
- data/src/core/xds/grpc/xds_server_grpc.h +16 -2
- data/src/core/xds/grpc/xds_server_grpc_interface.h +10 -0
- data/src/core/xds/grpc/xds_transport_grpc.cc +123 -18
- data/src/core/xds/grpc/xds_transport_grpc.h +28 -4
- data/src/core/xds/xds_client/lrs_client.cc +3 -7
- data/src/core/xds/xds_client/xds_bootstrap.cc +4 -16
- data/src/core/xds/xds_client/xds_client.cc +2 -15
- data/src/core/xds/xds_client/xds_transport.h +3 -0
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +1 -1
- metadata +10 -2
|
@@ -25,203 +25,168 @@
|
|
|
25
25
|
#include <zconf.h>
|
|
26
26
|
#include <zlib.h>
|
|
27
27
|
|
|
28
|
-
#include <algorithm>
|
|
29
|
-
#include <cstdint>
|
|
30
|
-
#include <optional>
|
|
31
|
-
|
|
32
28
|
#include "src/core/lib/slice/slice.h"
|
|
33
29
|
#include "src/core/util/grpc_check.h"
|
|
34
|
-
#include "src/core/util/status_helper.h"
|
|
35
30
|
#include "absl/log/log.h"
|
|
36
|
-
#include "absl/status/status.h"
|
|
37
|
-
#include "absl/status/statusor.h"
|
|
38
31
|
|
|
39
32
|
#define OUTPUT_BLOCK_SIZE 1024
|
|
40
33
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
absl::StatusOr<SliceBuffer> ZlibBody(z_stream* zs, const SliceBuffer& input,
|
|
45
|
-
int (*flate)(z_stream* zs, int flush),
|
|
46
|
-
std::optional<uint32_t> max_output_size) {
|
|
34
|
+
static int zlib_body(z_stream* zs, grpc_slice_buffer* input,
|
|
35
|
+
grpc_slice_buffer* output,
|
|
36
|
+
int (*flate)(z_stream* zs, int flush)) {
|
|
47
37
|
int r = Z_STREAM_END; // Do not fail on an empty input.
|
|
48
38
|
int flush;
|
|
49
39
|
size_t i;
|
|
50
|
-
|
|
51
|
-
SliceBuffer output_sb;
|
|
40
|
+
grpc_slice outbuf = GRPC_SLICE_MALLOC(OUTPUT_BLOCK_SIZE);
|
|
52
41
|
const uInt uint_max = ~uInt{0};
|
|
53
|
-
auto outbuf = MutableSlice::CreateUninitialized(
|
|
54
|
-
std::min<uint32_t>(remaining_output_size, OUTPUT_BLOCK_SIZE));
|
|
55
42
|
|
|
56
|
-
GRPC_CHECK(outbuf
|
|
57
|
-
zs->avail_out = static_cast<uInt>(outbuf
|
|
58
|
-
zs->next_out =
|
|
43
|
+
GRPC_CHECK(GRPC_SLICE_LENGTH(outbuf) <= uint_max);
|
|
44
|
+
zs->avail_out = static_cast<uInt> GRPC_SLICE_LENGTH(outbuf);
|
|
45
|
+
zs->next_out = GRPC_SLICE_START_PTR(outbuf);
|
|
59
46
|
flush = Z_NO_FLUSH;
|
|
60
|
-
for (i = 0; i < input
|
|
61
|
-
if (i == input
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
zs->avail_in = static_cast<uInt>(input[i].length());
|
|
66
|
-
zs->next_in = const_cast<uint8_t*>(input[i].begin());
|
|
47
|
+
for (i = 0; i < input->count; i++) {
|
|
48
|
+
if (i == input->count - 1) flush = Z_FINISH;
|
|
49
|
+
GRPC_CHECK(GRPC_SLICE_LENGTH(input->slices[i]) <= uint_max);
|
|
50
|
+
zs->avail_in = static_cast<uInt> GRPC_SLICE_LENGTH(input->slices[i]);
|
|
51
|
+
zs->next_in = GRPC_SLICE_START_PTR(input->slices[i]);
|
|
67
52
|
do {
|
|
68
53
|
if (zs->avail_out == 0) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
output_sb.AppendIndexed(Slice(std::move(outbuf)));
|
|
75
|
-
outbuf = MutableSlice::CreateUninitialized(
|
|
76
|
-
std::min<uint32_t>(remaining_output_size, OUTPUT_BLOCK_SIZE));
|
|
77
|
-
// Update remaining output size to reflect the size of the slice we just
|
|
78
|
-
// filled with compressed / decompressed data.
|
|
79
|
-
if (max_output_size.has_value()) {
|
|
80
|
-
remaining_output_size -= outbuf.length();
|
|
81
|
-
}
|
|
82
|
-
GRPC_CHECK(outbuf.length() <= uint_max);
|
|
83
|
-
zs->avail_out = static_cast<uInt>(outbuf.length());
|
|
84
|
-
zs->next_out = const_cast<uint8_t*>(outbuf.begin());
|
|
54
|
+
grpc_slice_buffer_add_indexed(output, outbuf);
|
|
55
|
+
outbuf = GRPC_SLICE_MALLOC(OUTPUT_BLOCK_SIZE);
|
|
56
|
+
GRPC_CHECK(GRPC_SLICE_LENGTH(outbuf) <= uint_max);
|
|
57
|
+
zs->avail_out = static_cast<uInt> GRPC_SLICE_LENGTH(outbuf);
|
|
58
|
+
zs->next_out = GRPC_SLICE_START_PTR(outbuf);
|
|
85
59
|
}
|
|
86
60
|
r = flate(zs, flush);
|
|
87
61
|
if (r < 0 && r != Z_BUF_ERROR /* not fatal */) {
|
|
88
62
|
VLOG(2) << "zlib error (" << r << ")";
|
|
89
|
-
|
|
63
|
+
goto error;
|
|
90
64
|
}
|
|
91
65
|
} while (zs->avail_out == 0);
|
|
92
66
|
if (zs->avail_in) {
|
|
93
67
|
VLOG(2) << "zlib: not all input consumed";
|
|
94
|
-
|
|
95
|
-
"Decompression failed due to not all input "
|
|
96
|
-
"consumed");
|
|
68
|
+
goto error;
|
|
97
69
|
}
|
|
98
70
|
}
|
|
99
71
|
if (r != Z_STREAM_END) {
|
|
100
72
|
VLOG(2) << "zlib: Data error";
|
|
101
|
-
|
|
73
|
+
goto error;
|
|
102
74
|
}
|
|
103
75
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
return output_sb;
|
|
76
|
+
GRPC_CHECK(outbuf.refcount);
|
|
77
|
+
outbuf.data.refcounted.length -= zs->avail_out;
|
|
78
|
+
grpc_slice_buffer_add_indexed(output, outbuf);
|
|
79
|
+
|
|
80
|
+
return 1;
|
|
81
|
+
|
|
82
|
+
error:
|
|
83
|
+
grpc_core::CSliceUnref(outbuf);
|
|
84
|
+
return 0;
|
|
114
85
|
}
|
|
115
86
|
|
|
116
|
-
void*
|
|
87
|
+
static void* zalloc_gpr(void* /*opaque*/, unsigned int items,
|
|
88
|
+
unsigned int size) {
|
|
117
89
|
return gpr_malloc(items * size);
|
|
118
90
|
}
|
|
119
91
|
|
|
120
|
-
void
|
|
92
|
+
static void zfree_gpr(void* /*opaque*/, void* address) { gpr_free(address); }
|
|
121
93
|
|
|
122
|
-
|
|
94
|
+
static int zlib_compress(grpc_slice_buffer* input, grpc_slice_buffer* output,
|
|
95
|
+
int gzip) {
|
|
123
96
|
z_stream zs;
|
|
124
|
-
|
|
97
|
+
int r;
|
|
98
|
+
size_t i;
|
|
99
|
+
size_t count_before = output->count;
|
|
100
|
+
size_t length_before = output->length;
|
|
125
101
|
memset(&zs, 0, sizeof(zs));
|
|
126
|
-
zs.zalloc =
|
|
127
|
-
zs.zfree =
|
|
128
|
-
|
|
129
|
-
|
|
102
|
+
zs.zalloc = zalloc_gpr;
|
|
103
|
+
zs.zfree = zfree_gpr;
|
|
104
|
+
r = deflateInit2(&zs, Z_DEFAULT_COMPRESSION, Z_DEFLATED, 15 | (gzip ? 16 : 0),
|
|
105
|
+
8, Z_DEFAULT_STRATEGY);
|
|
130
106
|
GRPC_CHECK(r == Z_OK);
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
107
|
+
r = zlib_body(&zs, input, output, deflate) && output->length < input->length;
|
|
108
|
+
if (!r) {
|
|
109
|
+
for (i = count_before; i < output->count; i++) {
|
|
110
|
+
grpc_core::CSliceUnref(output->slices[i]);
|
|
111
|
+
}
|
|
112
|
+
output->count = count_before;
|
|
113
|
+
output->length = length_before;
|
|
136
114
|
}
|
|
137
|
-
|
|
115
|
+
deflateEnd(&zs);
|
|
116
|
+
return r;
|
|
138
117
|
}
|
|
139
118
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
std::optional<uint32_t> max_output_size) {
|
|
119
|
+
static int zlib_decompress(grpc_slice_buffer* input, grpc_slice_buffer* output,
|
|
120
|
+
int gzip) {
|
|
143
121
|
z_stream zs;
|
|
144
|
-
|
|
122
|
+
int r;
|
|
123
|
+
size_t i;
|
|
124
|
+
size_t count_before = output->count;
|
|
125
|
+
size_t length_before = output->length;
|
|
145
126
|
memset(&zs, 0, sizeof(zs));
|
|
146
|
-
zs.zalloc =
|
|
147
|
-
zs.zfree =
|
|
148
|
-
|
|
127
|
+
zs.zalloc = zalloc_gpr;
|
|
128
|
+
zs.zfree = zfree_gpr;
|
|
129
|
+
r = inflateInit2(&zs, 15 | (gzip ? 16 : 0));
|
|
149
130
|
GRPC_CHECK(r == Z_OK);
|
|
150
|
-
|
|
131
|
+
r = zlib_body(&zs, input, output, inflate);
|
|
132
|
+
if (!r) {
|
|
133
|
+
for (i = count_before; i < output->count; i++) {
|
|
134
|
+
grpc_core::CSliceUnref(output->slices[i]);
|
|
135
|
+
}
|
|
136
|
+
output->count = count_before;
|
|
137
|
+
output->length = length_before;
|
|
138
|
+
}
|
|
151
139
|
inflateEnd(&zs);
|
|
152
|
-
return
|
|
140
|
+
return r;
|
|
153
141
|
}
|
|
154
142
|
|
|
155
|
-
|
|
143
|
+
static int copy(grpc_slice_buffer* input, grpc_slice_buffer* output) {
|
|
144
|
+
size_t i;
|
|
145
|
+
for (i = 0; i < input->count; i++) {
|
|
146
|
+
grpc_slice_buffer_add(output, grpc_core::CSliceRef(input->slices[i]));
|
|
147
|
+
}
|
|
148
|
+
return 1;
|
|
149
|
+
}
|
|
156
150
|
|
|
157
|
-
|
|
158
|
-
|
|
151
|
+
static int compress_inner(grpc_compression_algorithm algorithm,
|
|
152
|
+
grpc_slice_buffer* input, grpc_slice_buffer* output) {
|
|
159
153
|
switch (algorithm) {
|
|
160
154
|
case GRPC_COMPRESS_NONE:
|
|
161
155
|
// the fallback path always needs to be send uncompressed: we simply
|
|
162
156
|
// rely on that here
|
|
163
|
-
return
|
|
157
|
+
return 0;
|
|
164
158
|
case GRPC_COMPRESS_DEFLATE:
|
|
165
|
-
return
|
|
159
|
+
return zlib_compress(input, output, 0);
|
|
166
160
|
case GRPC_COMPRESS_GZIP:
|
|
167
|
-
return
|
|
161
|
+
return zlib_compress(input, output, 1);
|
|
168
162
|
case GRPC_COMPRESS_ALGORITHMS_COUNT:
|
|
169
163
|
break;
|
|
170
164
|
}
|
|
171
165
|
LOG(ERROR) << "invalid compression algorithm " << algorithm;
|
|
172
|
-
return
|
|
166
|
+
return 0;
|
|
173
167
|
}
|
|
174
168
|
|
|
175
|
-
absl::StatusOr<SliceBuffer> MessageDecompress(
|
|
176
|
-
grpc_compression_algorithm algorithm, const SliceBuffer& input,
|
|
177
|
-
std::optional<uint32_t> max_output_size) {
|
|
178
|
-
switch (algorithm) {
|
|
179
|
-
case GRPC_COMPRESS_NONE: {
|
|
180
|
-
SliceBuffer output;
|
|
181
|
-
output.Append(input);
|
|
182
|
-
return output;
|
|
183
|
-
}
|
|
184
|
-
case GRPC_COMPRESS_DEFLATE:
|
|
185
|
-
return ZlibDecompress(input, 0, max_output_size);
|
|
186
|
-
case GRPC_COMPRESS_GZIP:
|
|
187
|
-
return ZlibDecompress(input, 1, max_output_size);
|
|
188
|
-
case GRPC_COMPRESS_ALGORITHMS_COUNT:
|
|
189
|
-
break;
|
|
190
|
-
}
|
|
191
|
-
LOG(ERROR) << "invalid compression algorithm " << algorithm;
|
|
192
|
-
return absl::InternalError("Invalid compression algorithm");
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
} // namespace grpc_core
|
|
196
|
-
|
|
197
169
|
int grpc_msg_compress(grpc_compression_algorithm algorithm,
|
|
198
170
|
grpc_slice_buffer* input, grpc_slice_buffer* output) {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
std::optional<grpc_core::SliceBuffer> output_sb =
|
|
203
|
-
grpc_core::MessageCompress(algorithm, input_sb);
|
|
204
|
-
if (!output_sb.has_value()) {
|
|
205
|
-
output_sb.emplace();
|
|
206
|
-
output_sb->Append(input_sb);
|
|
207
|
-
retval = 0;
|
|
171
|
+
if (!compress_inner(algorithm, input, output)) {
|
|
172
|
+
copy(input, output);
|
|
173
|
+
return 0;
|
|
208
174
|
}
|
|
209
|
-
|
|
210
|
-
grpc_slice_buffer_swap(output, output_sb->c_slice_buffer());
|
|
211
|
-
return retval;
|
|
175
|
+
return 1;
|
|
212
176
|
}
|
|
213
177
|
|
|
214
178
|
int grpc_msg_decompress(grpc_compression_algorithm algorithm,
|
|
215
179
|
grpc_slice_buffer* input, grpc_slice_buffer* output) {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
180
|
+
switch (algorithm) {
|
|
181
|
+
case GRPC_COMPRESS_NONE:
|
|
182
|
+
return copy(input, output);
|
|
183
|
+
case GRPC_COMPRESS_DEFLATE:
|
|
184
|
+
return zlib_decompress(input, output, 0);
|
|
185
|
+
case GRPC_COMPRESS_GZIP:
|
|
186
|
+
return zlib_decompress(input, output, 1);
|
|
187
|
+
case GRPC_COMPRESS_ALGORITHMS_COUNT:
|
|
188
|
+
break;
|
|
223
189
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
return 1;
|
|
190
|
+
LOG(ERROR) << "invalid compression algorithm " << algorithm;
|
|
191
|
+
return 0;
|
|
227
192
|
}
|
|
@@ -23,13 +23,6 @@
|
|
|
23
23
|
#include <grpc/slice.h>
|
|
24
24
|
#include <grpc/support/port_platform.h>
|
|
25
25
|
|
|
26
|
-
#include <cstdint>
|
|
27
|
-
#include <optional>
|
|
28
|
-
|
|
29
|
-
#include "src/core/lib/slice/slice_buffer.h"
|
|
30
|
-
#include "absl/status/status.h"
|
|
31
|
-
#include "absl/status/statusor.h"
|
|
32
|
-
|
|
33
26
|
// compress 'input' to 'output' using 'algorithm'.
|
|
34
27
|
// On success, appends compressed slices to output and returns 1.
|
|
35
28
|
// On failure, appends uncompressed slices to output and returns 0.
|
|
@@ -42,21 +35,4 @@ int grpc_msg_compress(grpc_compression_algorithm algorithm,
|
|
|
42
35
|
int grpc_msg_decompress(grpc_compression_algorithm algorithm,
|
|
43
36
|
grpc_slice_buffer* input, grpc_slice_buffer* output);
|
|
44
37
|
|
|
45
|
-
namespace grpc_core {
|
|
46
|
-
|
|
47
|
-
// Compresses 'input' using 'algorithm'.
|
|
48
|
-
// On success, returns a SliceBuffer containing the compressed data.
|
|
49
|
-
// On failure, returns nullopt.
|
|
50
|
-
std::optional<SliceBuffer> MessageCompress(grpc_compression_algorithm algorithm,
|
|
51
|
-
const SliceBuffer& input);
|
|
52
|
-
// Decompresses 'input'.
|
|
53
|
-
// On success, returns a SliceBuffer containing the decompressed data.
|
|
54
|
-
// On failure, returns a non-OK status.
|
|
55
|
-
// Fails if the decompressed data would be larger than max_output_size.
|
|
56
|
-
absl::StatusOr<SliceBuffer> MessageDecompress(
|
|
57
|
-
grpc_compression_algorithm algorithm, const SliceBuffer& input,
|
|
58
|
-
std::optional<uint32_t> max_output_size);
|
|
59
|
-
|
|
60
|
-
} // namespace grpc_core
|
|
61
|
-
|
|
62
38
|
#endif // GRPC_SRC_CORE_LIB_COMPRESSION_MESSAGE_COMPRESS_H
|
|
@@ -37,10 +37,6 @@ class ReceiveCoalescingExtension {
|
|
|
37
37
|
/// It is safe to call this only when there are no outstanding Reads on
|
|
38
38
|
/// the Endpoint.
|
|
39
39
|
virtual void DisableRpcReceiveCoalescing() = 0;
|
|
40
|
-
|
|
41
|
-
/// If invoked, the endpoint tries to preserve proper order and alignment of
|
|
42
|
-
/// any memory that maybe shared across reads.
|
|
43
|
-
virtual void EnforceRxMemoryAlignment() = 0;
|
|
44
40
|
};
|
|
45
41
|
|
|
46
42
|
} // namespace grpc_event_engine::experimental
|
|
@@ -36,7 +36,7 @@ class TcpTraceExtension {
|
|
|
36
36
|
// Enable TCP telemetry collection using the Instrumentation API.
|
|
37
37
|
virtual void EnableTcpTelemetry(
|
|
38
38
|
grpc_core::RefCountedPtr<grpc_core::CollectionScope> collection_scope,
|
|
39
|
-
bool is_control_endpoint) = 0;
|
|
39
|
+
bool is_control_endpoint, bool trace_full_buffer) = 0;
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
} // namespace grpc_event_engine::experimental
|
|
@@ -76,14 +76,6 @@ namespace grpc_event_engine::experimental {
|
|
|
76
76
|
|
|
77
77
|
namespace {
|
|
78
78
|
|
|
79
|
-
bool ShouldUsePosixPoller() {
|
|
80
|
-
#if defined(GRPC_PYTHON_BUILD)
|
|
81
|
-
return grpc_core::IsEventEnginePollerForPythonEnabled();
|
|
82
|
-
#else
|
|
83
|
-
return true;
|
|
84
|
-
#endif
|
|
85
|
-
}
|
|
86
|
-
|
|
87
79
|
#if GRPC_ENABLE_FORK_SUPPORT && GRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK
|
|
88
80
|
|
|
89
81
|
// Thread pool can outlive EE but we need to ensure the ordering if both
|
|
@@ -434,10 +426,8 @@ PosixEventEngine::PosixEventEngine(const Options& options)
|
|
|
434
426
|
: connection_shards_(options.connection_shards),
|
|
435
427
|
executor_(MakeThreadPool(options.reserve_threads)),
|
|
436
428
|
timer_manager_(std::make_shared<TimerManager>(executor_)) {
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
SchedulePoller();
|
|
440
|
-
}
|
|
429
|
+
poller_ = grpc_event_engine::experimental::MakeDefaultPoller(executor_);
|
|
430
|
+
SchedulePoller();
|
|
441
431
|
}
|
|
442
432
|
|
|
443
433
|
#endif // GRPC_POSIX_SOCKET_TCP
|
|
@@ -21,14 +21,10 @@
|
|
|
21
21
|
|
|
22
22
|
namespace grpc_event_engine::experimental {
|
|
23
23
|
|
|
24
|
-
bool UseEventEngineClient() {
|
|
25
|
-
return !EventEngineExperimentDisabledForPython() &&
|
|
26
|
-
grpc_core::IsEventEngineClientEnabled();
|
|
27
|
-
}
|
|
24
|
+
bool UseEventEngineClient() { return grpc_core::IsEventEngineClientEnabled(); }
|
|
28
25
|
|
|
29
26
|
bool UseEventEngineListener() {
|
|
30
|
-
return
|
|
31
|
-
grpc_core::IsEventEngineListenerEnabled();
|
|
27
|
+
return grpc_core::IsEventEngineListenerEnabled();
|
|
32
28
|
}
|
|
33
29
|
|
|
34
30
|
bool UsePollsetAlternative() {
|
|
@@ -36,14 +32,4 @@ bool UsePollsetAlternative() {
|
|
|
36
32
|
grpc_core::IsPollsetAlternativeEnabled();
|
|
37
33
|
}
|
|
38
34
|
|
|
39
|
-
// Returns true if the poller is disabled by build configuration or experiment
|
|
40
|
-
// flags.
|
|
41
|
-
bool EventEngineExperimentDisabledForPython() {
|
|
42
|
-
#ifdef GRPC_PYTHON_BUILD
|
|
43
|
-
return !grpc_core::IsEventEnginePollerForPythonEnabled();
|
|
44
|
-
#else
|
|
45
|
-
return false;
|
|
46
|
-
#endif
|
|
47
|
-
}
|
|
48
|
-
|
|
49
35
|
} // namespace grpc_event_engine::experimental
|
|
@@ -35,10 +35,6 @@ bool UseEventEngineListener();
|
|
|
35
35
|
// may disable the poller in some builds.
|
|
36
36
|
bool UsePollsetAlternative();
|
|
37
37
|
|
|
38
|
-
// Returns true if the poller is disabled by build configuration or experiment
|
|
39
|
-
// flags.
|
|
40
|
-
bool EventEngineExperimentDisabledForPython();
|
|
41
|
-
|
|
42
38
|
} // namespace grpc_event_engine::experimental
|
|
43
39
|
|
|
44
40
|
#endif // GRPC_SRC_CORE_LIB_EVENT_ENGINE_SHIM_H
|