Added generated configs

pull/2135/head
David Garcia Quintas 10 years ago
parent f9b803ee2c
commit 5927aec9b7
  1. 4
      gRPC.podspec
  2. 10
      src/core/channel/compress_filter.c
  3. 13
      src/core/channel/compress_filter.h
  4. 2
      src/core/surface/call.c
  5. 1
      src/core/surface/channel.c
  6. 5
      src/core/surface/secure_channel_create.c
  7. 2
      test/core/end2end/fixtures/chttp2_socket_pair.c
  8. 2
      test/core/end2end/fixtures/chttp2_socket_pair_one_byte_at_a_time.c
  9. 2
      test/core/end2end/fixtures/chttp2_socket_pair_with_grpc_trace.c
  10. 53
      test/core/end2end/tests/request_with_compressed_payload.c
  11. 2
      tools/doxygen/Doxyfile.core.internal

File diff suppressed because one or more lines are too long

@ -43,7 +43,7 @@
typedef struct call_data {
gpr_slice_buffer slices;
int remaining_slice_bytes;
int no_compress; /**< whether skip compression for this specific call */
int no_compress; /**< whether to skip compression for this specific call */
grpc_linked_mdelem compression_algorithm;
} call_data;
@ -113,8 +113,9 @@ static void process_send_ops(grpc_call_element *elem,
}
}
GPR_ASSERT(metadata_op_index >= 0);
GPR_ASSERT(begin_message_index >= 0);
if (metadata_op_index < 0 || begin_message_index < 0) { /* bail out */
return;
}
/* update both the metadata and the begin_message's flags */
if (calld->no_compress) {
@ -212,9 +213,6 @@ static void init_channel_elem(grpc_channel_element *elem,
grpc_channel_args_get_compression_level(args);
const grpc_compression_algorithm none_alg = GRPC_COMPRESS_NONE;
/*We shouldn't be in this filter if compression is disabled. */
GPR_ASSERT(clevel != GRPC_COMPRESS_LEVEL_NONE);
channeld->compress_algorithm_md = grpc_mdelem_from_string_and_buffer(
mdctx, "grpc-compression-level", (gpr_uint8*)&clevel, sizeof(clevel));
channeld->compress_algorithm = grpc_compression_algorithm_for_level(clevel);

@ -36,7 +36,18 @@
#include "src/core/channel/channel_stack.h"
/* XXX */
/** Message-level compression filter.
*
* See <grpc/compression.h> for the available compression levels.
*
* Use grpc_channel_args_set_compression_level and
* grpc_channel_args_get_compression_level to interact with the compression
* settings for a channel.
*
* grpc_op instances of type GRPC_OP_SEND_MESSAGE can have the bit specified by
* the GRPC_WRITE_NO_COMPRESS mask in order to disable compression in an
* otherwise compressed channel.
* */
extern const grpc_channel_filter grpc_compress_filter;
#endif /* GRPC_INTERNAL_CORE_CHANNEL_COMPRESS_FILTER_H */

@ -1295,7 +1295,7 @@ grpc_call_error grpc_call_start_batch(grpc_call *call, const grpc_op *ops,
req = &reqs[out++];
req->op = GRPC_IOREQ_SEND_MESSAGE;
req->data.send_message = op->data.send_message;
req->flags = ops->flags;
req->flags = op->flags;
break;
case GRPC_OP_SEND_CLOSE_FROM_CLIENT:
/* Flag validation: currently allow no flags */

@ -265,7 +265,6 @@ grpc_mdstr *grpc_channel_get_compresssion_level_string(grpc_channel *channel) {
return channel->grpc_compression_level_string;
}
grpc_mdelem *grpc_channel_get_reffed_status_elem(grpc_channel *channel, int i) {
if (i >= 0 && i < NUM_CACHED_STATUS_ELEMS) {
return grpc_mdelem_ref(channel->grpc_status_elem[i]);

@ -42,6 +42,7 @@
#include "src/core/channel/channel_args.h"
#include "src/core/channel/client_channel.h"
#include "src/core/channel/client_setup.h"
#include "src/core/channel/compress_filter.h"
#include "src/core/channel/connected_channel.h"
#include "src/core/channel/http_client_filter.h"
#include "src/core/iomgr/resolve_address.h"
@ -239,6 +240,10 @@ grpc_channel *grpc_secure_channel_create(grpc_credentials *creds,
if (grpc_channel_args_is_census_enabled(args)) {
filters[n++] = &grpc_client_census_filter;
} */
if (grpc_channel_args_get_compression_level(args) >
GRPC_COMPRESS_LEVEL_NONE) {
filters[n++] = &grpc_compress_filter;
}
filters[n++] = &grpc_client_channel_filter;
GPR_ASSERT(n <= MAX_FILTERS);
channel = grpc_channel_create_from_filters(filters, n, args_copy, mdctx, 1);

@ -39,6 +39,7 @@
#include "src/core/channel/connected_channel.h"
#include "src/core/channel/http_client_filter.h"
#include "src/core/channel/http_server_filter.h"
#include "src/core/channel/compress_filter.h"
#include "src/core/iomgr/endpoint_pair.h"
#include "src/core/iomgr/iomgr.h"
#include "src/core/surface/channel.h"
@ -77,6 +78,7 @@ static grpc_transport_setup_result client_setup_transport(
const grpc_channel_filter *filters[] = {&grpc_client_surface_filter,
&grpc_http_client_filter,
&grpc_compress_filter,
&grpc_connected_channel_filter};
size_t nfilters = sizeof(filters) / sizeof(*filters);
grpc_channel *channel = grpc_channel_create_from_filters(

@ -39,6 +39,7 @@
#include "src/core/channel/connected_channel.h"
#include "src/core/channel/http_client_filter.h"
#include "src/core/channel/http_server_filter.h"
#include "src/core/channel/compress_filter.h"
#include "src/core/iomgr/endpoint_pair.h"
#include "src/core/iomgr/iomgr.h"
#include "src/core/surface/channel.h"
@ -77,6 +78,7 @@ static grpc_transport_setup_result client_setup_transport(
const grpc_channel_filter *filters[] = {&grpc_client_surface_filter,
&grpc_http_client_filter,
&grpc_compress_filter,
&grpc_connected_channel_filter};
size_t nfilters = sizeof(filters) / sizeof(*filters);
grpc_channel *channel = grpc_channel_create_from_filters(

@ -39,6 +39,7 @@
#include "src/core/channel/connected_channel.h"
#include "src/core/channel/http_client_filter.h"
#include "src/core/channel/http_server_filter.h"
#include "src/core/channel/compress_filter.h"
#include "src/core/iomgr/endpoint_pair.h"
#include "src/core/iomgr/iomgr.h"
#include "src/core/support/env.h"
@ -78,6 +79,7 @@ static grpc_transport_setup_result client_setup_transport(
const grpc_channel_filter *filters[] = {&grpc_client_surface_filter,
&grpc_http_client_filter,
&grpc_compress_filter,
&grpc_connected_channel_filter};
size_t nfilters = sizeof(filters) / sizeof(*filters);
grpc_channel *channel = grpc_channel_create_from_filters(

@ -103,9 +103,11 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_destroy(f->client_cq);
}
/* Client sends a request with payload, server reads then returns status. */
static void test_invoke_request_with_compressed_payload(
grpc_end2end_test_config config) {
static void request_with_payload_template(
grpc_end2end_test_config config, const char *test_name,
gpr_uint32 send_flags_bitmask,
grpc_compression_level requested_compression_level,
grpc_compression_algorithm expected_compression_algorithm) {
grpc_call *c;
grpc_call *s;
gpr_slice request_payload_slice;
@ -132,17 +134,15 @@ static void test_invoke_request_with_compressed_payload(
request_payload_slice = gpr_slice_from_copied_string(str);
request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1);
client_args =
grpc_channel_args_set_compression_level(NULL, GRPC_COMPRESS_LEVEL_HIGH);
server_args =
grpc_channel_args_set_compression_level(NULL, GRPC_COMPRESS_LEVEL_HIGH);
client_args = grpc_channel_args_set_compression_level(
NULL, requested_compression_level);
server_args = grpc_channel_args_set_compression_level(
NULL, requested_compression_level);
f = begin_test(config, "test_invoke_request_with_compressed_payload",
client_args, server_args);
f = begin_test(config, test_name, client_args, server_args);
v_client = cq_verifier_create(f.client_cq);
v_server = cq_verifier_create(f.server_cq);
c = grpc_channel_create_call(f.client, f.client_cq, "/foo",
"foo.test.google.fr", deadline);
GPR_ASSERT(c);
@ -159,7 +159,7 @@ static void test_invoke_request_with_compressed_payload(
op++;
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message = request_payload;
op->flags = 0;
op->flags = send_flags_bitmask;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
op->flags = 0;
@ -222,6 +222,11 @@ static void test_invoke_request_with_compressed_payload(
GPR_ASSERT(0 == strcmp(call_details.method, "/foo"));
GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr"));
GPR_ASSERT(was_cancelled == 0);
GPR_ASSERT(request_payload_recv->type == GRPC_BB_RAW);
GPR_ASSERT(request_payload_recv->data.raw.compression ==
expected_compression_algorithm);
GPR_ASSERT(byte_buffer_eq_string(request_payload_recv, str));
gpr_free(details);
@ -246,6 +251,32 @@ static void test_invoke_request_with_compressed_payload(
config.tear_down_data(&f);
}
static void test_invoke_request_with_excepcionally_uncompressed_payload(
grpc_end2end_test_config config) {
request_with_payload_template(
config, "test_invoke_request_with_excepcionally_uncompressed_payload",
GRPC_WRITE_NO_COMPRESS, GRPC_COMPRESS_LEVEL_HIGH, GRPC_COMPRESS_NONE);
}
static void test_invoke_request_with_compressed_payload(
grpc_end2end_test_config config) {
request_with_payload_template(
config, "test_invoke_request_with_compressed_payload", 0,
GRPC_COMPRESS_LEVEL_HIGH,
grpc_compression_algorithm_for_level(GRPC_COMPRESS_LEVEL_HIGH));
}
static void test_invoke_request_with_uncompressed_payload(
grpc_end2end_test_config config) {
request_with_payload_template(
config, "test_invoke_request_with_uncompressed_payload", 0,
GRPC_COMPRESS_LEVEL_NONE,
grpc_compression_algorithm_for_level(GRPC_COMPRESS_LEVEL_NONE));
}
void grpc_end2end_tests(grpc_end2end_test_config config) {
test_invoke_request_with_excepcionally_uncompressed_payload(config);
test_invoke_request_with_compressed_payload(config);
test_invoke_request_with_uncompressed_payload(config);
}

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save