From e2d6a61e355198268801558e024d6b47034ddd8e Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 9 Mar 2016 10:14:30 -0800 Subject: [PATCH 01/36] Introduce stream stats type --- src/core/transport/transport.c | 12 ++++++++++++ src/core/transport/transport.h | 17 +++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/core/transport/transport.c b/src/core/transport/transport.c index 3b555fa9338..49c848f87de 100644 --- a/src/core/transport/transport.c +++ b/src/core/transport/transport.c @@ -35,6 +35,7 @@ #include #include #include +#include #include "src/core/transport/transport_impl.h" #ifdef GRPC_STREAM_REFCOUNT_DEBUG @@ -76,6 +77,17 @@ void grpc_stream_ref_init(grpc_stream_refcount *refcount, int initial_refs, grpc_closure_init(&refcount->destroy, cb, cb_arg); } +static void one_way_stats_init(grpc_transport_one_way_stats *stats) { + gpr_stats_init(&stats->framing_bytes, 0); + gpr_stats_init(&stats->data_bytes, 0); + gpr_stats_init(&stats->header_bytes, 0); +} + +void grpc_transport_stream_stats_init(grpc_transport_stream_stats *stats) { + one_way_stats_init(&stats->incoming); + one_way_stats_init(&stats->outgoing); +} + size_t grpc_transport_stream_size(grpc_transport *transport) { return transport->vtable->sizeof_stream; } diff --git a/src/core/transport/transport.h b/src/core/transport/transport.h index ed6e121c9cb..183d1cb93fb 100644 --- a/src/core/transport/transport.h +++ b/src/core/transport/transport.h @@ -36,11 +36,11 @@ #include +#include "src/core/channel/context.h" #include "src/core/iomgr/pollset.h" #include "src/core/iomgr/pollset_set.h" -#include "src/core/transport/metadata_batch.h" #include "src/core/transport/byte_stream.h" -#include "src/core/channel/context.h" +#include "src/core/transport/metadata_batch.h" /* forward declarations */ typedef struct grpc_transport grpc_transport; @@ -154,6 +154,19 @@ typedef struct grpc_transport_op { grpc_closure *send_ping; } grpc_transport_op; +typedef struct { + gpr_stats_counter framing_bytes; + gpr_stats_counter data_bytes; + gpr_stats_counter header_bytes; +} grpc_transport_one_way_stats; + +typedef struct grpc_transport_stream_stats { + grpc_transport_one_way_stats incoming; + grpc_transport_one_way_stats outgoing; +} grpc_transport_stream_stats; + +void grpc_transport_stream_stats_init(grpc_transport_stream_stats *stats); + /* Returns the amount of memory required to store a grpc_stream for this transport */ size_t grpc_transport_stream_size(grpc_transport *transport); From 466129eb2466e087ca0203bd34dd015bdeca84b5 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 9 Mar 2016 14:43:18 -0800 Subject: [PATCH 02/36] Mechanism for reporting stats up --- src/core/surface/call.c | 5 +++ src/core/transport/chttp2/internal.h | 4 +++ src/core/transport/chttp2/writing.c | 8 +++-- src/core/transport/chttp2_transport.c | 51 +++++++++++++++++++-------- src/core/transport/transport.c | 21 +++++++---- src/core/transport/transport.h | 33 ++++++++++------- 6 files changed, 85 insertions(+), 37 deletions(-) diff --git a/src/core/surface/call.c b/src/core/surface/call.c index 1b117aa6b8c..188db82be99 100644 --- a/src/core/surface/call.c +++ b/src/core/surface/call.c @@ -174,6 +174,9 @@ struct grpc_call { /* Received call statuses from various sources */ received_status status[STATUS_SOURCE_COUNT]; + /* Call stats: only valid after trailing metadata received */ + grpc_transport_stream_stats stats; + /* Compression algorithm for the call */ grpc_compression_algorithm compression_algorithm; /* Supported encodings (compression algorithms), a bitset */ @@ -1371,6 +1374,7 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx, bctl->recv_final_op = 1; stream_op.recv_trailing_metadata = &call->metadata_batch[1 /* is_receiving */][1 /* is_trailing */]; + stream_op.collect_stats = &call->stats; break; case GRPC_OP_RECV_CLOSE_ON_SERVER: /* Flag validation: currently allow no flags */ @@ -1392,6 +1396,7 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx, bctl->recv_final_op = 1; stream_op.recv_trailing_metadata = &call->metadata_batch[1 /* is_receiving */][1 /* is_trailing */]; + stream_op.collect_stats = &call->stats; break; } } diff --git a/src/core/transport/chttp2/internal.h b/src/core/transport/chttp2/internal.h index b720d1ab3e5..47b6ffff626 100644 --- a/src/core/transport/chttp2/internal.h +++ b/src/core/transport/chttp2/internal.h @@ -394,6 +394,9 @@ typedef struct { grpc_metadata_batch *recv_trailing_metadata; grpc_closure *recv_trailing_metadata_finished; + grpc_transport_stream_stats *collecting_stats; + grpc_transport_stream_stats stats; + /** when the application requests writes be closed, the write_closed is 'queued'; when the close is flow controlled into the send path, we are 'sending' it; when the write has been performed it is 'sent' */ @@ -635,6 +638,7 @@ void grpc_chttp2_parsing_become_skip_parser( grpc_exec_ctx *exec_ctx, grpc_chttp2_transport_parsing *transport_parsing); void grpc_chttp2_complete_closure_step(grpc_exec_ctx *exec_ctx, + grpc_chttp2_stream_global *stream_global, grpc_closure **pclosure, int success); #define GRPC_CHTTP2_CLIENT_CONNECT_STRING "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n" diff --git a/src/core/transport/chttp2/writing.c b/src/core/transport/chttp2/writing.c index 107725cbc79..482994c25d9 100644 --- a/src/core/transport/chttp2/writing.c +++ b/src/core/transport/chttp2/writing.c @@ -328,17 +328,19 @@ void grpc_chttp2_cleanup_writing( transport_global, transport_writing, &stream_global, &stream_writing)) { if (stream_writing->sent_initial_metadata) { grpc_chttp2_complete_closure_step( - exec_ctx, &stream_global->send_initial_metadata_finished, 1); + exec_ctx, stream_global, + &stream_global->send_initial_metadata_finished, 1); } if (stream_writing->sent_message) { GPR_ASSERT(stream_writing->send_message == NULL); grpc_chttp2_complete_closure_step( - exec_ctx, &stream_global->send_message_finished, 1); + exec_ctx, stream_global, &stream_global->send_message_finished, 1); stream_writing->sent_message = 0; } if (stream_writing->sent_trailing_metadata) { grpc_chttp2_complete_closure_step( - exec_ctx, &stream_global->send_trailing_metadata_finished, 1); + exec_ctx, stream_global, + &stream_global->send_trailing_metadata_finished, 1); } if (stream_writing->sent_trailing_metadata) { grpc_chttp2_mark_stream_closed(exec_ctx, transport_global, stream_global, diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c index 19265252ca3..2b87642f17a 100644 --- a/src/core/transport/chttp2_transport.c +++ b/src/core/transport/chttp2_transport.c @@ -758,23 +758,35 @@ static void maybe_start_some_streams( } } +#define CLOSURE_BARRIER_STATS_BIT (1 << 0) +#define CLOSURE_BARRIER_FAILURE_BIT (1 << 1) +#define CLOSURE_BARRIER_FIRST_REF_BIT (1 << 16) + static grpc_closure *add_closure_barrier(grpc_closure *closure) { - closure->final_data += 2; + closure->final_data += CLOSURE_BARRIER_FIRST_REF_BIT; return closure; } void grpc_chttp2_complete_closure_step(grpc_exec_ctx *exec_ctx, + grpc_chttp2_stream_global *stream_global, grpc_closure **pclosure, int success) { grpc_closure *closure = *pclosure; if (closure == NULL) { return; } - closure->final_data -= 2; + closure->final_data -= CLOSURE_BARRIER_FIRST_REF_BIT; if (!success) { - closure->final_data |= 1; + closure->final_data |= CLOSURE_BARRIER_FAILURE_BIT; } - if (closure->final_data < 2) { - grpc_exec_ctx_enqueue(exec_ctx, closure, closure->final_data == 0, NULL); + if (closure->final_data < CLOSURE_BARRIER_FIRST_REF_BIT) { + if (closure->final_data & CLOSURE_BARRIER_STATS_BIT) { + grpc_transport_move_stats(&stream_global->stats, + stream_global->collecting_stats); + stream_global->collecting_stats = NULL; + } + grpc_exec_ctx_enqueue( + exec_ctx, closure, + (closure->final_data & CLOSURE_BARRIER_FAILURE_BIT) == 0, NULL); } *pclosure = NULL; } @@ -807,7 +819,13 @@ static void perform_stream_op_locked( } /* use final_data as a barrier until enqueue time; the inital counter is dropped at the end of this function */ - on_complete->final_data = 2; + on_complete->final_data = CLOSURE_BARRIER_FIRST_REF_BIT; + + if (op->collect_stats != NULL) { + GPR_ASSERT(stream_global->collecting_stats == NULL); + stream_global->collecting_stats = op->collect_stats; + on_complete->final_data |= CLOSURE_BARRIER_STATS_BIT; + } if (op->cancel_with_status != GRPC_STATUS_OK) { cancel_from_api(exec_ctx, transport_global, stream_global, @@ -840,7 +858,8 @@ static void perform_stream_op_locked( } } else { grpc_chttp2_complete_closure_step( - exec_ctx, &stream_global->send_initial_metadata_finished, 0); + exec_ctx, stream_global, + &stream_global->send_initial_metadata_finished, 0); } } @@ -850,7 +869,7 @@ static void perform_stream_op_locked( stream_global->send_message_finished = add_closure_barrier(on_complete); if (stream_global->write_closed) { grpc_chttp2_complete_closure_step( - exec_ctx, &stream_global->send_message_finished, 0); + exec_ctx, stream_global, &stream_global->send_message_finished, 0); } else if (stream_global->id != 0) { stream_global->send_message = op->send_message; grpc_chttp2_become_writable(transport_global, stream_global); @@ -868,7 +887,8 @@ static void perform_stream_op_locked( } if (stream_global->write_closed) { grpc_chttp2_complete_closure_step( - exec_ctx, &stream_global->send_trailing_metadata_finished, + exec_ctx, stream_global, + &stream_global->send_trailing_metadata_finished, grpc_metadata_batch_is_empty(op->send_trailing_metadata)); } else if (stream_global->id != 0) { /* TODO(ctiller): check if there's flow control for any outstanding @@ -907,7 +927,7 @@ static void perform_stream_op_locked( grpc_chttp2_list_add_check_read_ops(transport_global, stream_global); } - grpc_chttp2_complete_closure_step(exec_ctx, &on_complete, 1); + grpc_chttp2_complete_closure_step(exec_ctx, stream_global, &on_complete, 1); GPR_TIMER_END("perform_stream_op_locked", 0); } @@ -1078,7 +1098,8 @@ static void check_read_ops(grpc_exec_ctx *exec_ctx, &stream_global->received_trailing_metadata, stream_global->recv_trailing_metadata); grpc_chttp2_complete_closure_step( - exec_ctx, &stream_global->recv_trailing_metadata_finished, 1); + exec_ctx, stream_global, + &stream_global->recv_trailing_metadata_finished, 1); } } } @@ -1177,10 +1198,12 @@ void grpc_chttp2_fake_status(grpc_exec_ctx *exec_ctx, static void fail_pending_writes(grpc_exec_ctx *exec_ctx, grpc_chttp2_stream_global *stream_global) { grpc_chttp2_complete_closure_step( - exec_ctx, &stream_global->send_initial_metadata_finished, 0); + exec_ctx, stream_global, &stream_global->send_initial_metadata_finished, + 0); grpc_chttp2_complete_closure_step( - exec_ctx, &stream_global->send_trailing_metadata_finished, 0); - grpc_chttp2_complete_closure_step(exec_ctx, + exec_ctx, stream_global, &stream_global->send_trailing_metadata_finished, + 0); + grpc_chttp2_complete_closure_step(exec_ctx, stream_global, &stream_global->send_message_finished, 0); } diff --git a/src/core/transport/transport.c b/src/core/transport/transport.c index 49c848f87de..5b5af0e7d0b 100644 --- a/src/core/transport/transport.c +++ b/src/core/transport/transport.c @@ -77,15 +77,22 @@ void grpc_stream_ref_init(grpc_stream_refcount *refcount, int initial_refs, grpc_closure_init(&refcount->destroy, cb, cb_arg); } -static void one_way_stats_init(grpc_transport_one_way_stats *stats) { - gpr_stats_init(&stats->framing_bytes, 0); - gpr_stats_init(&stats->data_bytes, 0); - gpr_stats_init(&stats->header_bytes, 0); +static void move64(uint64_t *from, uint64_t *to) { + *to += *from; + *from = 0; } -void grpc_transport_stream_stats_init(grpc_transport_stream_stats *stats) { - one_way_stats_init(&stats->incoming); - one_way_stats_init(&stats->outgoing); +void grpc_transport_move_one_way_stats(grpc_transport_one_way_stats *from, + grpc_transport_one_way_stats *to) { + move64(&from->framing_bytes, &to->framing_bytes); + move64(&from->data_bytes, &to->data_bytes); + move64(&from->header_bytes, &to->header_bytes); +} + +void grpc_transport_move_stats(grpc_transport_stream_stats *from, + grpc_transport_stream_stats *to) { + grpc_transport_move_one_way_stats(&from->incoming, &to->incoming); + grpc_transport_move_one_way_stats(&from->outgoing, &to->outgoing); } size_t grpc_transport_stream_size(grpc_transport *transport) { diff --git a/src/core/transport/transport.h b/src/core/transport/transport.h index 183d1cb93fb..8b9f95da796 100644 --- a/src/core/transport/transport.h +++ b/src/core/transport/transport.h @@ -78,6 +78,23 @@ void grpc_stream_unref(grpc_exec_ctx *exec_ctx, grpc_stream_refcount *refcount); grpc_stream_ref_init(rc, ir, cb, cb_arg) #endif +typedef struct { + uint64_t framing_bytes; + uint64_t data_bytes; + uint64_t header_bytes; +} grpc_transport_one_way_stats; + +typedef struct grpc_transport_stream_stats { + grpc_transport_one_way_stats incoming; + grpc_transport_one_way_stats outgoing; +} grpc_transport_stream_stats; + +void grpc_transport_move_one_way_stats(grpc_transport_one_way_stats *from, + grpc_transport_one_way_stats *to); + +void grpc_transport_move_stats(grpc_transport_stream_stats *from, + grpc_transport_stream_stats *to); + /* Transport stream op: a set of operations to perform on a transport against a single stream */ typedef struct grpc_transport_stream_op { @@ -104,6 +121,9 @@ typedef struct grpc_transport_stream_op { */ grpc_metadata_batch *recv_trailing_metadata; + /** Collect any stats into provided buffer, zero internal stat counters */ + grpc_transport_stream_stats *collect_stats; + /** Should be enqueued when all requested operations (excluding recv_message and recv_initial_metadata which have their own closures) in a given batch have been completed. */ @@ -154,19 +174,6 @@ typedef struct grpc_transport_op { grpc_closure *send_ping; } grpc_transport_op; -typedef struct { - gpr_stats_counter framing_bytes; - gpr_stats_counter data_bytes; - gpr_stats_counter header_bytes; -} grpc_transport_one_way_stats; - -typedef struct grpc_transport_stream_stats { - grpc_transport_one_way_stats incoming; - grpc_transport_one_way_stats outgoing; -} grpc_transport_stream_stats; - -void grpc_transport_stream_stats_init(grpc_transport_stream_stats *stats); - /* Returns the amount of memory required to store a grpc_stream for this transport */ size_t grpc_transport_stream_size(grpc_transport *transport); From 5987c70bd118df69c2f4a3f704a88e8bd3d401c4 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 9 Mar 2016 16:55:23 -0800 Subject: [PATCH 03/36] Punch through flags for incoming calls --- include/grpc/grpc.h | 35 +++++++++++++------------- include/grpc/impl/codegen/grpc_types.h | 1 + src/core/surface/server.c | 22 ++++++++++------ src/cpp/server/server.cc | 3 ++- 4 files changed, 35 insertions(+), 26 deletions(-) diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 5113645daf9..dbd2cc00007 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -36,13 +36,13 @@ #include -#include #include -#include -#include #include -#include #include +#include +#include +#include +#include #ifdef __cplusplus extern "C" { @@ -154,9 +154,8 @@ GRPCAPI void grpc_alarm_cancel(grpc_alarm *alarm); GRPCAPI void grpc_alarm_destroy(grpc_alarm *alarm); /** Check the connectivity state of a channel. */ -GRPCAPI grpc_connectivity_state -grpc_channel_check_connectivity_state(grpc_channel *channel, - int try_to_connect); +GRPCAPI grpc_connectivity_state grpc_channel_check_connectivity_state( + grpc_channel *channel, int try_to_connect); /** Watch for a change in connectivity state. Once the channel connectivity state is different from last_observed_state, @@ -267,9 +266,10 @@ GRPCAPI grpc_call_error grpc_call_cancel(grpc_call *call, void *reserved); and description passed in. Importantly, this function does not send status nor description to the remote endpoint. */ -GRPCAPI grpc_call_error -grpc_call_cancel_with_status(grpc_call *call, grpc_status_code status, - const char *description, void *reserved); +GRPCAPI grpc_call_error grpc_call_cancel_with_status(grpc_call *call, + grpc_status_code status, + const char *description, + void *reserved); /** Destroy a call. THREAD SAFETY: grpc_call_destroy is thread-compatible */ @@ -283,13 +283,11 @@ GRPCAPI void grpc_call_destroy(grpc_call *call); to \a cq_bound_to_call. Note that \a cq_for_notification must have been registered to the server via \a grpc_server_register_completion_queue. */ -GRPCAPI grpc_call_error -grpc_server_request_call(grpc_server *server, grpc_call **call, - grpc_call_details *details, - grpc_metadata_array *request_metadata, - grpc_completion_queue *cq_bound_to_call, - grpc_completion_queue *cq_for_notification, - void *tag_new); +GRPCAPI grpc_call_error grpc_server_request_call( + grpc_server *server, grpc_call **call, grpc_call_details *details, + grpc_metadata_array *request_metadata, + grpc_completion_queue *cq_bound_to_call, + grpc_completion_queue *cq_for_notification, void *tag_new); /** Registers a method in the server. Methods to this (host, method) pair will not be reported by @@ -299,7 +297,8 @@ grpc_server_request_call(grpc_server *server, grpc_call **call, Must be called before grpc_server_start. Returns NULL on failure. */ GRPCAPI void *grpc_server_register_method(grpc_server *server, - const char *method, const char *host); + const char *method, const char *host, + uint32_t flags); /** Request notification of a new pre-registered call. 'cq_for_notification' must have been registered to the server via diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h index b11f6ffec41..2c39f4b6e68 100644 --- a/include/grpc/impl/codegen/grpc_types.h +++ b/include/grpc/impl/codegen/grpc_types.h @@ -250,6 +250,7 @@ typedef struct { char *host; size_t host_capacity; gpr_timespec deadline; + uint32_t flags; void *reserved; } grpc_call_details; diff --git a/src/core/surface/server.c b/src/core/surface/server.c index 5b13d4ba526..72b3065894d 100644 --- a/src/core/surface/server.c +++ b/src/core/surface/server.c @@ -758,10 +758,17 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx, } static const grpc_channel_filter server_surface_filter = { - server_start_transport_stream_op, grpc_channel_next_op, sizeof(call_data), - init_call_elem, grpc_call_stack_ignore_set_pollset, destroy_call_elem, - sizeof(channel_data), init_channel_elem, destroy_channel_elem, - grpc_call_next_get_peer, "server", + server_start_transport_stream_op, + grpc_channel_next_op, + sizeof(call_data), + init_call_elem, + grpc_call_stack_ignore_set_pollset, + destroy_call_elem, + sizeof(channel_data), + init_channel_elem, + destroy_channel_elem, + grpc_call_next_get_peer, + "server", }; void grpc_server_register_completion_queue(grpc_server *server, @@ -845,7 +852,7 @@ static int streq(const char *a, const char *b) { } void *grpc_server_register_method(grpc_server *server, const char *method, - const char *host) { + const char *host, uint32_t flags) { registered_method *m; GRPC_API_TRACE("grpc_server_register_method(server=%p, method=%s, host=%s)", 3, (server, method, host)); @@ -930,7 +937,8 @@ void grpc_server_setup_transport(grpc_exec_ctx *exec_ctx, grpc_server *s, channel = grpc_channel_create_from_filters(exec_ctx, NULL, filters, num_filters, args, 0); chand = (channel_data *)grpc_channel_stack_element( - grpc_channel_get_channel_stack(channel), 0)->channel_data; + grpc_channel_get_channel_stack(channel), 0) + ->channel_data; chand->server = s; server_ref(s); chand->channel = channel; @@ -951,7 +959,7 @@ void grpc_server_setup_transport(grpc_exec_ctx *exec_ctx, grpc_server *s, method = grpc_mdstr_from_string(rm->method); hash = GRPC_MDSTR_KV_HASH(host ? host->hash : 0, method->hash); for (probes = 0; chand->registered_methods[(hash + probes) % slots] - .server_registered_method != NULL; + .server_registered_method != NULL; probes++) ; if (probes > max_probes) max_probes = probes; diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 6d31a608c80..05c58ccc4f0 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -264,6 +264,7 @@ class Server::SyncRequest GRPC_FINAL : public CompletionQueueTag { void* const tag_; bool in_flight_; const bool has_request_payload_; + uint32_t incoming_flags_; grpc_call* call_; grpc_call_details* call_details_; gpr_timespec deadline_; @@ -334,7 +335,7 @@ bool Server::RegisterService(const grpc::string* host, Service* service) { } RpcServiceMethod* method = it->get(); void* tag = grpc_server_register_method(server_, method->name(), - host ? host->c_str() : nullptr); + host ? host->c_str() : nullptr, 0); if (tag == nullptr) { gpr_log(GPR_DEBUG, "Attempt to register %s multiple times", method->name()); From c6549764e88159d70317c7b7b332d7be215a85d4 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 9 Mar 2016 17:10:43 -0800 Subject: [PATCH 04/36] Change client :method selection based on idempotency --- include/grpc/impl/codegen/grpc_types.h | 6 ++ src/core/channel/http_client_filter.c | 19 +++- src/core/surface/call.c | 15 ++- src/core/transport/static_metadata.c | 126 +++++++++++++++++----- src/core/transport/static_metadata.h | 106 +++++++++--------- src/core/transport/transport.h | 10 +- tools/codegen/core/gen_static_metadata.py | 14 +-- 7 files changed, 199 insertions(+), 97 deletions(-) diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h index 2c39f4b6e68..993fc97adb6 100644 --- a/include/grpc/impl/codegen/grpc_types.h +++ b/include/grpc/impl/codegen/grpc_types.h @@ -199,6 +199,12 @@ typedef enum grpc_call_error { /** Mask of all valid flags. */ #define GRPC_WRITE_USED_MASK (GRPC_WRITE_BUFFER_HINT | GRPC_WRITE_NO_COMPRESS) +/* Initial metadata flags */ +/** Signal that the call is idempotent */ +#define GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST (0x00000010u) +/** Mask of all valid flags */ +#define GRPC_INITIAL_METADATA_USED_MASK GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST + /** A single metadata element */ typedef struct grpc_metadata { const char *key; diff --git a/src/core/channel/http_client_filter.c b/src/core/channel/http_client_filter.c index 1aa27208c2e..f08eb7e519a 100644 --- a/src/core/channel/http_client_filter.c +++ b/src/core/channel/http_client_filter.c @@ -112,7 +112,9 @@ static void hc_mutate_op(grpc_call_element *elem, /* Send : prefixed headers, which have to be before any application layer headers. */ grpc_metadata_batch_add_head(op->send_initial_metadata, &calld->method, - GRPC_MDELEM_METHOD_POST); + op->idempotent_request + ? GRPC_MDELEM_METHOD_PUT + : GRPC_MDELEM_METHOD_POST); grpc_metadata_batch_add_head(op->send_initial_metadata, &calld->scheme, channeld->static_scheme); grpc_metadata_batch_add_tail(op->send_initial_metadata, &calld->te_trailers, @@ -242,7 +244,14 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx, } const grpc_channel_filter grpc_http_client_filter = { - hc_start_transport_op, grpc_channel_next_op, sizeof(call_data), - init_call_elem, grpc_call_stack_ignore_set_pollset, destroy_call_elem, - sizeof(channel_data), init_channel_elem, destroy_channel_elem, - grpc_call_next_get_peer, "http-client"}; + hc_start_transport_op, + grpc_channel_next_op, + sizeof(call_data), + init_call_elem, + grpc_call_stack_ignore_set_pollset, + destroy_call_elem, + sizeof(channel_data), + init_channel_elem, + destroy_channel_elem, + grpc_call_next_get_peer, + "http-client"}; diff --git a/src/core/surface/call.c b/src/core/surface/call.c index 1b117aa6b8c..cf5c928d84b 100644 --- a/src/core/surface/call.c +++ b/src/core/surface/call.c @@ -909,7 +909,7 @@ static void set_cancelled_value(grpc_status_code status, void *dest) { *(int *)dest = (status != GRPC_STATUS_OK); } -static int are_write_flags_valid(uint32_t flags) { +static bool are_write_flags_valid(uint32_t flags) { /* check that only bits in GRPC_WRITE_(INTERNAL?)_USED_MASK are set */ const uint32_t allowed_write_positions = (GRPC_WRITE_USED_MASK | GRPC_WRITE_INTERNAL_USED_MASK); @@ -917,6 +917,15 @@ static int are_write_flags_valid(uint32_t flags) { return !(flags & invalid_positions); } +static bool are_initial_metadata_flags_valid(uint32_t flags, bool is_client) { + /* check that only bits in GRPC_WRITE_(INTERNAL?)_USED_MASK are set */ + uint32_t invalid_positions = ~GRPC_INITIAL_METADATA_USED_MASK; + if (!is_client) { + invalid_positions |= GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST; + } + return !(flags & invalid_positions); +} + static batch_control *allocate_batch_control(grpc_call *call) { size_t i; for (i = 0; i < MAX_CONCURRENT_BATCHES; i++) { @@ -1196,7 +1205,7 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx, switch (op->op) { case GRPC_OP_SEND_INITIAL_METADATA: /* Flag validation: currently allow no flags */ - if (op->flags != 0) { + if (!are_initial_metadata_flags_valid(op->flags, call->is_client)) { error = GRPC_CALL_ERROR_INVALID_FLAGS; goto done_with_error; } @@ -1220,6 +1229,8 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx, call->metadata_batch[0][0].deadline = call->send_deadline; stream_op.send_initial_metadata = &call->metadata_batch[0 /* is_receiving */][0 /* is_trailing */]; + stream_op.idempotent_request = + (op->flags & GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST) != 0; break; case GRPC_OP_SEND_MESSAGE: if (!are_write_flags_valid(op->flags)) { diff --git a/src/core/transport/static_metadata.c b/src/core/transport/static_metadata.c index eeedae06199..fc01b89b1da 100644 --- a/src/core/transport/static_metadata.c +++ b/src/core/transport/static_metadata.c @@ -1,5 +1,4 @@ /* - * * Copyright 2015-2016, Google Inc. * All rights reserved. * @@ -7,13 +6,13 @@ * modification, are permitted provided that the following conditions are * met: * - * * Redistributions of source code must retain the above copyright + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above + * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. - * * Neither the name of Google Inc. nor the names of its + * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * @@ -28,7 +27,6 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * */ /* @@ -52,7 +50,7 @@ uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 7, 5, 2, 4, 8, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; const uint8_t grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT * 2] = {11, 35, 10, 35, 12, 35, 12, 49, 13, 35, 14, 35, 15, 35, 16, 35, 17, 35, @@ -60,30 +58,102 @@ const uint8_t grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT * 2] = 30, 18, 30, 35, 31, 35, 32, 35, 36, 35, 37, 35, 38, 35, 39, 35, 42, 33, 42, 34, 42, 48, 42, 53, 42, 54, 42, 55, 42, 56, 43, 33, 43, 48, 43, 53, 46, 0, 46, 1, 46, 2, 50, 35, 57, 35, 58, 35, 59, 35, 60, 35, 61, 35, - 62, 35, 63, 35, 64, 35, 65, 35, 66, 40, 66, 68, 67, 78, 67, 79, 69, 35, - 70, 35, 71, 35, 72, 35, 73, 35, 74, 35, 75, 41, 75, 51, 75, 52, 76, 35, - 77, 35, 80, 3, 80, 4, 80, 5, 80, 6, 80, 7, 80, 8, 80, 9, 81, 35, - 82, 83, 84, 35, 85, 35, 86, 35, 87, 35, 88, 35}; + 62, 35, 63, 35, 64, 35, 65, 35, 66, 40, 66, 68, 66, 71, 67, 79, 67, 80, + 69, 35, 70, 35, 72, 35, 73, 35, 74, 35, 75, 35, 76, 41, 76, 51, 76, 52, + 77, 35, 78, 35, 81, 3, 81, 4, 81, 5, 81, 6, 81, 7, 81, 8, 81, 9, + 82, 35, 83, 84, 85, 35, 86, 35, 87, 35, 88, 35, 89, 35}; const char *const grpc_static_metadata_strings[GRPC_STATIC_MDSTR_COUNT] = { - "0", "1", "2", "200", "204", "206", "304", "400", "404", "500", "accept", - "accept-charset", "accept-encoding", "accept-language", "accept-ranges", - "access-control-allow-origin", "age", "allow", "application/grpc", - ":authority", "authorization", "cache-control", "census-bin", - "census-binary-bin", "content-disposition", "content-encoding", - "content-language", "content-length", "content-location", "content-range", - "content-type", "cookie", "date", "deflate", "deflate,gzip", "", "etag", - "expect", "expires", "from", "GET", "grpc", "grpc-accept-encoding", - "grpc-encoding", "grpc-internal-encoding-request", "grpc-message", - "grpc-status", "grpc-timeout", "gzip", "gzip, deflate", "host", "http", - "https", "identity", "identity,deflate", "identity,deflate,gzip", - "identity,gzip", "if-match", "if-modified-since", "if-none-match", - "if-range", "if-unmodified-since", "last-modified", "link", "location", - "max-forwards", ":method", ":path", "POST", "proxy-authenticate", - "proxy-authorization", "range", "referer", "refresh", "retry-after", - ":scheme", "server", "set-cookie", "/", "/index.html", ":status", - "strict-transport-security", "te", "trailers", "transfer-encoding", - "user-agent", "vary", "via", "www-authenticate"}; + "0", + "1", + "2", + "200", + "204", + "206", + "304", + "400", + "404", + "500", + "accept", + "accept-charset", + "accept-encoding", + "accept-language", + "accept-ranges", + "access-control-allow-origin", + "age", + "allow", + "application/grpc", + ":authority", + "authorization", + "cache-control", + "census-bin", + "census-binary-bin", + "content-disposition", + "content-encoding", + "content-language", + "content-length", + "content-location", + "content-range", + "content-type", + "cookie", + "date", + "deflate", + "deflate,gzip", + "", + "etag", + "expect", + "expires", + "from", + "GET", + "grpc", + "grpc-accept-encoding", + "grpc-encoding", + "grpc-internal-encoding-request", + "grpc-message", + "grpc-status", + "grpc-timeout", + "gzip", + "gzip, deflate", + "host", + "http", + "https", + "identity", + "identity,deflate", + "identity,deflate,gzip", + "identity,gzip", + "if-match", + "if-modified-since", + "if-none-match", + "if-range", + "if-unmodified-since", + "last-modified", + "link", + "location", + "max-forwards", + ":method", + ":path", + "POST", + "proxy-authenticate", + "proxy-authorization", + "PUT", + "range", + "referer", + "refresh", + "retry-after", + ":scheme", + "server", + "set-cookie", + "/", + "/index.html", + ":status", + "strict-transport-security", + "te", + "trailers", + "transfer-encoding", + "user-agent", + "vary", + "via", + "www-authenticate"}; const uint8_t grpc_static_accept_encoding_metadata[8] = {0, 29, 26, 30, 28, 32, 27, 31}; diff --git a/src/core/transport/static_metadata.h b/src/core/transport/static_metadata.h index ef72b802b51..b0e5b2fcdfa 100644 --- a/src/core/transport/static_metadata.h +++ b/src/core/transport/static_metadata.h @@ -1,5 +1,4 @@ /* - * * Copyright 2015-2016, Google Inc. * All rights reserved. * @@ -7,13 +6,13 @@ * modification, are permitted provided that the following conditions are * met: * - * * Redistributions of source code must retain the above copyright + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above + * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. - * * Neither the name of Google Inc. nor the names of its + * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * @@ -28,7 +27,6 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * */ /* @@ -48,7 +46,7 @@ #include "src/core/transport/metadata.h" -#define GRPC_STATIC_MDSTR_COUNT 89 +#define GRPC_STATIC_MDSTR_COUNT 90 extern grpc_mdstr grpc_static_mdstr_table[GRPC_STATIC_MDSTR_COUNT]; /* "0" */ #define GRPC_MDSTR_0 (&grpc_static_mdstr_table[0]) @@ -193,44 +191,46 @@ extern grpc_mdstr grpc_static_mdstr_table[GRPC_STATIC_MDSTR_COUNT]; #define GRPC_MDSTR_PROXY_AUTHENTICATE (&grpc_static_mdstr_table[69]) /* "proxy-authorization" */ #define GRPC_MDSTR_PROXY_AUTHORIZATION (&grpc_static_mdstr_table[70]) +/* "PUT" */ +#define GRPC_MDSTR_PUT (&grpc_static_mdstr_table[71]) /* "range" */ -#define GRPC_MDSTR_RANGE (&grpc_static_mdstr_table[71]) +#define GRPC_MDSTR_RANGE (&grpc_static_mdstr_table[72]) /* "referer" */ -#define GRPC_MDSTR_REFERER (&grpc_static_mdstr_table[72]) +#define GRPC_MDSTR_REFERER (&grpc_static_mdstr_table[73]) /* "refresh" */ -#define GRPC_MDSTR_REFRESH (&grpc_static_mdstr_table[73]) +#define GRPC_MDSTR_REFRESH (&grpc_static_mdstr_table[74]) /* "retry-after" */ -#define GRPC_MDSTR_RETRY_AFTER (&grpc_static_mdstr_table[74]) +#define GRPC_MDSTR_RETRY_AFTER (&grpc_static_mdstr_table[75]) /* ":scheme" */ -#define GRPC_MDSTR_SCHEME (&grpc_static_mdstr_table[75]) +#define GRPC_MDSTR_SCHEME (&grpc_static_mdstr_table[76]) /* "server" */ -#define GRPC_MDSTR_SERVER (&grpc_static_mdstr_table[76]) +#define GRPC_MDSTR_SERVER (&grpc_static_mdstr_table[77]) /* "set-cookie" */ -#define GRPC_MDSTR_SET_COOKIE (&grpc_static_mdstr_table[77]) +#define GRPC_MDSTR_SET_COOKIE (&grpc_static_mdstr_table[78]) /* "/" */ -#define GRPC_MDSTR_SLASH (&grpc_static_mdstr_table[78]) +#define GRPC_MDSTR_SLASH (&grpc_static_mdstr_table[79]) /* "/index.html" */ -#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (&grpc_static_mdstr_table[79]) +#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (&grpc_static_mdstr_table[80]) /* ":status" */ -#define GRPC_MDSTR_STATUS (&grpc_static_mdstr_table[80]) +#define GRPC_MDSTR_STATUS (&grpc_static_mdstr_table[81]) /* "strict-transport-security" */ -#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (&grpc_static_mdstr_table[81]) +#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (&grpc_static_mdstr_table[82]) /* "te" */ -#define GRPC_MDSTR_TE (&grpc_static_mdstr_table[82]) +#define GRPC_MDSTR_TE (&grpc_static_mdstr_table[83]) /* "trailers" */ -#define GRPC_MDSTR_TRAILERS (&grpc_static_mdstr_table[83]) +#define GRPC_MDSTR_TRAILERS (&grpc_static_mdstr_table[84]) /* "transfer-encoding" */ -#define GRPC_MDSTR_TRANSFER_ENCODING (&grpc_static_mdstr_table[84]) +#define GRPC_MDSTR_TRANSFER_ENCODING (&grpc_static_mdstr_table[85]) /* "user-agent" */ -#define GRPC_MDSTR_USER_AGENT (&grpc_static_mdstr_table[85]) +#define GRPC_MDSTR_USER_AGENT (&grpc_static_mdstr_table[86]) /* "vary" */ -#define GRPC_MDSTR_VARY (&grpc_static_mdstr_table[86]) +#define GRPC_MDSTR_VARY (&grpc_static_mdstr_table[87]) /* "via" */ -#define GRPC_MDSTR_VIA (&grpc_static_mdstr_table[87]) +#define GRPC_MDSTR_VIA (&grpc_static_mdstr_table[88]) /* "www-authenticate" */ -#define GRPC_MDSTR_WWW_AUTHENTICATE (&grpc_static_mdstr_table[88]) +#define GRPC_MDSTR_WWW_AUTHENTICATE (&grpc_static_mdstr_table[89]) -#define GRPC_STATIC_MDELEM_COUNT 78 +#define GRPC_STATIC_MDELEM_COUNT 79 extern grpc_mdelem grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT]; extern uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT]; /* "accept-charset": "" */ @@ -343,61 +343,63 @@ extern uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT]; #define GRPC_MDELEM_METHOD_GET (&grpc_static_mdelem_table[49]) /* ":method": "POST" */ #define GRPC_MDELEM_METHOD_POST (&grpc_static_mdelem_table[50]) +/* ":method": "PUT" */ +#define GRPC_MDELEM_METHOD_PUT (&grpc_static_mdelem_table[51]) /* ":path": "/" */ -#define GRPC_MDELEM_PATH_SLASH (&grpc_static_mdelem_table[51]) +#define GRPC_MDELEM_PATH_SLASH (&grpc_static_mdelem_table[52]) /* ":path": "/index.html" */ -#define GRPC_MDELEM_PATH_SLASH_INDEX_DOT_HTML (&grpc_static_mdelem_table[52]) +#define GRPC_MDELEM_PATH_SLASH_INDEX_DOT_HTML (&grpc_static_mdelem_table[53]) /* "proxy-authenticate": "" */ -#define GRPC_MDELEM_PROXY_AUTHENTICATE_EMPTY (&grpc_static_mdelem_table[53]) +#define GRPC_MDELEM_PROXY_AUTHENTICATE_EMPTY (&grpc_static_mdelem_table[54]) /* "proxy-authorization": "" */ -#define GRPC_MDELEM_PROXY_AUTHORIZATION_EMPTY (&grpc_static_mdelem_table[54]) +#define GRPC_MDELEM_PROXY_AUTHORIZATION_EMPTY (&grpc_static_mdelem_table[55]) /* "range": "" */ -#define GRPC_MDELEM_RANGE_EMPTY (&grpc_static_mdelem_table[55]) +#define GRPC_MDELEM_RANGE_EMPTY (&grpc_static_mdelem_table[56]) /* "referer": "" */ -#define GRPC_MDELEM_REFERER_EMPTY (&grpc_static_mdelem_table[56]) +#define GRPC_MDELEM_REFERER_EMPTY (&grpc_static_mdelem_table[57]) /* "refresh": "" */ -#define GRPC_MDELEM_REFRESH_EMPTY (&grpc_static_mdelem_table[57]) +#define GRPC_MDELEM_REFRESH_EMPTY (&grpc_static_mdelem_table[58]) /* "retry-after": "" */ -#define GRPC_MDELEM_RETRY_AFTER_EMPTY (&grpc_static_mdelem_table[58]) +#define GRPC_MDELEM_RETRY_AFTER_EMPTY (&grpc_static_mdelem_table[59]) /* ":scheme": "grpc" */ -#define GRPC_MDELEM_SCHEME_GRPC (&grpc_static_mdelem_table[59]) +#define GRPC_MDELEM_SCHEME_GRPC (&grpc_static_mdelem_table[60]) /* ":scheme": "http" */ -#define GRPC_MDELEM_SCHEME_HTTP (&grpc_static_mdelem_table[60]) +#define GRPC_MDELEM_SCHEME_HTTP (&grpc_static_mdelem_table[61]) /* ":scheme": "https" */ -#define GRPC_MDELEM_SCHEME_HTTPS (&grpc_static_mdelem_table[61]) +#define GRPC_MDELEM_SCHEME_HTTPS (&grpc_static_mdelem_table[62]) /* "server": "" */ -#define GRPC_MDELEM_SERVER_EMPTY (&grpc_static_mdelem_table[62]) +#define GRPC_MDELEM_SERVER_EMPTY (&grpc_static_mdelem_table[63]) /* "set-cookie": "" */ -#define GRPC_MDELEM_SET_COOKIE_EMPTY (&grpc_static_mdelem_table[63]) +#define GRPC_MDELEM_SET_COOKIE_EMPTY (&grpc_static_mdelem_table[64]) /* ":status": "200" */ -#define GRPC_MDELEM_STATUS_200 (&grpc_static_mdelem_table[64]) +#define GRPC_MDELEM_STATUS_200 (&grpc_static_mdelem_table[65]) /* ":status": "204" */ -#define GRPC_MDELEM_STATUS_204 (&grpc_static_mdelem_table[65]) +#define GRPC_MDELEM_STATUS_204 (&grpc_static_mdelem_table[66]) /* ":status": "206" */ -#define GRPC_MDELEM_STATUS_206 (&grpc_static_mdelem_table[66]) +#define GRPC_MDELEM_STATUS_206 (&grpc_static_mdelem_table[67]) /* ":status": "304" */ -#define GRPC_MDELEM_STATUS_304 (&grpc_static_mdelem_table[67]) +#define GRPC_MDELEM_STATUS_304 (&grpc_static_mdelem_table[68]) /* ":status": "400" */ -#define GRPC_MDELEM_STATUS_400 (&grpc_static_mdelem_table[68]) +#define GRPC_MDELEM_STATUS_400 (&grpc_static_mdelem_table[69]) /* ":status": "404" */ -#define GRPC_MDELEM_STATUS_404 (&grpc_static_mdelem_table[69]) +#define GRPC_MDELEM_STATUS_404 (&grpc_static_mdelem_table[70]) /* ":status": "500" */ -#define GRPC_MDELEM_STATUS_500 (&grpc_static_mdelem_table[70]) +#define GRPC_MDELEM_STATUS_500 (&grpc_static_mdelem_table[71]) /* "strict-transport-security": "" */ #define GRPC_MDELEM_STRICT_TRANSPORT_SECURITY_EMPTY \ - (&grpc_static_mdelem_table[71]) + (&grpc_static_mdelem_table[72]) /* "te": "trailers" */ -#define GRPC_MDELEM_TE_TRAILERS (&grpc_static_mdelem_table[72]) +#define GRPC_MDELEM_TE_TRAILERS (&grpc_static_mdelem_table[73]) /* "transfer-encoding": "" */ -#define GRPC_MDELEM_TRANSFER_ENCODING_EMPTY (&grpc_static_mdelem_table[73]) +#define GRPC_MDELEM_TRANSFER_ENCODING_EMPTY (&grpc_static_mdelem_table[74]) /* "user-agent": "" */ -#define GRPC_MDELEM_USER_AGENT_EMPTY (&grpc_static_mdelem_table[74]) +#define GRPC_MDELEM_USER_AGENT_EMPTY (&grpc_static_mdelem_table[75]) /* "vary": "" */ -#define GRPC_MDELEM_VARY_EMPTY (&grpc_static_mdelem_table[75]) +#define GRPC_MDELEM_VARY_EMPTY (&grpc_static_mdelem_table[76]) /* "via": "" */ -#define GRPC_MDELEM_VIA_EMPTY (&grpc_static_mdelem_table[76]) +#define GRPC_MDELEM_VIA_EMPTY (&grpc_static_mdelem_table[77]) /* "www-authenticate": "" */ -#define GRPC_MDELEM_WWW_AUTHENTICATE_EMPTY (&grpc_static_mdelem_table[77]) +#define GRPC_MDELEM_WWW_AUTHENTICATE_EMPTY (&grpc_static_mdelem_table[78]) extern const uint8_t grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT * 2]; diff --git a/src/core/transport/transport.h b/src/core/transport/transport.h index ed6e121c9cb..53f735ef237 100644 --- a/src/core/transport/transport.h +++ b/src/core/transport/transport.h @@ -36,11 +36,11 @@ #include +#include "src/core/channel/context.h" #include "src/core/iomgr/pollset.h" #include "src/core/iomgr/pollset_set.h" -#include "src/core/transport/metadata_batch.h" #include "src/core/transport/byte_stream.h" -#include "src/core/channel/context.h" +#include "src/core/transport/metadata_batch.h" /* forward declarations */ typedef struct grpc_transport grpc_transport; @@ -81,8 +81,12 @@ void grpc_stream_unref(grpc_exec_ctx *exec_ctx, grpc_stream_refcount *refcount); /* Transport stream op: a set of operations to perform on a transport against a single stream */ typedef struct grpc_transport_stream_op { - /** Send initial metadata to the peer, from the provided metadata batch. */ + /** Send initial metadata to the peer, from the provided metadata batch. + idempotent_request MUST be set if this is non-null */ grpc_metadata_batch *send_initial_metadata; + /** Iff send_initial_metadata != NULL, flags if this is an idempotent request + or not */ + bool idempotent_request; /** Send trailing metadata to the peer, from the provided metadata batch. */ grpc_metadata_batch *send_trailing_metadata; diff --git a/tools/codegen/core/gen_static_metadata.py b/tools/codegen/core/gen_static_metadata.py index e6ae00e6112..a681804b300 100755 --- a/tools/codegen/core/gen_static_metadata.py +++ b/tools/codegen/core/gen_static_metadata.py @@ -69,6 +69,7 @@ CONFIG = [ (':scheme', 'grpc'), (':authority', ''), (':method', 'GET'), + (':method', 'PUT'), (':path', '/'), (':path', '/index.html'), (':status', '204'), @@ -264,13 +265,13 @@ print >>C print >>H, '#define GRPC_STATIC_MDELEM_COUNT %d' % len(all_elems) print >>H, 'extern grpc_mdelem grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT];' -print >>H, 'extern gpr_uintptr grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT];' +print >>H, 'extern uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT];' for i, elem in enumerate(all_elems): print >>H, '/* "%s": "%s" */' % elem print >>H, '#define %s (&grpc_static_mdelem_table[%d])' % (mangle(elem).upper(), i) print >>H print >>C, 'grpc_mdelem grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT];' -print >>C, 'gpr_uintptr grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = {' +print >>C, 'uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = {' print >>C, ' %s' % ','.join('%d' % static_userdata.get(elem, 0) for elem in all_elems) print >>C, '};' print >>C @@ -285,8 +286,8 @@ def md_idx(m): if m == m2: return i -print >>H, 'extern const gpr_uint8 grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT*2];' -print >>C, 'const gpr_uint8 grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT*2] = {' +print >>H, 'extern const uint8_t grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT*2];' +print >>C, 'const uint8_t grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT*2] = {' print >>C, ','.join('%d' % str_idx(x) for x in itertools.chain.from_iterable([a,b] for a, b in all_elems)) print >>C, '};' print >>C @@ -297,8 +298,8 @@ print >>C, '%s' % ',\n'.join(' "%s"' % s for s in all_strs) print >>C, '};' print >>C -print >>H, 'extern const gpr_uint8 grpc_static_accept_encoding_metadata[%d];' % (1 << len(COMPRESSION_ALGORITHMS)) -print >>C, 'const gpr_uint8 grpc_static_accept_encoding_metadata[%d] = {' % (1 << len(COMPRESSION_ALGORITHMS)) +print >>H, 'extern const uint8_t grpc_static_accept_encoding_metadata[%d];' % (1 << len(COMPRESSION_ALGORITHMS)) +print >>C, 'const uint8_t grpc_static_accept_encoding_metadata[%d] = {' % (1 << len(COMPRESSION_ALGORITHMS)) print >>C, '0,%s' % ','.join('%d' % md_idx(elem) for elem in compression_elems) print >>C, '};' print >>C @@ -309,4 +310,3 @@ print >>H, '#endif /* GRPC_INTERNAL_CORE_TRANSPORT_STATIC_METADATA_H */' H.close() C.close() - From 4d40ba326274a47e0e6badbb7d5e2d8646c6a324 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 9 Mar 2016 17:48:40 -0800 Subject: [PATCH 05/36] Wire up server side --- src/core/channel/http_client_filter.c | 2 +- src/core/channel/http_server_filter.c | 31 +++++++++++++++++++-------- src/core/surface/call.c | 2 +- src/core/surface/server.c | 3 +++ src/core/transport/transport.h | 3 ++- 5 files changed, 29 insertions(+), 12 deletions(-) diff --git a/src/core/channel/http_client_filter.c b/src/core/channel/http_client_filter.c index f08eb7e519a..0f44f4e844b 100644 --- a/src/core/channel/http_client_filter.c +++ b/src/core/channel/http_client_filter.c @@ -112,7 +112,7 @@ static void hc_mutate_op(grpc_call_element *elem, /* Send : prefixed headers, which have to be before any application layer headers. */ grpc_metadata_batch_add_head(op->send_initial_metadata, &calld->method, - op->idempotent_request + op->send_idempotent_request ? GRPC_MDELEM_METHOD_PUT : GRPC_MDELEM_METHOD_POST); grpc_metadata_batch_add_head(op->send_initial_metadata, &calld->scheme, diff --git a/src/core/channel/http_server_filter.c b/src/core/channel/http_server_filter.c index 370f8dbe423..96a34e3a603 100644 --- a/src/core/channel/http_server_filter.c +++ b/src/core/channel/http_server_filter.c @@ -41,7 +41,7 @@ typedef struct call_data { uint8_t seen_path; - uint8_t seen_post; + uint8_t seen_method; uint8_t sent_status; uint8_t seen_scheme; uint8_t seen_te_trailers; @@ -50,6 +50,7 @@ typedef struct call_data { grpc_linked_mdelem content_type; grpc_metadata_batch *recv_initial_metadata; + bool *recv_idempotent_request; /** Closure to call when finished with the hs_on_recv hook */ grpc_closure *on_done_recv; /** Receive closures are chained: we inject this closure as the on_done_recv @@ -72,11 +73,16 @@ static grpc_mdelem *server_filter(void *user_data, grpc_mdelem *md) { /* Check if it is one of the headers we care about. */ if (md == GRPC_MDELEM_TE_TRAILERS || md == GRPC_MDELEM_METHOD_POST || - md == GRPC_MDELEM_SCHEME_HTTP || md == GRPC_MDELEM_SCHEME_HTTPS || + md == GRPC_MDELEM_METHOD_PUT || md == GRPC_MDELEM_SCHEME_HTTP || + md == GRPC_MDELEM_SCHEME_HTTPS || md == GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC) { /* swallow it */ if (md == GRPC_MDELEM_METHOD_POST) { - calld->seen_post = 1; + calld->seen_method = 1; + *calld->recv_idempotent_request = false; + } else if (md == GRPC_MDELEM_METHOD_PUT) { + calld->seen_method = 1; + *calld->recv_idempotent_request = true; } else if (md->key == GRPC_MDSTR_SCHEME) { calld->seen_scheme = 1; } else if (md == GRPC_MDELEM_TE_TRAILERS) { @@ -142,7 +148,7 @@ static void hs_on_recv(grpc_exec_ctx *exec_ctx, void *user_data, bool success) { /* Have we seen the required http2 transport headers? (:method, :scheme, content-type, with :path and :authority covered at the channel level right now) */ - if (calld->seen_post && calld->seen_scheme && calld->seen_te_trailers && + if (calld->seen_method && calld->seen_scheme && calld->seen_te_trailers && calld->seen_path && calld->seen_authority) { /* do nothing */ } else { @@ -152,7 +158,7 @@ static void hs_on_recv(grpc_exec_ctx *exec_ctx, void *user_data, bool success) { if (!calld->seen_authority) { gpr_log(GPR_ERROR, "Missing :authority header"); } - if (!calld->seen_post) { + if (!calld->seen_method) { gpr_log(GPR_ERROR, "Missing :method header"); } if (!calld->seen_scheme) { @@ -227,7 +233,14 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem) {} const grpc_channel_filter grpc_http_server_filter = { - hs_start_transport_op, grpc_channel_next_op, sizeof(call_data), - init_call_elem, grpc_call_stack_ignore_set_pollset, destroy_call_elem, - sizeof(channel_data), init_channel_elem, destroy_channel_elem, - grpc_call_next_get_peer, "http-server"}; + hs_start_transport_op, + grpc_channel_next_op, + sizeof(call_data), + init_call_elem, + grpc_call_stack_ignore_set_pollset, + destroy_call_elem, + sizeof(channel_data), + init_channel_elem, + destroy_channel_elem, + grpc_call_next_get_peer, + "http-server"}; diff --git a/src/core/surface/call.c b/src/core/surface/call.c index cf5c928d84b..a369795ac83 100644 --- a/src/core/surface/call.c +++ b/src/core/surface/call.c @@ -1229,7 +1229,7 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx, call->metadata_batch[0][0].deadline = call->send_deadline; stream_op.send_initial_metadata = &call->metadata_batch[0 /* is_receiving */][0 /* is_trailing */]; - stream_op.idempotent_request = + stream_op.send_idempotent_request = (op->flags & GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST) != 0; break; case GRPC_OP_SEND_MESSAGE: diff --git a/src/core/surface/server.c b/src/core/surface/server.c index 72b3065894d..e0b97725695 100644 --- a/src/core/surface/server.c +++ b/src/core/surface/server.c @@ -153,6 +153,7 @@ struct call_data { grpc_completion_queue *cq_new; grpc_metadata_batch *recv_initial_metadata; + bool recv_idempotent_request; grpc_metadata_array initial_metadata; grpc_closure got_initial_metadata; @@ -602,9 +603,11 @@ static void server_mutate_op(grpc_call_element *elem, call_data *calld = elem->call_data; if (op->recv_initial_metadata != NULL) { + GPR_ASSERT(op->recv_idempotent_request == NULL); calld->recv_initial_metadata = op->recv_initial_metadata; calld->on_done_recv_initial_metadata = op->recv_initial_metadata_ready; op->recv_initial_metadata_ready = &calld->server_on_recv_initial_metadata; + op->recv_idempotent_request = &calld->recv_idempotent_request; } } diff --git a/src/core/transport/transport.h b/src/core/transport/transport.h index 53f735ef237..0374c98087b 100644 --- a/src/core/transport/transport.h +++ b/src/core/transport/transport.h @@ -86,7 +86,7 @@ typedef struct grpc_transport_stream_op { grpc_metadata_batch *send_initial_metadata; /** Iff send_initial_metadata != NULL, flags if this is an idempotent request or not */ - bool idempotent_request; + bool send_idempotent_request; /** Send trailing metadata to the peer, from the provided metadata batch. */ grpc_metadata_batch *send_trailing_metadata; @@ -96,6 +96,7 @@ typedef struct grpc_transport_stream_op { /** Receive initial metadata from the stream, into provided metadata batch. */ grpc_metadata_batch *recv_initial_metadata; + bool *recv_idempotent_request; /** Should be enqueued when initial metadata is ready to be processed. */ grpc_closure *recv_initial_metadata_ready; From b290686d3fe91432898afeea7823ca7a513694ac Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 10 Mar 2016 06:50:07 -0800 Subject: [PATCH 06/36] Wire up server side idempotency --- src/core/surface/server.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/core/surface/server.c b/src/core/surface/server.c index e0b97725695..4b46f2b3c26 100644 --- a/src/core/surface/server.c +++ b/src/core/surface/server.c @@ -101,6 +101,7 @@ typedef struct requested_call { typedef struct channel_registered_method { registered_method *server_registered_method; + uint32_t flags; grpc_mdstr *method; grpc_mdstr *host; } channel_registered_method; @@ -173,6 +174,7 @@ struct request_matcher { struct registered_method { char *method; char *host; + uint32_t flags; request_matcher request_matcher; registered_method *next; }; @@ -473,6 +475,9 @@ static void start_new_rpc(grpc_exec_ctx *exec_ctx, grpc_call_element *elem) { if (!rm) break; if (rm->host != calld->host) continue; if (rm->method != calld->path) continue; + if ((rm->flags & GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST) && + !calld->recv_idempotent_request) + continue; finish_start_new_rpc(exec_ctx, server, elem, &rm->server_registered_method->request_matcher); return; @@ -485,6 +490,9 @@ static void start_new_rpc(grpc_exec_ctx *exec_ctx, grpc_call_element *elem) { if (!rm) break; if (rm->host != NULL) continue; if (rm->method != calld->path) continue; + if ((rm->flags & GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST) && + !calld->recv_idempotent_request) + continue; finish_start_new_rpc(exec_ctx, server, elem, &rm->server_registered_method->request_matcher); return; @@ -857,8 +865,10 @@ static int streq(const char *a, const char *b) { void *grpc_server_register_method(grpc_server *server, const char *method, const char *host, uint32_t flags) { registered_method *m; - GRPC_API_TRACE("grpc_server_register_method(server=%p, method=%s, host=%s)", - 3, (server, method, host)); + GRPC_API_TRACE( + "grpc_server_register_method(server=%p, method=%s, host=%s, " + "flags=0x%08x)", + 4, (server, method, host, flags)); if (!method) { gpr_log(GPR_ERROR, "grpc_server_register_method method string cannot be NULL"); @@ -871,12 +881,18 @@ void *grpc_server_register_method(grpc_server *server, const char *method, return NULL; } } + if ((flags & ~GRPC_INITIAL_METADATA_USED_MASK) != 0) { + gpr_log(GPR_ERROR, "grpc_server_register_method invalid flags 0x%08x", + flags); + return NULL; + } m = gpr_malloc(sizeof(registered_method)); memset(m, 0, sizeof(*m)); request_matcher_init(&m->request_matcher, server->max_requested_calls); m->method = gpr_strdup(method); m->host = gpr_strdup(host); m->next = server->registered_methods; + m->flags = flags; server->registered_methods = m; return m; } @@ -968,6 +984,7 @@ void grpc_server_setup_transport(grpc_exec_ctx *exec_ctx, grpc_server *s, if (probes > max_probes) max_probes = probes; crm = &chand->registered_methods[(hash + probes) % slots]; crm->server_registered_method = rm; + crm->flags = rm->flags; crm->host = host; crm->method = method; } @@ -1290,6 +1307,10 @@ static void begin_call(grpc_exec_ctx *exec_ctx, grpc_server *server, cpstr(&rc->data.batch.details->method, &rc->data.batch.details->method_capacity, calld->path); rc->data.batch.details->deadline = calld->deadline; + rc->data.batch.details->flags = + 0 | (calld->recv_idempotent_request + ? GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST + : 0); break; case REGISTERED_CALL: *rc->data.registered.deadline = calld->deadline; From 7885ea5e313b6bb59647881bf15c505aed66c98f Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 10 Mar 2016 06:53:29 -0800 Subject: [PATCH 07/36] Add a place for tests --- Makefile | 4 + .../grpcio/grpc/_cython/imports.generated.h | 2 +- src/ruby/ext/grpc/rb_grpc_imports.generated.h | 2 +- test/core/end2end/end2end_nosec_tests.c | 12 + test/core/end2end/end2end_tests.c | 12 + test/core/end2end/gen_build_yaml.py | 2 + test/core/end2end/tests/idempotent_request.c | 247 ++++ .../end2end/tests/registered_idempotent.c | 233 +++ tools/run_tests/sources_and_headers.json | 4 + tools/run_tests/tests.json | 1256 ++++++++++++++++- .../end2end_nosec_tests.vcxproj | 4 + .../end2end_nosec_tests.vcxproj.filters | 6 + .../tests/end2end_tests/end2end_tests.vcxproj | 4 + .../end2end_tests.vcxproj.filters | 6 + 14 files changed, 1779 insertions(+), 15 deletions(-) create mode 100644 test/core/end2end/tests/idempotent_request.c create mode 100644 test/core/end2end/tests/registered_idempotent.c diff --git a/Makefile b/Makefile index 5be0d146afc..d2ec1d815d3 100644 --- a/Makefile +++ b/Makefile @@ -5533,6 +5533,7 @@ LIBEND2END_TESTS_SRC = \ test/core/end2end/tests/graceful_server_shutdown.c \ test/core/end2end/tests/high_initial_seqno.c \ test/core/end2end/tests/hpack_size.c \ + test/core/end2end/tests/idempotent_request.c \ test/core/end2end/tests/invoke_large_request.c \ test/core/end2end/tests/large_metadata.c \ test/core/end2end/tests/max_concurrent_streams.c \ @@ -5543,6 +5544,7 @@ LIBEND2END_TESTS_SRC = \ test/core/end2end/tests/ping.c \ test/core/end2end/tests/ping_pong_streaming.c \ test/core/end2end/tests/registered_call.c \ + test/core/end2end/tests/registered_idempotent.c \ test/core/end2end/tests/request_with_flags.c \ test/core/end2end/tests/request_with_payload.c \ test/core/end2end/tests/server_finishes_request.c \ @@ -5606,6 +5608,7 @@ LIBEND2END_NOSEC_TESTS_SRC = \ test/core/end2end/tests/graceful_server_shutdown.c \ test/core/end2end/tests/high_initial_seqno.c \ test/core/end2end/tests/hpack_size.c \ + test/core/end2end/tests/idempotent_request.c \ test/core/end2end/tests/invoke_large_request.c \ test/core/end2end/tests/large_metadata.c \ test/core/end2end/tests/max_concurrent_streams.c \ @@ -5616,6 +5619,7 @@ LIBEND2END_NOSEC_TESTS_SRC = \ test/core/end2end/tests/ping.c \ test/core/end2end/tests/ping_pong_streaming.c \ test/core/end2end/tests/registered_call.c \ + test/core/end2end/tests/registered_idempotent.c \ test/core/end2end/tests/request_with_flags.c \ test/core/end2end/tests/request_with_payload.c \ test/core/end2end/tests/server_finishes_request.c \ diff --git a/src/python/grpcio/grpc/_cython/imports.generated.h b/src/python/grpcio/grpc/_cython/imports.generated.h index b70dcccd17a..9565933bef4 100644 --- a/src/python/grpcio/grpc/_cython/imports.generated.h +++ b/src/python/grpcio/grpc/_cython/imports.generated.h @@ -283,7 +283,7 @@ extern grpc_call_destroy_type grpc_call_destroy_import; typedef grpc_call_error(*grpc_server_request_call_type)(grpc_server *server, grpc_call **call, grpc_call_details *details, grpc_metadata_array *request_metadata, grpc_completion_queue *cq_bound_to_call, grpc_completion_queue *cq_for_notification, void *tag_new); extern grpc_server_request_call_type grpc_server_request_call_import; #define grpc_server_request_call grpc_server_request_call_import -typedef void *(*grpc_server_register_method_type)(grpc_server *server, const char *method, const char *host); +typedef void *(*grpc_server_register_method_type)(grpc_server *server, const char *method, const char *host, uint32_t flags); extern grpc_server_register_method_type grpc_server_register_method_import; #define grpc_server_register_method grpc_server_register_method_import typedef grpc_call_error(*grpc_server_request_registered_call_type)(grpc_server *server, void *registered_method, grpc_call **call, gpr_timespec *deadline, grpc_metadata_array *request_metadata, grpc_byte_buffer **optional_payload, grpc_completion_queue *cq_bound_to_call, grpc_completion_queue *cq_for_notification, void *tag_new); diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.h b/src/ruby/ext/grpc/rb_grpc_imports.generated.h index b972f60fc35..6cfa5994a44 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.h +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.h @@ -283,7 +283,7 @@ extern grpc_call_destroy_type grpc_call_destroy_import; typedef grpc_call_error(*grpc_server_request_call_type)(grpc_server *server, grpc_call **call, grpc_call_details *details, grpc_metadata_array *request_metadata, grpc_completion_queue *cq_bound_to_call, grpc_completion_queue *cq_for_notification, void *tag_new); extern grpc_server_request_call_type grpc_server_request_call_import; #define grpc_server_request_call grpc_server_request_call_import -typedef void *(*grpc_server_register_method_type)(grpc_server *server, const char *method, const char *host); +typedef void *(*grpc_server_register_method_type)(grpc_server *server, const char *method, const char *host, uint32_t flags); extern grpc_server_register_method_type grpc_server_register_method_import; #define grpc_server_register_method grpc_server_register_method_import typedef grpc_call_error(*grpc_server_request_registered_call_type)(grpc_server *server, void *registered_method, grpc_call **call, gpr_timespec *deadline, grpc_metadata_array *request_metadata, grpc_byte_buffer **optional_payload, grpc_completion_queue *cq_bound_to_call, grpc_completion_queue *cq_for_notification, void *tag_new); diff --git a/test/core/end2end/end2end_nosec_tests.c b/test/core/end2end/end2end_nosec_tests.c index 17dc190d14f..7b6d0d3f9b8 100644 --- a/test/core/end2end/end2end_nosec_tests.c +++ b/test/core/end2end/end2end_nosec_tests.c @@ -54,6 +54,7 @@ extern void empty_batch(grpc_end2end_test_config config); extern void graceful_server_shutdown(grpc_end2end_test_config config); extern void high_initial_seqno(grpc_end2end_test_config config); extern void hpack_size(grpc_end2end_test_config config); +extern void idempotent_request(grpc_end2end_test_config config); extern void invoke_large_request(grpc_end2end_test_config config); extern void large_metadata(grpc_end2end_test_config config); extern void max_concurrent_streams(grpc_end2end_test_config config); @@ -64,6 +65,7 @@ extern void payload(grpc_end2end_test_config config); extern void ping(grpc_end2end_test_config config); extern void ping_pong_streaming(grpc_end2end_test_config config); extern void registered_call(grpc_end2end_test_config config); +extern void registered_idempotent(grpc_end2end_test_config config); extern void request_with_flags(grpc_end2end_test_config config); extern void request_with_payload(grpc_end2end_test_config config); extern void server_finishes_request(grpc_end2end_test_config config); @@ -95,6 +97,7 @@ void grpc_end2end_tests(int argc, char **argv, graceful_server_shutdown(config); high_initial_seqno(config); hpack_size(config); + idempotent_request(config); invoke_large_request(config); large_metadata(config); max_concurrent_streams(config); @@ -105,6 +108,7 @@ void grpc_end2end_tests(int argc, char **argv, ping(config); ping_pong_streaming(config); registered_call(config); + registered_idempotent(config); request_with_flags(config); request_with_payload(config); server_finishes_request(config); @@ -182,6 +186,10 @@ void grpc_end2end_tests(int argc, char **argv, hpack_size(config); continue; } + if (0 == strcmp("idempotent_request", argv[i])) { + idempotent_request(config); + continue; + } if (0 == strcmp("invoke_large_request", argv[i])) { invoke_large_request(config); continue; @@ -222,6 +230,10 @@ void grpc_end2end_tests(int argc, char **argv, registered_call(config); continue; } + if (0 == strcmp("registered_idempotent", argv[i])) { + registered_idempotent(config); + continue; + } if (0 == strcmp("request_with_flags", argv[i])) { request_with_flags(config); continue; diff --git a/test/core/end2end/end2end_tests.c b/test/core/end2end/end2end_tests.c index 6f2f5aff78c..2d139c7e5d5 100644 --- a/test/core/end2end/end2end_tests.c +++ b/test/core/end2end/end2end_tests.c @@ -55,6 +55,7 @@ extern void empty_batch(grpc_end2end_test_config config); extern void graceful_server_shutdown(grpc_end2end_test_config config); extern void high_initial_seqno(grpc_end2end_test_config config); extern void hpack_size(grpc_end2end_test_config config); +extern void idempotent_request(grpc_end2end_test_config config); extern void invoke_large_request(grpc_end2end_test_config config); extern void large_metadata(grpc_end2end_test_config config); extern void max_concurrent_streams(grpc_end2end_test_config config); @@ -65,6 +66,7 @@ extern void payload(grpc_end2end_test_config config); extern void ping(grpc_end2end_test_config config); extern void ping_pong_streaming(grpc_end2end_test_config config); extern void registered_call(grpc_end2end_test_config config); +extern void registered_idempotent(grpc_end2end_test_config config); extern void request_with_flags(grpc_end2end_test_config config); extern void request_with_payload(grpc_end2end_test_config config); extern void server_finishes_request(grpc_end2end_test_config config); @@ -97,6 +99,7 @@ void grpc_end2end_tests(int argc, char **argv, graceful_server_shutdown(config); high_initial_seqno(config); hpack_size(config); + idempotent_request(config); invoke_large_request(config); large_metadata(config); max_concurrent_streams(config); @@ -107,6 +110,7 @@ void grpc_end2end_tests(int argc, char **argv, ping(config); ping_pong_streaming(config); registered_call(config); + registered_idempotent(config); request_with_flags(config); request_with_payload(config); server_finishes_request(config); @@ -188,6 +192,10 @@ void grpc_end2end_tests(int argc, char **argv, hpack_size(config); continue; } + if (0 == strcmp("idempotent_request", argv[i])) { + idempotent_request(config); + continue; + } if (0 == strcmp("invoke_large_request", argv[i])) { invoke_large_request(config); continue; @@ -228,6 +236,10 @@ void grpc_end2end_tests(int argc, char **argv, registered_call(config); continue; } + if (0 == strcmp("registered_idempotent", argv[i])) { + registered_idempotent(config); + continue; + } if (0 == strcmp("request_with_flags", argv[i])) { request_with_flags(config); continue; diff --git a/test/core/end2end/gen_build_yaml.py b/test/core/end2end/gen_build_yaml.py index 4dfafcea243..d185a189d8b 100755 --- a/test/core/end2end/gen_build_yaml.py +++ b/test/core/end2end/gen_build_yaml.py @@ -104,6 +104,7 @@ END2END_TESTS = { 'hpack_size': default_test_options._replace(proxyable=False, traceable=False), 'high_initial_seqno': default_test_options, + 'idempotent_request': default_test_options, 'invoke_large_request': default_test_options, 'large_metadata': default_test_options, 'max_concurrent_streams': default_test_options._replace(proxyable=False), @@ -114,6 +115,7 @@ END2END_TESTS = { 'ping_pong_streaming': default_test_options, 'ping': connectivity_test_options._replace(proxyable=False), 'registered_call': default_test_options, + 'registered_idempotent': default_test_options, 'request_with_flags': default_test_options._replace(proxyable=False), 'request_with_payload': default_test_options, 'server_finishes_request': default_test_options, diff --git a/test/core/end2end/tests/idempotent_request.c b/test/core/end2end/tests/idempotent_request.c new file mode 100644 index 00000000000..fd9788d0bac --- /dev/null +++ b/test/core/end2end/tests/idempotent_request.c @@ -0,0 +1,247 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "test/core/end2end/end2end_tests.h" + +#include +#include + +#include +#include +#include +#include +#include +#include +#include "src/core/support/string.h" +#include "test/core/end2end/cq_verifier.h" + +enum { TIMEOUT = 200000 }; + +static void *tag(intptr_t t) { return (void *)t; } + +static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, + const char *test_name, + grpc_channel_args *client_args, + grpc_channel_args *server_args) { + grpc_end2end_test_fixture f; + gpr_log(GPR_INFO, "%s/%s", test_name, config.name); + f = config.create_fixture(client_args, server_args); + config.init_server(&f, server_args); + config.init_client(&f, client_args); + return f; +} + +static gpr_timespec n_seconds_time(int n) { + return GRPC_TIMEOUT_SECONDS_TO_DEADLINE(n); +} + +static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } + +static void drain_cq(grpc_completion_queue *cq) { + grpc_event ev; + do { + ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); +} + +static void shutdown_server(grpc_end2end_test_fixture *f) { + if (!f->server) return; + grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck( + f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) + .type == GRPC_OP_COMPLETE); + grpc_server_destroy(f->server); + f->server = NULL; +} + +static void shutdown_client(grpc_end2end_test_fixture *f) { + if (!f->client) return; + grpc_channel_destroy(f->client); + f->client = NULL; +} + +static void end_test(grpc_end2end_test_fixture *f) { + shutdown_server(f); + shutdown_client(f); + + grpc_completion_queue_shutdown(f->cq); + drain_cq(f->cq); + grpc_completion_queue_destroy(f->cq); +} + +static void simple_request_body(grpc_end2end_test_fixture f) { + grpc_call *c; + grpc_call *s; + gpr_timespec deadline = five_seconds_time(); + cq_verifier *cqv = cq_verifier_create(f.cq); + grpc_op ops[6]; + grpc_op *op; + grpc_metadata_array initial_metadata_recv; + grpc_metadata_array trailing_metadata_recv; + grpc_metadata_array request_metadata_recv; + grpc_call_details call_details; + grpc_status_code status; + grpc_call_error error; + char *details = NULL; + size_t details_capacity = 0; + int was_cancelled = 2; + char *peer; + + c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + "/foo", "foo.test.google.fr:1234", deadline, + NULL); + GPR_ASSERT(c); + + peer = grpc_call_get_peer(c); + GPR_ASSERT(peer != NULL); + gpr_log(GPR_DEBUG, "client_peer_before_call=%s", peer); + gpr_free(peer); + + grpc_metadata_array_init(&initial_metadata_recv); + grpc_metadata_array_init(&trailing_metadata_recv); + grpc_metadata_array_init(&request_metadata_recv); + grpc_call_details_init(&call_details); + + op = ops; + op->op = GRPC_OP_SEND_INITIAL_METADATA; + op->data.send_initial_metadata.count = 0; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_INITIAL_METADATA; + op->data.recv_initial_metadata = &initial_metadata_recv; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; + op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; + op->data.recv_status_on_client.status = &status; + op->data.recv_status_on_client.status_details = &details; + op->data.recv_status_on_client.status_details_capacity = &details_capacity; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + error = + grpc_server_request_call(f.server, &s, &call_details, + &request_metadata_recv, f.cq, f.cq, tag(101)); + GPR_ASSERT(GRPC_CALL_OK == error); + cq_expect_completion(cqv, tag(101), 1); + cq_verify(cqv); + + peer = grpc_call_get_peer(s); + GPR_ASSERT(peer != NULL); + gpr_log(GPR_DEBUG, "server_peer=%s", peer); + gpr_free(peer); + peer = grpc_call_get_peer(c); + GPR_ASSERT(peer != NULL); + gpr_log(GPR_DEBUG, "client_peer=%s", peer); + gpr_free(peer); + + op = ops; + op->op = GRPC_OP_SEND_INITIAL_METADATA; + op->data.send_initial_metadata.count = 0; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; + op->data.send_status_from_server.trailing_metadata_count = 0; + op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED; + op->data.send_status_from_server.status_details = "xyz"; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; + op->data.recv_close_on_server.cancelled = &was_cancelled; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + cq_expect_completion(cqv, tag(102), 1); + cq_expect_completion(cqv, tag(1), 1); + cq_verify(cqv); + + GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); + GPR_ASSERT(0 == strcmp(details, "xyz")); + GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); + GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr:1234")); + GPR_ASSERT(was_cancelled == 1); + + gpr_free(details); + grpc_metadata_array_destroy(&initial_metadata_recv); + grpc_metadata_array_destroy(&trailing_metadata_recv); + grpc_metadata_array_destroy(&request_metadata_recv); + grpc_call_details_destroy(&call_details); + + grpc_call_destroy(c); + grpc_call_destroy(s); + + cq_verifier_destroy(cqv); +} + +static void test_invoke_simple_request(grpc_end2end_test_config config) { + grpc_end2end_test_fixture f; + + f = begin_test(config, "test_invoke_simple_request", NULL, NULL); + simple_request_body(f); + end_test(&f); + config.tear_down_data(&f); +} + +static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { + int i; + grpc_end2end_test_fixture f = + begin_test(config, "test_invoke_10_simple_requests", NULL, NULL); + for (i = 0; i < 10; i++) { + simple_request_body(f); + gpr_log(GPR_INFO, "Passed simple request %d", i); + } + end_test(&f); + config.tear_down_data(&f); +} + +void simple_request(grpc_end2end_test_config config) { + int i; + for (i = 0; i < 10; i++) { + test_invoke_simple_request(config); + } + test_invoke_10_simple_requests(config); +} diff --git a/test/core/end2end/tests/registered_idempotent.c b/test/core/end2end/tests/registered_idempotent.c new file mode 100644 index 00000000000..d9d2b19d12d --- /dev/null +++ b/test/core/end2end/tests/registered_idempotent.c @@ -0,0 +1,233 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "test/core/end2end/end2end_tests.h" + +#include +#include + +#include "src/core/support/string.h" +#include +#include +#include +#include +#include +#include +#include "test/core/end2end/cq_verifier.h" + +enum { TIMEOUT = 200000 }; + +static void *tag(intptr_t t) { return (void *)t; } + +static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, + const char *test_name, + grpc_channel_args *client_args, + grpc_channel_args *server_args) { + grpc_end2end_test_fixture f; + gpr_log(GPR_INFO, "%s/%s", test_name, config.name); + f = config.create_fixture(client_args, server_args); + config.init_server(&f, server_args); + config.init_client(&f, client_args); + return f; +} + +static gpr_timespec n_seconds_time(int n) { + return GRPC_TIMEOUT_SECONDS_TO_DEADLINE(n); +} + +static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } + +static void drain_cq(grpc_completion_queue *cq) { + grpc_event ev; + do { + ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL); + } while (ev.type != GRPC_QUEUE_SHUTDOWN); +} + +static void shutdown_server(grpc_end2end_test_fixture *f) { + if (!f->server) return; + grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), + NULL).type == GRPC_OP_COMPLETE); + grpc_server_destroy(f->server); + f->server = NULL; +} + +static void shutdown_client(grpc_end2end_test_fixture *f) { + if (!f->client) return; + grpc_channel_destroy(f->client); + f->client = NULL; +} + +static void end_test(grpc_end2end_test_fixture *f) { + shutdown_server(f); + shutdown_client(f); + + grpc_completion_queue_shutdown(f->cq); + drain_cq(f->cq); + grpc_completion_queue_destroy(f->cq); +} + +static void simple_request_body(grpc_end2end_test_fixture f, void *rc) { + grpc_call *c; + grpc_call *s; + gpr_timespec deadline = five_seconds_time(); + cq_verifier *cqv = cq_verifier_create(f.cq); + grpc_op ops[6]; + grpc_op *op; + grpc_metadata_array initial_metadata_recv; + grpc_metadata_array trailing_metadata_recv; + grpc_metadata_array request_metadata_recv; + grpc_call_details call_details; + grpc_status_code status; + grpc_call_error error; + char *details = NULL; + size_t details_capacity = 0; + int was_cancelled = 2; + + c = grpc_channel_create_registered_call( + f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, rc, deadline, NULL); + GPR_ASSERT(c); + + grpc_metadata_array_init(&initial_metadata_recv); + grpc_metadata_array_init(&trailing_metadata_recv); + grpc_metadata_array_init(&request_metadata_recv); + grpc_call_details_init(&call_details); + + op = ops; + op->op = GRPC_OP_SEND_INITIAL_METADATA; + op->data.send_initial_metadata.count = 0; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_INITIAL_METADATA; + op->data.recv_initial_metadata = &initial_metadata_recv; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; + op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; + op->data.recv_status_on_client.status = &status; + op->data.recv_status_on_client.status_details = &details; + op->data.recv_status_on_client.status_details_capacity = &details_capacity; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + error = + grpc_server_request_call(f.server, &s, &call_details, + &request_metadata_recv, f.cq, f.cq, tag(101)); + GPR_ASSERT(GRPC_CALL_OK == error); + cq_expect_completion(cqv, tag(101), 1); + cq_verify(cqv); + + op = ops; + op->op = GRPC_OP_SEND_INITIAL_METADATA; + op->data.send_initial_metadata.count = 0; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; + op->data.send_status_from_server.trailing_metadata_count = 0; + op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED; + op->data.send_status_from_server.status_details = "xyz"; + op->flags = 0; + op->reserved = NULL; + op++; + op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; + op->data.recv_close_on_server.cancelled = &was_cancelled; + op->flags = 0; + op->reserved = NULL; + op++; + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + GPR_ASSERT(GRPC_CALL_OK == error); + + cq_expect_completion(cqv, tag(102), 1); + cq_expect_completion(cqv, tag(1), 1); + cq_verify(cqv); + + GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); + GPR_ASSERT(0 == strcmp(details, "xyz")); + GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); + GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr:1234")); + GPR_ASSERT(was_cancelled == 1); + + gpr_free(details); + grpc_metadata_array_destroy(&initial_metadata_recv); + grpc_metadata_array_destroy(&trailing_metadata_recv); + grpc_metadata_array_destroy(&request_metadata_recv); + grpc_call_details_destroy(&call_details); + + grpc_call_destroy(c); + grpc_call_destroy(s); + + cq_verifier_destroy(cqv); +} + +static void test_invoke_simple_request(grpc_end2end_test_config config) { + grpc_end2end_test_fixture f = + begin_test(config, "test_invoke_simple_request", NULL, NULL); + void *rc = grpc_channel_register_call(f.client, "/foo", + "foo.test.google.fr:1234", NULL); + + simple_request_body(f, rc); + end_test(&f); + config.tear_down_data(&f); +} + +static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { + int i; + grpc_end2end_test_fixture f = + begin_test(config, "test_invoke_10_simple_requests", NULL, NULL); + void *rc = grpc_channel_register_call(f.client, "/foo", + "foo.test.google.fr:1234", NULL); + + for (i = 0; i < 10; i++) { + simple_request_body(f, rc); + gpr_log(GPR_INFO, "Passed simple request %d", i); + } + end_test(&f); + config.tear_down_data(&f); +} + +void registered_call(grpc_end2end_test_config config) { + test_invoke_simple_request(config); + test_invoke_10_simple_requests(config); +} diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index 0c7a6c7b5f3..a42fdc6722d 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -6300,6 +6300,7 @@ "test/core/end2end/tests/graceful_server_shutdown.c", "test/core/end2end/tests/high_initial_seqno.c", "test/core/end2end/tests/hpack_size.c", + "test/core/end2end/tests/idempotent_request.c", "test/core/end2end/tests/invoke_large_request.c", "test/core/end2end/tests/large_metadata.c", "test/core/end2end/tests/max_concurrent_streams.c", @@ -6310,6 +6311,7 @@ "test/core/end2end/tests/ping.c", "test/core/end2end/tests/ping_pong_streaming.c", "test/core/end2end/tests/registered_call.c", + "test/core/end2end/tests/registered_idempotent.c", "test/core/end2end/tests/request_with_flags.c", "test/core/end2end/tests/request_with_payload.c", "test/core/end2end/tests/server_finishes_request.c", @@ -6356,6 +6358,7 @@ "test/core/end2end/tests/graceful_server_shutdown.c", "test/core/end2end/tests/high_initial_seqno.c", "test/core/end2end/tests/hpack_size.c", + "test/core/end2end/tests/idempotent_request.c", "test/core/end2end/tests/invoke_large_request.c", "test/core/end2end/tests/large_metadata.c", "test/core/end2end/tests/max_concurrent_streams.c", @@ -6366,6 +6369,7 @@ "test/core/end2end/tests/ping.c", "test/core/end2end/tests/ping_pong_streaming.c", "test/core/end2end/tests/registered_call.c", + "test/core/end2end/tests/registered_idempotent.c", "test/core/end2end/tests/request_with_flags.c", "test/core/end2end/tests/request_with_payload.c", "test/core/end2end/tests/server_finishes_request.c", diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json index d91245cd06a..6bbb322655a 100644 --- a/tools/run_tests/tests.json +++ b/tools/run_tests/tests.json @@ -4541,6 +4541,28 @@ "posix" ] }, + { + "args": [ + "idempotent_request" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_census_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "invoke_large_request" @@ -4761,6 +4783,28 @@ "posix" ] }, + { + "args": [ + "registered_idempotent" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_census_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "request_with_flags" @@ -5333,6 +5377,28 @@ "posix" ] }, + { + "args": [ + "idempotent_request" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_compress_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "invoke_large_request" @@ -5553,6 +5619,28 @@ "posix" ] }, + { + "args": [ + "registered_idempotent" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_compress_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "request_with_flags" @@ -6108,6 +6196,27 @@ "posix" ] }, + { + "args": [ + "idempotent_request" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_fakesec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "invoke_large_request" @@ -6318,6 +6427,27 @@ "posix" ] }, + { + "args": [ + "registered_idempotent" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_fakesec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "request_with_flags" @@ -6881,6 +7011,28 @@ "posix" ] }, + { + "args": [ + "idempotent_request" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "invoke_large_request" @@ -7101,6 +7253,28 @@ "posix" ] }, + { + "args": [ + "registered_idempotent" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "request_with_flags" @@ -7571,6 +7745,22 @@ "linux" ] }, + { + "args": [ + "idempotent_request" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, { "args": [ "invoke_large_request" @@ -7731,6 +7921,22 @@ "linux" ] }, + { + "args": [ + "registered_idempotent" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_test", + "platforms": [ + "linux" + ] + }, { "args": [ "request_with_flags" @@ -8147,6 +8353,22 @@ "linux" ] }, + { + "args": [ + "idempotent_request" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+poll_test", + "platforms": [ + "linux" + ] + }, { "args": [ "invoke_large_request" @@ -8307,6 +8529,22 @@ "linux" ] }, + { + "args": [ + "registered_idempotent" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+poll_test", + "platforms": [ + "linux" + ] + }, { "args": [ "request_with_flags" @@ -8723,6 +8961,22 @@ "linux" ] }, + { + "args": [ + "idempotent_request" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+poll+pipe_test", + "platforms": [ + "linux" + ] + }, { "args": [ "invoke_large_request" @@ -8883,6 +9137,22 @@ "linux" ] }, + { + "args": [ + "registered_idempotent" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+poll+pipe_test", + "platforms": [ + "linux" + ] + }, { "args": [ "request_with_flags" @@ -9384,6 +9654,27 @@ "posix" ] }, + { + "args": [ + "idempotent_request" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_oauth2_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "invoke_large_request" @@ -9594,6 +9885,27 @@ "posix" ] }, + { + "args": [ + "registered_idempotent" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_oauth2_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "request_with_flags" @@ -10077,6 +10389,27 @@ "posix" ] }, + { + "args": [ + "idempotent_request" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_proxy_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "invoke_large_request" @@ -10245,6 +10578,27 @@ "posix" ] }, + { + "args": [ + "registered_idempotent" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_proxy_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "request_with_payload" @@ -10707,6 +11061,27 @@ "posix" ] }, + { + "args": [ + "idempotent_request" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_sockpair_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "invoke_large_request" @@ -10896,6 +11271,27 @@ "posix" ] }, + { + "args": [ + "registered_idempotent" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_sockpair_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "request_with_flags" @@ -11350,6 +11746,28 @@ "posix" ] }, + { + "args": [ + "idempotent_request" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_sockpair+trace_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "invoke_large_request" @@ -11548,6 +11966,28 @@ "posix" ] }, + { + "args": [ + "registered_idempotent" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_sockpair+trace_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "request_with_flags" @@ -12018,6 +12458,27 @@ "posix" ] }, + { + "args": [ + "idempotent_request" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_sockpair_1byte_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "invoke_large_request" @@ -12207,6 +12668,27 @@ "posix" ] }, + { + "args": [ + "registered_idempotent" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_sockpair_1byte_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "request_with_flags" @@ -12749,6 +13231,28 @@ "posix" ] }, + { + "args": [ + "idempotent_request" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_ssl_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "invoke_large_request" @@ -12969,6 +13473,28 @@ "posix" ] }, + { + "args": [ + "registered_idempotent" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_ssl_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "request_with_flags" @@ -13441,7 +13967,7 @@ }, { "args": [ - "invoke_large_request" + "idempotent_request" ], "ci_platforms": [ "linux" @@ -13457,7 +13983,7 @@ }, { "args": [ - "large_metadata" + "invoke_large_request" ], "ci_platforms": [ "linux" @@ -13473,7 +13999,7 @@ }, { "args": [ - "max_concurrent_streams" + "large_metadata" ], "ci_platforms": [ "linux" @@ -13489,12 +14015,12 @@ }, { "args": [ - "max_message_length" + "max_concurrent_streams" ], "ci_platforms": [ "linux" ], - "cpu_cost": 0.1, + "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", @@ -13505,12 +14031,28 @@ }, { "args": [ - "negative_deadline" + "max_message_length" ], "ci_platforms": [ "linux" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_ssl+poll_test", + "platforms": [ + "linux" + ] + }, + { + "args": [ + "negative_deadline" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, "exclude_configs": [], "flaky": false, "language": "c", @@ -13599,6 +14141,22 @@ "linux" ] }, + { + "args": [ + "registered_idempotent" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_ssl+poll_test", + "platforms": [ + "linux" + ] + }, { "args": [ "request_with_flags" @@ -14037,6 +14595,27 @@ "posix" ] }, + { + "args": [ + "idempotent_request" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_ssl_proxy_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "invoke_large_request" @@ -14205,6 +14784,27 @@ "posix" ] }, + { + "args": [ + "registered_idempotent" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_ssl_proxy_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "request_with_payload" @@ -14681,6 +15281,28 @@ "posix" ] }, + { + "args": [ + "idempotent_request" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_uchannel_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "invoke_large_request" @@ -14879,6 +15501,28 @@ "posix" ] }, + { + "args": [ + "registered_idempotent" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_uchannel_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "request_with_flags" @@ -15375,6 +16019,26 @@ "posix" ] }, + { + "args": [ + "idempotent_request" + ], + "ci_platforms": [ + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_uds_test", + "platforms": [ + "linux", + "mac", + "posix" + ] + }, { "args": [ "invoke_large_request" @@ -15575,6 +16239,26 @@ "posix" ] }, + { + "args": [ + "registered_idempotent" + ], + "ci_platforms": [ + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_uds_test", + "platforms": [ + "linux", + "mac", + "posix" + ] + }, { "args": [ "request_with_flags" @@ -16011,6 +16695,22 @@ "linux" ] }, + { + "args": [ + "idempotent_request" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_uds+poll_test", + "platforms": [ + "linux" + ] + }, { "args": [ "invoke_large_request" @@ -16171,6 +16871,22 @@ "linux" ] }, + { + "args": [ + "registered_idempotent" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_uds+poll_test", + "platforms": [ + "linux" + ] + }, { "args": [ "request_with_flags" @@ -16667,6 +17383,28 @@ "posix" ] }, + { + "args": [ + "idempotent_request" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_census_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "invoke_large_request" @@ -16887,6 +17625,28 @@ "posix" ] }, + { + "args": [ + "registered_idempotent" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_census_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "request_with_flags" @@ -17437,6 +18197,28 @@ "posix" ] }, + { + "args": [ + "idempotent_request" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_compress_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "invoke_large_request" @@ -17659,7 +18441,7 @@ }, { "args": [ - "request_with_flags" + "registered_idempotent" ], "ci_platforms": [ "windows", @@ -17681,7 +18463,7 @@ }, { "args": [ - "request_with_payload" + "request_with_flags" ], "ci_platforms": [ "windows", @@ -17703,7 +18485,7 @@ }, { "args": [ - "server_finishes_request" + "request_with_payload" ], "ci_platforms": [ "windows", @@ -17725,7 +18507,7 @@ }, { "args": [ - "shutdown_finishes_calls" + "server_finishes_request" ], "ci_platforms": [ "windows", @@ -17747,7 +18529,7 @@ }, { "args": [ - "shutdown_finishes_tags" + "shutdown_finishes_calls" ], "ci_platforms": [ "windows", @@ -17769,7 +18551,29 @@ }, { "args": [ - "simple_delayed_request" + "shutdown_finishes_tags" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_compress_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, + { + "args": [ + "simple_delayed_request" ], "ci_platforms": [ "windows", @@ -18207,6 +19011,28 @@ "posix" ] }, + { + "args": [ + "idempotent_request" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "invoke_large_request" @@ -18427,6 +19253,28 @@ "posix" ] }, + { + "args": [ + "registered_idempotent" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "request_with_flags" @@ -18881,6 +19729,22 @@ "linux" ] }, + { + "args": [ + "idempotent_request" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_nosec_test", + "platforms": [ + "linux" + ] + }, { "args": [ "invoke_large_request" @@ -19041,6 +19905,22 @@ "linux" ] }, + { + "args": [ + "registered_idempotent" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+pipe_nosec_test", + "platforms": [ + "linux" + ] + }, { "args": [ "request_with_flags" @@ -19441,6 +20321,22 @@ "linux" ] }, + { + "args": [ + "idempotent_request" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+poll_nosec_test", + "platforms": [ + "linux" + ] + }, { "args": [ "invoke_large_request" @@ -19601,6 +20497,22 @@ "linux" ] }, + { + "args": [ + "registered_idempotent" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+poll_nosec_test", + "platforms": [ + "linux" + ] + }, { "args": [ "request_with_flags" @@ -20001,6 +20913,22 @@ "linux" ] }, + { + "args": [ + "idempotent_request" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+poll+pipe_nosec_test", + "platforms": [ + "linux" + ] + }, { "args": [ "invoke_large_request" @@ -20161,6 +21089,22 @@ "linux" ] }, + { + "args": [ + "registered_idempotent" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_full+poll+pipe_nosec_test", + "platforms": [ + "linux" + ] + }, { "args": [ "request_with_flags" @@ -20578,6 +21522,27 @@ "posix" ] }, + { + "args": [ + "idempotent_request" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_proxy_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "invoke_large_request" @@ -20746,6 +21711,27 @@ "posix" ] }, + { + "args": [ + "registered_idempotent" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_proxy_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "request_with_payload" @@ -21187,6 +22173,27 @@ "posix" ] }, + { + "args": [ + "idempotent_request" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_sockpair_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "invoke_large_request" @@ -21376,6 +22383,27 @@ "posix" ] }, + { + "args": [ + "registered_idempotent" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_sockpair_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "request_with_flags" @@ -21808,6 +22836,28 @@ "posix" ] }, + { + "args": [ + "idempotent_request" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_sockpair+trace_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "invoke_large_request" @@ -22006,6 +23056,28 @@ "posix" ] }, + { + "args": [ + "registered_idempotent" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_sockpair+trace_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "request_with_flags" @@ -22455,6 +23527,27 @@ "posix" ] }, + { + "args": [ + "idempotent_request" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_sockpair_1byte_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "invoke_large_request" @@ -22644,6 +23737,27 @@ "posix" ] }, + { + "args": [ + "registered_idempotent" + ], + "ci_platforms": [ + "windows", + "linux", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_sockpair_1byte_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "request_with_flags" @@ -23098,6 +24212,28 @@ "posix" ] }, + { + "args": [ + "idempotent_request" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_uchannel_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "invoke_large_request" @@ -23296,6 +24432,28 @@ "posix" ] }, + { + "args": [ + "registered_idempotent" + ], + "ci_platforms": [ + "windows", + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_uchannel_nosec_test", + "platforms": [ + "windows", + "linux", + "mac", + "posix" + ] + }, { "args": [ "request_with_flags" @@ -23772,6 +24930,26 @@ "posix" ] }, + { + "args": [ + "idempotent_request" + ], + "ci_platforms": [ + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_uds_nosec_test", + "platforms": [ + "linux", + "mac", + "posix" + ] + }, { "args": [ "invoke_large_request" @@ -23972,6 +25150,26 @@ "posix" ] }, + { + "args": [ + "registered_idempotent" + ], + "ci_platforms": [ + "linux", + "mac", + "posix" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_uds_nosec_test", + "platforms": [ + "linux", + "mac", + "posix" + ] + }, { "args": [ "request_with_flags" @@ -24392,6 +25590,22 @@ "linux" ] }, + { + "args": [ + "idempotent_request" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_uds+poll_nosec_test", + "platforms": [ + "linux" + ] + }, { "args": [ "invoke_large_request" @@ -24552,6 +25766,22 @@ "linux" ] }, + { + "args": [ + "registered_idempotent" + ], + "ci_platforms": [ + "linux" + ], + "cpu_cost": 1.0, + "exclude_configs": [], + "flaky": false, + "language": "c", + "name": "h2_uds+poll_nosec_test", + "platforms": [ + "linux" + ] + }, { "args": [ "request_with_flags" diff --git a/vsprojects/vcxproj/test/end2end/tests/end2end_nosec_tests/end2end_nosec_tests.vcxproj b/vsprojects/vcxproj/test/end2end/tests/end2end_nosec_tests/end2end_nosec_tests.vcxproj index 2f3b591dfc2..e87abfaf51f 100644 --- a/vsprojects/vcxproj/test/end2end/tests/end2end_nosec_tests/end2end_nosec_tests.vcxproj +++ b/vsprojects/vcxproj/test/end2end/tests/end2end_nosec_tests/end2end_nosec_tests.vcxproj @@ -185,6 +185,8 @@ + + @@ -205,6 +207,8 @@ + + diff --git a/vsprojects/vcxproj/test/end2end/tests/end2end_nosec_tests/end2end_nosec_tests.vcxproj.filters b/vsprojects/vcxproj/test/end2end/tests/end2end_nosec_tests/end2end_nosec_tests.vcxproj.filters index c63ebe7d81b..f373c48ddff 100644 --- a/vsprojects/vcxproj/test/end2end/tests/end2end_nosec_tests/end2end_nosec_tests.vcxproj.filters +++ b/vsprojects/vcxproj/test/end2end/tests/end2end_nosec_tests/end2end_nosec_tests.vcxproj.filters @@ -52,6 +52,9 @@ test\core\end2end\tests + + test\core\end2end\tests + test\core\end2end\tests @@ -82,6 +85,9 @@ test\core\end2end\tests + + test\core\end2end\tests + test\core\end2end\tests diff --git a/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj b/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj index 9d7bdc574cf..989da8873e4 100644 --- a/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj +++ b/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj @@ -187,6 +187,8 @@ + + @@ -207,6 +209,8 @@ + + diff --git a/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj.filters b/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj.filters index c30054a17ba..a7d188962a7 100644 --- a/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj.filters +++ b/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj.filters @@ -55,6 +55,9 @@ test\core\end2end\tests + + test\core\end2end\tests + test\core\end2end\tests @@ -85,6 +88,9 @@ test\core\end2end\tests + + test\core\end2end\tests + test\core\end2end\tests From df5231ec09caf2422f939a5a910854033b81e015 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 10 Mar 2016 07:00:47 -0800 Subject: [PATCH 08/36] Implement tests --- Makefile | 2 - test/core/bad_client/bad_client.c | 10 +- test/core/end2end/end2end_nosec_tests.c | 6 - test/core/end2end/end2end_tests.c | 6 - test/core/end2end/gen_build_yaml.py | 1 - test/core/end2end/tests/idempotent_request.c | 5 +- .../end2end/tests/registered_idempotent.c | 233 ------- test/core/end2end/tests/simple_request.c | 1 + test/core/surface/server_test.c | 14 +- tools/run_tests/sources_and_headers.json | 2 - tools/run_tests/tests.json | 621 +----------------- .../end2end_nosec_tests.vcxproj | 2 - .../end2end_nosec_tests.vcxproj.filters | 3 - .../tests/end2end_tests/end2end_tests.vcxproj | 2 - .../end2end_tests.vcxproj.filters | 3 - 15 files changed, 23 insertions(+), 888 deletions(-) delete mode 100644 test/core/end2end/tests/registered_idempotent.c diff --git a/Makefile b/Makefile index d2ec1d815d3..fb109050153 100644 --- a/Makefile +++ b/Makefile @@ -5544,7 +5544,6 @@ LIBEND2END_TESTS_SRC = \ test/core/end2end/tests/ping.c \ test/core/end2end/tests/ping_pong_streaming.c \ test/core/end2end/tests/registered_call.c \ - test/core/end2end/tests/registered_idempotent.c \ test/core/end2end/tests/request_with_flags.c \ test/core/end2end/tests/request_with_payload.c \ test/core/end2end/tests/server_finishes_request.c \ @@ -5619,7 +5618,6 @@ LIBEND2END_NOSEC_TESTS_SRC = \ test/core/end2end/tests/ping.c \ test/core/end2end/tests/ping_pong_streaming.c \ test/core/end2end/tests/registered_call.c \ - test/core/end2end/tests/registered_idempotent.c \ test/core/end2end/tests/request_with_flags.c \ test/core/end2end/tests/request_with_payload.c \ test/core/end2end/tests/server_finishes_request.c \ diff --git a/test/core/bad_client/bad_client.c b/test/core/bad_client/bad_client.c index 1a2ca6f0c09..1d066e2e803 100644 --- a/test/core/bad_client/bad_client.c +++ b/test/core/bad_client/bad_client.c @@ -36,9 +36,9 @@ #include "src/core/channel/channel_stack.h" #include "src/core/channel/http_server_filter.h" #include "src/core/iomgr/endpoint_pair.h" +#include "src/core/support/string.h" #include "src/core/surface/completion_queue.h" #include "src/core/surface/server.h" -#include "src/core/support/string.h" #include "src/core/transport/chttp2_transport.h" #include @@ -113,7 +113,7 @@ void grpc_run_bad_client_test(grpc_bad_client_server_side_validator validator, grpc_server_register_completion_queue(a.server, a.cq, NULL); a.registered_method = grpc_server_register_method(a.server, GRPC_BAD_CLIENT_REGISTERED_METHOD, - GRPC_BAD_CLIENT_REGISTERED_HOST); + GRPC_BAD_CLIENT_REGISTERED_HOST, 0); grpc_server_start(a.server); transport = grpc_create_chttp2_transport(&exec_ctx, NULL, sfd.server, 0); server_setup_transport(&a, transport); @@ -158,9 +158,9 @@ void grpc_run_bad_client_test(grpc_bad_client_server_side_validator validator, grpc_exec_ctx_finish(&exec_ctx); } grpc_server_shutdown_and_notify(a.server, a.cq, NULL); - GPR_ASSERT(grpc_completion_queue_pluck(a.cq, NULL, - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), - NULL).type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck( + a.cq, NULL, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), NULL) + .type == GRPC_OP_COMPLETE); grpc_server_destroy(a.server); grpc_completion_queue_destroy(a.cq); gpr_slice_buffer_destroy(&outgoing); diff --git a/test/core/end2end/end2end_nosec_tests.c b/test/core/end2end/end2end_nosec_tests.c index 7b6d0d3f9b8..bf4dd3555c6 100644 --- a/test/core/end2end/end2end_nosec_tests.c +++ b/test/core/end2end/end2end_nosec_tests.c @@ -65,7 +65,6 @@ extern void payload(grpc_end2end_test_config config); extern void ping(grpc_end2end_test_config config); extern void ping_pong_streaming(grpc_end2end_test_config config); extern void registered_call(grpc_end2end_test_config config); -extern void registered_idempotent(grpc_end2end_test_config config); extern void request_with_flags(grpc_end2end_test_config config); extern void request_with_payload(grpc_end2end_test_config config); extern void server_finishes_request(grpc_end2end_test_config config); @@ -108,7 +107,6 @@ void grpc_end2end_tests(int argc, char **argv, ping(config); ping_pong_streaming(config); registered_call(config); - registered_idempotent(config); request_with_flags(config); request_with_payload(config); server_finishes_request(config); @@ -230,10 +228,6 @@ void grpc_end2end_tests(int argc, char **argv, registered_call(config); continue; } - if (0 == strcmp("registered_idempotent", argv[i])) { - registered_idempotent(config); - continue; - } if (0 == strcmp("request_with_flags", argv[i])) { request_with_flags(config); continue; diff --git a/test/core/end2end/end2end_tests.c b/test/core/end2end/end2end_tests.c index 2d139c7e5d5..c37f670e689 100644 --- a/test/core/end2end/end2end_tests.c +++ b/test/core/end2end/end2end_tests.c @@ -66,7 +66,6 @@ extern void payload(grpc_end2end_test_config config); extern void ping(grpc_end2end_test_config config); extern void ping_pong_streaming(grpc_end2end_test_config config); extern void registered_call(grpc_end2end_test_config config); -extern void registered_idempotent(grpc_end2end_test_config config); extern void request_with_flags(grpc_end2end_test_config config); extern void request_with_payload(grpc_end2end_test_config config); extern void server_finishes_request(grpc_end2end_test_config config); @@ -110,7 +109,6 @@ void grpc_end2end_tests(int argc, char **argv, ping(config); ping_pong_streaming(config); registered_call(config); - registered_idempotent(config); request_with_flags(config); request_with_payload(config); server_finishes_request(config); @@ -236,10 +234,6 @@ void grpc_end2end_tests(int argc, char **argv, registered_call(config); continue; } - if (0 == strcmp("registered_idempotent", argv[i])) { - registered_idempotent(config); - continue; - } if (0 == strcmp("request_with_flags", argv[i])) { request_with_flags(config); continue; diff --git a/test/core/end2end/gen_build_yaml.py b/test/core/end2end/gen_build_yaml.py index d185a189d8b..1c0923d2c8d 100755 --- a/test/core/end2end/gen_build_yaml.py +++ b/test/core/end2end/gen_build_yaml.py @@ -115,7 +115,6 @@ END2END_TESTS = { 'ping_pong_streaming': default_test_options, 'ping': connectivity_test_options._replace(proxyable=False), 'registered_call': default_test_options, - 'registered_idempotent': default_test_options, 'request_with_flags': default_test_options._replace(proxyable=False), 'request_with_payload': default_test_options, 'server_finishes_request': default_test_options, diff --git a/test/core/end2end/tests/idempotent_request.c b/test/core/end2end/tests/idempotent_request.c index fd9788d0bac..4a9bd7bb1e7 100644 --- a/test/core/end2end/tests/idempotent_request.c +++ b/test/core/end2end/tests/idempotent_request.c @@ -135,7 +135,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; - op->flags = 0; + op->flags = GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST; op->reserved = NULL; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; @@ -203,6 +203,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr:1234")); + GPR_ASSERT(GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST == call_details.flags); GPR_ASSERT(was_cancelled == 1); gpr_free(details); @@ -238,7 +239,7 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { config.tear_down_data(&f); } -void simple_request(grpc_end2end_test_config config) { +void idempotent_request(grpc_end2end_test_config config) { int i; for (i = 0; i < 10; i++) { test_invoke_simple_request(config); diff --git a/test/core/end2end/tests/registered_idempotent.c b/test/core/end2end/tests/registered_idempotent.c deleted file mode 100644 index d9d2b19d12d..00000000000 --- a/test/core/end2end/tests/registered_idempotent.c +++ /dev/null @@ -1,233 +0,0 @@ -/* - * - * Copyright 2015, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include "test/core/end2end/end2end_tests.h" - -#include -#include - -#include "src/core/support/string.h" -#include -#include -#include -#include -#include -#include -#include "test/core/end2end/cq_verifier.h" - -enum { TIMEOUT = 200000 }; - -static void *tag(intptr_t t) { return (void *)t; } - -static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, - const char *test_name, - grpc_channel_args *client_args, - grpc_channel_args *server_args) { - grpc_end2end_test_fixture f; - gpr_log(GPR_INFO, "%s/%s", test_name, config.name); - f = config.create_fixture(client_args, server_args); - config.init_server(&f, server_args); - config.init_client(&f, client_args); - return f; -} - -static gpr_timespec n_seconds_time(int n) { - return GRPC_TIMEOUT_SECONDS_TO_DEADLINE(n); -} - -static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } - -static void drain_cq(grpc_completion_queue *cq) { - grpc_event ev; - do { - ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL); - } while (ev.type != GRPC_QUEUE_SHUTDOWN); -} - -static void shutdown_server(grpc_end2end_test_fixture *f) { - if (!f->server) return; - grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), - GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), - NULL).type == GRPC_OP_COMPLETE); - grpc_server_destroy(f->server); - f->server = NULL; -} - -static void shutdown_client(grpc_end2end_test_fixture *f) { - if (!f->client) return; - grpc_channel_destroy(f->client); - f->client = NULL; -} - -static void end_test(grpc_end2end_test_fixture *f) { - shutdown_server(f); - shutdown_client(f); - - grpc_completion_queue_shutdown(f->cq); - drain_cq(f->cq); - grpc_completion_queue_destroy(f->cq); -} - -static void simple_request_body(grpc_end2end_test_fixture f, void *rc) { - grpc_call *c; - grpc_call *s; - gpr_timespec deadline = five_seconds_time(); - cq_verifier *cqv = cq_verifier_create(f.cq); - grpc_op ops[6]; - grpc_op *op; - grpc_metadata_array initial_metadata_recv; - grpc_metadata_array trailing_metadata_recv; - grpc_metadata_array request_metadata_recv; - grpc_call_details call_details; - grpc_status_code status; - grpc_call_error error; - char *details = NULL; - size_t details_capacity = 0; - int was_cancelled = 2; - - c = grpc_channel_create_registered_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, rc, deadline, NULL); - GPR_ASSERT(c); - - grpc_metadata_array_init(&initial_metadata_recv); - grpc_metadata_array_init(&trailing_metadata_recv); - grpc_metadata_array_init(&request_metadata_recv); - grpc_call_details_init(&call_details); - - op = ops; - op->op = GRPC_OP_SEND_INITIAL_METADATA; - op->data.send_initial_metadata.count = 0; - op->flags = 0; - op->reserved = NULL; - op++; - op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; - op->flags = 0; - op->reserved = NULL; - op++; - op->op = GRPC_OP_RECV_INITIAL_METADATA; - op->data.recv_initial_metadata = &initial_metadata_recv; - op->flags = 0; - op->reserved = NULL; - op++; - op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; - op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; - op->data.recv_status_on_client.status = &status; - op->data.recv_status_on_client.status_details = &details; - op->data.recv_status_on_client.status_details_capacity = &details_capacity; - op->flags = 0; - op->reserved = NULL; - op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); - GPR_ASSERT(GRPC_CALL_OK == error); - - error = - grpc_server_request_call(f.server, &s, &call_details, - &request_metadata_recv, f.cq, f.cq, tag(101)); - GPR_ASSERT(GRPC_CALL_OK == error); - cq_expect_completion(cqv, tag(101), 1); - cq_verify(cqv); - - op = ops; - op->op = GRPC_OP_SEND_INITIAL_METADATA; - op->data.send_initial_metadata.count = 0; - op->flags = 0; - op->reserved = NULL; - op++; - op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; - op->data.send_status_from_server.trailing_metadata_count = 0; - op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED; - op->data.send_status_from_server.status_details = "xyz"; - op->flags = 0; - op->reserved = NULL; - op++; - op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; - op->data.recv_close_on_server.cancelled = &was_cancelled; - op->flags = 0; - op->reserved = NULL; - op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); - GPR_ASSERT(GRPC_CALL_OK == error); - - cq_expect_completion(cqv, tag(102), 1); - cq_expect_completion(cqv, tag(1), 1); - cq_verify(cqv); - - GPR_ASSERT(status == GRPC_STATUS_UNIMPLEMENTED); - GPR_ASSERT(0 == strcmp(details, "xyz")); - GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); - GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr:1234")); - GPR_ASSERT(was_cancelled == 1); - - gpr_free(details); - grpc_metadata_array_destroy(&initial_metadata_recv); - grpc_metadata_array_destroy(&trailing_metadata_recv); - grpc_metadata_array_destroy(&request_metadata_recv); - grpc_call_details_destroy(&call_details); - - grpc_call_destroy(c); - grpc_call_destroy(s); - - cq_verifier_destroy(cqv); -} - -static void test_invoke_simple_request(grpc_end2end_test_config config) { - grpc_end2end_test_fixture f = - begin_test(config, "test_invoke_simple_request", NULL, NULL); - void *rc = grpc_channel_register_call(f.client, "/foo", - "foo.test.google.fr:1234", NULL); - - simple_request_body(f, rc); - end_test(&f); - config.tear_down_data(&f); -} - -static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { - int i; - grpc_end2end_test_fixture f = - begin_test(config, "test_invoke_10_simple_requests", NULL, NULL); - void *rc = grpc_channel_register_call(f.client, "/foo", - "foo.test.google.fr:1234", NULL); - - for (i = 0; i < 10; i++) { - simple_request_body(f, rc); - gpr_log(GPR_INFO, "Passed simple request %d", i); - } - end_test(&f); - config.tear_down_data(&f); -} - -void registered_call(grpc_end2end_test_config config) { - test_invoke_simple_request(config); - test_invoke_10_simple_requests(config); -} diff --git a/test/core/end2end/tests/simple_request.c b/test/core/end2end/tests/simple_request.c index 3720cd1631b..6d3afad1b10 100644 --- a/test/core/end2end/tests/simple_request.c +++ b/test/core/end2end/tests/simple_request.c @@ -203,6 +203,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { GPR_ASSERT(0 == strcmp(details, "xyz")); GPR_ASSERT(0 == strcmp(call_details.method, "/foo")); GPR_ASSERT(0 == strcmp(call_details.host, "foo.test.google.fr:1234")); + GPR_ASSERT(0 == call_details.flags); GPR_ASSERT(was_cancelled == 1); gpr_free(details); diff --git a/test/core/surface/server_test.c b/test/core/surface/server_test.c index 1d5211d2259..beb685b338c 100644 --- a/test/core/surface/server_test.c +++ b/test/core/surface/server_test.c @@ -42,11 +42,19 @@ void test_register_method_fail(void) { grpc_server *server = grpc_server_create(NULL, NULL); void *method; void *method_old; - method = grpc_server_register_method(server, NULL, NULL); + method = grpc_server_register_method(server, NULL, NULL, 0); GPR_ASSERT(method == NULL); - method_old = grpc_server_register_method(server, "m", "h"); + method_old = grpc_server_register_method(server, "m", "h", 0); GPR_ASSERT(method_old != NULL); - method = grpc_server_register_method(server, "m", "h"); + method = grpc_server_register_method(server, "m", "h", 0); + GPR_ASSERT(method == NULL); + method_old = grpc_server_register_method( + server, "m2", "h2", GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST); + GPR_ASSERT(method_old != NULL); + method = grpc_server_register_method(server, "m2", "h2", 0); + GPR_ASSERT(method == NULL); + method = grpc_server_register_method( + server, "m2", "h2", GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST); GPR_ASSERT(method == NULL); grpc_server_destroy(server); } diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index a42fdc6722d..36e010c3b52 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -6311,7 +6311,6 @@ "test/core/end2end/tests/ping.c", "test/core/end2end/tests/ping_pong_streaming.c", "test/core/end2end/tests/registered_call.c", - "test/core/end2end/tests/registered_idempotent.c", "test/core/end2end/tests/request_with_flags.c", "test/core/end2end/tests/request_with_payload.c", "test/core/end2end/tests/server_finishes_request.c", @@ -6369,7 +6368,6 @@ "test/core/end2end/tests/ping.c", "test/core/end2end/tests/ping_pong_streaming.c", "test/core/end2end/tests/registered_call.c", - "test/core/end2end/tests/registered_idempotent.c", "test/core/end2end/tests/request_with_flags.c", "test/core/end2end/tests/request_with_payload.c", "test/core/end2end/tests/server_finishes_request.c", diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json index 6bbb322655a..21967ecd6c2 100644 --- a/tools/run_tests/tests.json +++ b/tools/run_tests/tests.json @@ -4783,28 +4783,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_census_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -5619,28 +5597,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_compress_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -6427,27 +6383,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_fakesec_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -7253,28 +7188,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_full_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -7921,22 +7834,6 @@ "linux" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "linux" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_full+pipe_test", - "platforms": [ - "linux" - ] - }, { "args": [ "request_with_flags" @@ -8529,22 +8426,6 @@ "linux" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "linux" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_full+poll_test", - "platforms": [ - "linux" - ] - }, { "args": [ "request_with_flags" @@ -9137,22 +9018,6 @@ "linux" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "linux" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_full+poll+pipe_test", - "platforms": [ - "linux" - ] - }, { "args": [ "request_with_flags" @@ -9885,27 +9750,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_oauth2_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -10578,27 +10422,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_proxy_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_payload" @@ -11271,27 +11094,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_sockpair_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -11966,28 +11768,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_sockpair+trace_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -12668,27 +12448,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_sockpair_1byte_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -13473,28 +13232,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_ssl_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -14143,7 +13880,7 @@ }, { "args": [ - "registered_idempotent" + "request_with_flags" ], "ci_platforms": [ "linux" @@ -14159,7 +13896,7 @@ }, { "args": [ - "request_with_flags" + "request_with_payload" ], "ci_platforms": [ "linux" @@ -14175,23 +13912,7 @@ }, { "args": [ - "request_with_payload" - ], - "ci_platforms": [ - "linux" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_ssl+poll_test", - "platforms": [ - "linux" - ] - }, - { - "args": [ - "server_finishes_request" + "server_finishes_request" ], "ci_platforms": [ "linux" @@ -14784,27 +14505,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_ssl_proxy_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_payload" @@ -15501,28 +15201,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_uchannel_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -16239,26 +15917,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_uds_test", - "platforms": [ - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -16871,22 +16529,6 @@ "linux" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "linux" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_uds+poll_test", - "platforms": [ - "linux" - ] - }, { "args": [ "request_with_flags" @@ -17625,28 +17267,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_census_nosec_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -18439,28 +18059,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_compress_nosec_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -19253,28 +18851,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_full_nosec_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -19905,22 +19481,6 @@ "linux" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "linux" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_full+pipe_nosec_test", - "platforms": [ - "linux" - ] - }, { "args": [ "request_with_flags" @@ -20497,22 +20057,6 @@ "linux" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "linux" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_full+poll_nosec_test", - "platforms": [ - "linux" - ] - }, { "args": [ "request_with_flags" @@ -21089,22 +20633,6 @@ "linux" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "linux" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_full+poll+pipe_nosec_test", - "platforms": [ - "linux" - ] - }, { "args": [ "request_with_flags" @@ -21711,27 +21239,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_proxy_nosec_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_payload" @@ -22383,27 +21890,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_sockpair_nosec_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -23056,28 +22542,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_sockpair+trace_nosec_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -23737,27 +23201,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_sockpair_1byte_nosec_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -24432,28 +23875,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "windows", - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_uchannel_nosec_test", - "platforms": [ - "windows", - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -25150,26 +24571,6 @@ "posix" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "linux", - "mac", - "posix" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_uds_nosec_test", - "platforms": [ - "linux", - "mac", - "posix" - ] - }, { "args": [ "request_with_flags" @@ -25766,22 +25167,6 @@ "linux" ] }, - { - "args": [ - "registered_idempotent" - ], - "ci_platforms": [ - "linux" - ], - "cpu_cost": 1.0, - "exclude_configs": [], - "flaky": false, - "language": "c", - "name": "h2_uds+poll_nosec_test", - "platforms": [ - "linux" - ] - }, { "args": [ "request_with_flags" diff --git a/vsprojects/vcxproj/test/end2end/tests/end2end_nosec_tests/end2end_nosec_tests.vcxproj b/vsprojects/vcxproj/test/end2end/tests/end2end_nosec_tests/end2end_nosec_tests.vcxproj index e87abfaf51f..23fa3739af6 100644 --- a/vsprojects/vcxproj/test/end2end/tests/end2end_nosec_tests/end2end_nosec_tests.vcxproj +++ b/vsprojects/vcxproj/test/end2end/tests/end2end_nosec_tests/end2end_nosec_tests.vcxproj @@ -207,8 +207,6 @@ - - diff --git a/vsprojects/vcxproj/test/end2end/tests/end2end_nosec_tests/end2end_nosec_tests.vcxproj.filters b/vsprojects/vcxproj/test/end2end/tests/end2end_nosec_tests/end2end_nosec_tests.vcxproj.filters index f373c48ddff..924352abfa4 100644 --- a/vsprojects/vcxproj/test/end2end/tests/end2end_nosec_tests/end2end_nosec_tests.vcxproj.filters +++ b/vsprojects/vcxproj/test/end2end/tests/end2end_nosec_tests/end2end_nosec_tests.vcxproj.filters @@ -85,9 +85,6 @@ test\core\end2end\tests - - test\core\end2end\tests - test\core\end2end\tests diff --git a/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj b/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj index 989da8873e4..47b84cc9c29 100644 --- a/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj +++ b/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj @@ -209,8 +209,6 @@ - - diff --git a/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj.filters b/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj.filters index a7d188962a7..b7d3d5492c6 100644 --- a/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj.filters +++ b/vsprojects/vcxproj/test/end2end/tests/end2end_tests/end2end_tests.vcxproj.filters @@ -88,9 +88,6 @@ test\core\end2end\tests - - test\core\end2end\tests - test\core\end2end\tests From c1b6bdd6274f3739ba72803b5e2fd20401ab151b Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 10 Mar 2016 07:10:38 -0800 Subject: [PATCH 09/36] Fix tests in new idempotency work --- src/core/channel/http_server_filter.c | 2 ++ test/core/end2end/fixtures/proxy.c | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/core/channel/http_server_filter.c b/src/core/channel/http_server_filter.c index 96a34e3a603..f4d69212b16 100644 --- a/src/core/channel/http_server_filter.c +++ b/src/core/channel/http_server_filter.c @@ -191,7 +191,9 @@ static void hs_mutate_op(grpc_call_element *elem, if (op->recv_initial_metadata) { /* substitute our callback for the higher callback */ + GPR_ASSERT(op->recv_idempotent_request != NULL); calld->recv_initial_metadata = op->recv_initial_metadata; + calld->recv_idempotent_request = op->recv_idempotent_request; calld->on_done_recv = op->recv_initial_metadata_ready; op->recv_initial_metadata_ready = &calld->hs_on_recv; } diff --git a/test/core/end2end/fixtures/proxy.c b/test/core/end2end/fixtures/proxy.c index 434e75dd15e..a6487a17ac2 100644 --- a/test/core/end2end/fixtures/proxy.c +++ b/test/core/end2end/fixtures/proxy.c @@ -338,10 +338,10 @@ static void on_new_call(void *arg, int success) { proxy->new_call_details.deadline, NULL); gpr_ref_init(&pc->refs, 1); - op.flags = 0; op.reserved = NULL; op.op = GRPC_OP_RECV_INITIAL_METADATA; + op.flags = 0; op.data.recv_initial_metadata = &pc->p2s_initial_metadata; refpc(pc, "on_p2s_recv_initial_metadata"); err = grpc_call_start_batch( @@ -349,6 +349,7 @@ static void on_new_call(void *arg, int success) { GPR_ASSERT(err == GRPC_CALL_OK); op.op = GRPC_OP_SEND_INITIAL_METADATA; + op.flags = proxy->new_call_details.flags; op.data.send_initial_metadata.count = pc->c2p_initial_metadata.count; op.data.send_initial_metadata.metadata = pc->c2p_initial_metadata.metadata; refpc(pc, "on_p2s_sent_initial_metadata"); @@ -357,6 +358,7 @@ static void on_new_call(void *arg, int success) { GPR_ASSERT(err == GRPC_CALL_OK); op.op = GRPC_OP_RECV_MESSAGE; + op.flags = 0; op.data.recv_message = &pc->c2p_msg; refpc(pc, "on_c2p_recv_msg"); err = grpc_call_start_batch(pc->c2p, &op, 1, @@ -364,6 +366,7 @@ static void on_new_call(void *arg, int success) { GPR_ASSERT(err == GRPC_CALL_OK); op.op = GRPC_OP_RECV_MESSAGE; + op.flags = 0; op.data.recv_message = &pc->p2s_msg; refpc(pc, "on_p2s_recv_msg"); err = grpc_call_start_batch(pc->p2s, &op, 1, @@ -371,6 +374,7 @@ static void on_new_call(void *arg, int success) { GPR_ASSERT(err == GRPC_CALL_OK); op.op = GRPC_OP_RECV_STATUS_ON_CLIENT; + op.flags = 0; op.data.recv_status_on_client.trailing_metadata = &pc->p2s_trailing_metadata; op.data.recv_status_on_client.status = &pc->p2s_status; @@ -383,6 +387,7 @@ static void on_new_call(void *arg, int success) { GPR_ASSERT(err == GRPC_CALL_OK); op.op = GRPC_OP_RECV_CLOSE_ON_SERVER; + op.flags = 0; op.data.recv_close_on_server.cancelled = &pc->c2p_server_cancelled; refpc(pc, "on_c2p_closed"); err = grpc_call_start_batch(pc->c2p, &op, 1, new_closure(on_c2p_closed, pc), From 4cf0448fbc015962c664bbfe1c03a7fcbddc81e9 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 10 Mar 2016 07:12:42 -0800 Subject: [PATCH 10/36] clang-format --- include/grpc/grpc.h | 24 +++-- src/core/channel/http_client_filter.c | 15 +-- src/core/channel/http_server_filter.c | 15 +-- src/core/surface/server.c | 20 ++-- src/core/transport/static_metadata.c | 108 ++++--------------- test/core/bad_client/bad_client.c | 6 +- test/core/end2end/tests/idempotent_request.c | 6 +- 7 files changed, 51 insertions(+), 143 deletions(-) diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index dbd2cc00007..5335dd0cc69 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -154,8 +154,9 @@ GRPCAPI void grpc_alarm_cancel(grpc_alarm *alarm); GRPCAPI void grpc_alarm_destroy(grpc_alarm *alarm); /** Check the connectivity state of a channel. */ -GRPCAPI grpc_connectivity_state grpc_channel_check_connectivity_state( - grpc_channel *channel, int try_to_connect); +GRPCAPI grpc_connectivity_state +grpc_channel_check_connectivity_state(grpc_channel *channel, + int try_to_connect); /** Watch for a change in connectivity state. Once the channel connectivity state is different from last_observed_state, @@ -266,10 +267,9 @@ GRPCAPI grpc_call_error grpc_call_cancel(grpc_call *call, void *reserved); and description passed in. Importantly, this function does not send status nor description to the remote endpoint. */ -GRPCAPI grpc_call_error grpc_call_cancel_with_status(grpc_call *call, - grpc_status_code status, - const char *description, - void *reserved); +GRPCAPI grpc_call_error +grpc_call_cancel_with_status(grpc_call *call, grpc_status_code status, + const char *description, void *reserved); /** Destroy a call. THREAD SAFETY: grpc_call_destroy is thread-compatible */ @@ -283,11 +283,13 @@ GRPCAPI void grpc_call_destroy(grpc_call *call); to \a cq_bound_to_call. Note that \a cq_for_notification must have been registered to the server via \a grpc_server_register_completion_queue. */ -GRPCAPI grpc_call_error grpc_server_request_call( - grpc_server *server, grpc_call **call, grpc_call_details *details, - grpc_metadata_array *request_metadata, - grpc_completion_queue *cq_bound_to_call, - grpc_completion_queue *cq_for_notification, void *tag_new); +GRPCAPI grpc_call_error +grpc_server_request_call(grpc_server *server, grpc_call **call, + grpc_call_details *details, + grpc_metadata_array *request_metadata, + grpc_completion_queue *cq_bound_to_call, + grpc_completion_queue *cq_for_notification, + void *tag_new); /** Registers a method in the server. Methods to this (host, method) pair will not be reported by diff --git a/src/core/channel/http_client_filter.c b/src/core/channel/http_client_filter.c index 0f44f4e844b..32c808cf6aa 100644 --- a/src/core/channel/http_client_filter.c +++ b/src/core/channel/http_client_filter.c @@ -244,14 +244,7 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx, } const grpc_channel_filter grpc_http_client_filter = { - hc_start_transport_op, - grpc_channel_next_op, - sizeof(call_data), - init_call_elem, - grpc_call_stack_ignore_set_pollset, - destroy_call_elem, - sizeof(channel_data), - init_channel_elem, - destroy_channel_elem, - grpc_call_next_get_peer, - "http-client"}; + hc_start_transport_op, grpc_channel_next_op, sizeof(call_data), + init_call_elem, grpc_call_stack_ignore_set_pollset, destroy_call_elem, + sizeof(channel_data), init_channel_elem, destroy_channel_elem, + grpc_call_next_get_peer, "http-client"}; diff --git a/src/core/channel/http_server_filter.c b/src/core/channel/http_server_filter.c index f4d69212b16..42ce8bc887b 100644 --- a/src/core/channel/http_server_filter.c +++ b/src/core/channel/http_server_filter.c @@ -235,14 +235,7 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx, grpc_channel_element *elem) {} const grpc_channel_filter grpc_http_server_filter = { - hs_start_transport_op, - grpc_channel_next_op, - sizeof(call_data), - init_call_elem, - grpc_call_stack_ignore_set_pollset, - destroy_call_elem, - sizeof(channel_data), - init_channel_elem, - destroy_channel_elem, - grpc_call_next_get_peer, - "http-server"}; + hs_start_transport_op, grpc_channel_next_op, sizeof(call_data), + init_call_elem, grpc_call_stack_ignore_set_pollset, destroy_call_elem, + sizeof(channel_data), init_channel_elem, destroy_channel_elem, + grpc_call_next_get_peer, "http-server"}; diff --git a/src/core/surface/server.c b/src/core/surface/server.c index 4b46f2b3c26..068ea9d9a34 100644 --- a/src/core/surface/server.c +++ b/src/core/surface/server.c @@ -769,17 +769,10 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx, } static const grpc_channel_filter server_surface_filter = { - server_start_transport_stream_op, - grpc_channel_next_op, - sizeof(call_data), - init_call_elem, - grpc_call_stack_ignore_set_pollset, - destroy_call_elem, - sizeof(channel_data), - init_channel_elem, - destroy_channel_elem, - grpc_call_next_get_peer, - "server", + server_start_transport_stream_op, grpc_channel_next_op, sizeof(call_data), + init_call_elem, grpc_call_stack_ignore_set_pollset, destroy_call_elem, + sizeof(channel_data), init_channel_elem, destroy_channel_elem, + grpc_call_next_get_peer, "server", }; void grpc_server_register_completion_queue(grpc_server *server, @@ -956,8 +949,7 @@ void grpc_server_setup_transport(grpc_exec_ctx *exec_ctx, grpc_server *s, channel = grpc_channel_create_from_filters(exec_ctx, NULL, filters, num_filters, args, 0); chand = (channel_data *)grpc_channel_stack_element( - grpc_channel_get_channel_stack(channel), 0) - ->channel_data; + grpc_channel_get_channel_stack(channel), 0)->channel_data; chand->server = s; server_ref(s); chand->channel = channel; @@ -978,7 +970,7 @@ void grpc_server_setup_transport(grpc_exec_ctx *exec_ctx, grpc_server *s, method = grpc_mdstr_from_string(rm->method); hash = GRPC_MDSTR_KV_HASH(host ? host->hash : 0, method->hash); for (probes = 0; chand->registered_methods[(hash + probes) % slots] - .server_registered_method != NULL; + .server_registered_method != NULL; probes++) ; if (probes > max_probes) max_probes = probes; diff --git a/src/core/transport/static_metadata.c b/src/core/transport/static_metadata.c index fc01b89b1da..5459b74e7e2 100644 --- a/src/core/transport/static_metadata.c +++ b/src/core/transport/static_metadata.c @@ -64,96 +64,24 @@ const uint8_t grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT * 2] = 82, 35, 83, 84, 85, 35, 86, 35, 87, 35, 88, 35, 89, 35}; const char *const grpc_static_metadata_strings[GRPC_STATIC_MDSTR_COUNT] = { - "0", - "1", - "2", - "200", - "204", - "206", - "304", - "400", - "404", - "500", - "accept", - "accept-charset", - "accept-encoding", - "accept-language", - "accept-ranges", - "access-control-allow-origin", - "age", - "allow", - "application/grpc", - ":authority", - "authorization", - "cache-control", - "census-bin", - "census-binary-bin", - "content-disposition", - "content-encoding", - "content-language", - "content-length", - "content-location", - "content-range", - "content-type", - "cookie", - "date", - "deflate", - "deflate,gzip", - "", - "etag", - "expect", - "expires", - "from", - "GET", - "grpc", - "grpc-accept-encoding", - "grpc-encoding", - "grpc-internal-encoding-request", - "grpc-message", - "grpc-status", - "grpc-timeout", - "gzip", - "gzip, deflate", - "host", - "http", - "https", - "identity", - "identity,deflate", - "identity,deflate,gzip", - "identity,gzip", - "if-match", - "if-modified-since", - "if-none-match", - "if-range", - "if-unmodified-since", - "last-modified", - "link", - "location", - "max-forwards", - ":method", - ":path", - "POST", - "proxy-authenticate", - "proxy-authorization", - "PUT", - "range", - "referer", - "refresh", - "retry-after", - ":scheme", - "server", - "set-cookie", - "/", - "/index.html", - ":status", - "strict-transport-security", - "te", - "trailers", - "transfer-encoding", - "user-agent", - "vary", - "via", - "www-authenticate"}; + "0", "1", "2", "200", "204", "206", "304", "400", "404", "500", "accept", + "accept-charset", "accept-encoding", "accept-language", "accept-ranges", + "access-control-allow-origin", "age", "allow", "application/grpc", + ":authority", "authorization", "cache-control", "census-bin", + "census-binary-bin", "content-disposition", "content-encoding", + "content-language", "content-length", "content-location", "content-range", + "content-type", "cookie", "date", "deflate", "deflate,gzip", "", "etag", + "expect", "expires", "from", "GET", "grpc", "grpc-accept-encoding", + "grpc-encoding", "grpc-internal-encoding-request", "grpc-message", + "grpc-status", "grpc-timeout", "gzip", "gzip, deflate", "host", "http", + "https", "identity", "identity,deflate", "identity,deflate,gzip", + "identity,gzip", "if-match", "if-modified-since", "if-none-match", + "if-range", "if-unmodified-since", "last-modified", "link", "location", + "max-forwards", ":method", ":path", "POST", "proxy-authenticate", + "proxy-authorization", "PUT", "range", "referer", "refresh", "retry-after", + ":scheme", "server", "set-cookie", "/", "/index.html", ":status", + "strict-transport-security", "te", "trailers", "transfer-encoding", + "user-agent", "vary", "via", "www-authenticate"}; const uint8_t grpc_static_accept_encoding_metadata[8] = {0, 29, 26, 30, 28, 32, 27, 31}; diff --git a/test/core/bad_client/bad_client.c b/test/core/bad_client/bad_client.c index 1d066e2e803..40c9877ab01 100644 --- a/test/core/bad_client/bad_client.c +++ b/test/core/bad_client/bad_client.c @@ -158,9 +158,9 @@ void grpc_run_bad_client_test(grpc_bad_client_server_side_validator validator, grpc_exec_ctx_finish(&exec_ctx); } grpc_server_shutdown_and_notify(a.server, a.cq, NULL); - GPR_ASSERT(grpc_completion_queue_pluck( - a.cq, NULL, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(a.cq, NULL, + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(a.server); grpc_completion_queue_destroy(a.cq); gpr_slice_buffer_destroy(&outgoing); diff --git a/test/core/end2end/tests/idempotent_request.c b/test/core/end2end/tests/idempotent_request.c index 4a9bd7bb1e7..18a0016995f 100644 --- a/test/core/end2end/tests/idempotent_request.c +++ b/test/core/end2end/tests/idempotent_request.c @@ -77,9 +77,9 @@ static void drain_cq(grpc_completion_queue *cq) { static void shutdown_server(grpc_end2end_test_fixture *f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); - GPR_ASSERT(grpc_completion_queue_pluck( - f->cq, tag(1000), GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(1000), + GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); f->server = NULL; } From b093686e59ccb2a74329ce73e23d4993162dad89 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 10 Mar 2016 07:17:25 -0800 Subject: [PATCH 11/36] Fix copyright --- src/core/transport/static_metadata.c | 6 +++--- src/core/transport/static_metadata.h | 6 +++--- test/core/end2end/fixtures/proxy.c | 2 +- test/core/end2end/tests/idempotent_request.c | 2 +- test/core/end2end/tests/simple_request.c | 2 +- test/core/surface/server_test.c | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/core/transport/static_metadata.c b/src/core/transport/static_metadata.c index 5459b74e7e2..140ec5edc76 100644 --- a/src/core/transport/static_metadata.c +++ b/src/core/transport/static_metadata.c @@ -6,13 +6,13 @@ * modification, are permitted provided that the following conditions are * met: * - * * Redistributions of source code must retain the above copyright + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above + * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. - * * Neither the name of Google Inc. nor the names of its + * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * diff --git a/src/core/transport/static_metadata.h b/src/core/transport/static_metadata.h index b0e5b2fcdfa..3382b1b2918 100644 --- a/src/core/transport/static_metadata.h +++ b/src/core/transport/static_metadata.h @@ -6,13 +6,13 @@ * modification, are permitted provided that the following conditions are * met: * - * * Redistributions of source code must retain the above copyright + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above + * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. - * * Neither the name of Google Inc. nor the names of its + * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * diff --git a/test/core/end2end/fixtures/proxy.c b/test/core/end2end/fixtures/proxy.c index a6487a17ac2..1ca53cdad9c 100644 --- a/test/core/end2end/fixtures/proxy.c +++ b/test/core/end2end/fixtures/proxy.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/test/core/end2end/tests/idempotent_request.c b/test/core/end2end/tests/idempotent_request.c index 18a0016995f..f445a9ab37f 100644 --- a/test/core/end2end/tests/idempotent_request.c +++ b/test/core/end2end/tests/idempotent_request.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/test/core/end2end/tests/simple_request.c b/test/core/end2end/tests/simple_request.c index 6d3afad1b10..2353698b0b0 100644 --- a/test/core/end2end/tests/simple_request.c +++ b/test/core/end2end/tests/simple_request.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/test/core/surface/server_test.c b/test/core/surface/server_test.c index beb685b338c..4c62d8caadb 100644 --- a/test/core/surface/server_test.c +++ b/test/core/surface/server_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without From f1262ce7e785ad1344beeacb967340fe89ec4b2d Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 10 Mar 2016 07:47:11 -0800 Subject: [PATCH 12/36] Stats collection pipeline --- src/core/transport/chttp2/frame_data.c | 25 ++++++++++---- src/core/transport/chttp2/frame_data.h | 4 ++- src/core/transport/chttp2/frame_rst_stream.c | 5 ++- src/core/transport/chttp2/frame_rst_stream.h | 6 ++-- .../transport/chttp2/frame_window_update.c | 9 +++-- .../transport/chttp2/frame_window_update.h | 6 ++-- src/core/transport/chttp2/hpack_encoder.c | 6 ++++ src/core/transport/chttp2/hpack_encoder.h | 8 +++-- src/core/transport/chttp2/hpack_parser.c | 5 ++- src/core/transport/chttp2/internal.h | 4 +++ src/core/transport/chttp2/parsing.c | 34 ++++++++++++++----- src/core/transport/chttp2/writing.c | 34 ++++++++++++------- src/core/transport/chttp2_transport.c | 6 ++-- .../transport/chttp2/hpack_encoder_test.c | 13 ++++--- 14 files changed, 120 insertions(+), 45 deletions(-) diff --git a/src/core/transport/chttp2/frame_data.c b/src/core/transport/chttp2/frame_data.c index f9a1af88736..6c0b2af04b2 100644 --- a/src/core/transport/chttp2/frame_data.c +++ b/src/core/transport/chttp2/frame_data.c @@ -35,11 +35,11 @@ #include -#include "src/core/transport/chttp2/internal.h" -#include "src/core/support/string.h" #include #include #include +#include "src/core/support/string.h" +#include "src/core/transport/chttp2/internal.h" #include "src/core/transport/transport.h" grpc_chttp2_parse_error grpc_chttp2_data_parser_init( @@ -113,6 +113,7 @@ grpc_byte_stream *grpc_chttp2_incoming_frame_queue_pop( void grpc_chttp2_encode_data(uint32_t id, gpr_slice_buffer *inbuf, uint32_t write_bytes, int is_eof, + grpc_transport_one_way_stats *stats, gpr_slice_buffer *outbuf) { gpr_slice hdr; uint8_t *p; @@ -132,6 +133,9 @@ void grpc_chttp2_encode_data(uint32_t id, gpr_slice_buffer *inbuf, gpr_slice_buffer_add(outbuf, hdr); gpr_slice_buffer_move_first(inbuf, write_bytes, outbuf); + + stats->framing_bytes += 9; + stats->data_bytes += write_bytes; } grpc_chttp2_parse_error grpc_chttp2_data_parser_parse( @@ -156,6 +160,7 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse( switch (p->state) { fh_0: case GRPC_CHTTP2_DATA_FH_0: + stream_parsing->stats.incoming.framing_bytes++; p->frame_type = *cur; switch (p->frame_type) { case 0: @@ -174,6 +179,7 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse( } /* fallthrough */ case GRPC_CHTTP2_DATA_FH_1: + stream_parsing->stats.incoming.framing_bytes++; p->frame_size = ((uint32_t)*cur) << 24; if (++cur == end) { p->state = GRPC_CHTTP2_DATA_FH_2; @@ -181,6 +187,7 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse( } /* fallthrough */ case GRPC_CHTTP2_DATA_FH_2: + stream_parsing->stats.incoming.framing_bytes++; p->frame_size |= ((uint32_t)*cur) << 16; if (++cur == end) { p->state = GRPC_CHTTP2_DATA_FH_3; @@ -188,6 +195,7 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse( } /* fallthrough */ case GRPC_CHTTP2_DATA_FH_3: + stream_parsing->stats.incoming.framing_bytes++; p->frame_size |= ((uint32_t)*cur) << 8; if (++cur == end) { p->state = GRPC_CHTTP2_DATA_FH_4; @@ -195,6 +203,7 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse( } /* fallthrough */ case GRPC_CHTTP2_DATA_FH_4: + stream_parsing->stats.incoming.framing_bytes++; p->frame_size |= ((uint32_t)*cur); p->state = GRPC_CHTTP2_DATA_FRAME; ++cur; @@ -215,7 +224,9 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse( } grpc_chttp2_list_add_parsing_seen_stream(transport_parsing, stream_parsing); - if ((uint32_t)(end - cur) == p->frame_size) { + uint32_t remaining = (uint32_t)(end - cur); + if (remaining == p->frame_size) { + stream_parsing->stats.incoming.data_bytes += p->frame_size; grpc_chttp2_incoming_byte_stream_push( exec_ctx, p->parsing_frame, gpr_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); @@ -224,7 +235,8 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse( p->parsing_frame = NULL; p->state = GRPC_CHTTP2_DATA_FH_0; return GRPC_CHTTP2_PARSE_OK; - } else if ((uint32_t)(end - cur) > p->frame_size) { + } else if (remaining > p->frame_size) { + stream_parsing->stats.incoming.data_bytes += p->frame_size; grpc_chttp2_incoming_byte_stream_push( exec_ctx, p->parsing_frame, gpr_slice_sub(slice, (size_t)(cur - beg), @@ -235,11 +247,12 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse( cur += p->frame_size; goto fh_0; /* loop */ } else { + GPR_ASSERT(remaining <= p->frame_size); grpc_chttp2_incoming_byte_stream_push( exec_ctx, p->parsing_frame, gpr_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg))); - GPR_ASSERT((size_t)(end - cur) <= p->frame_size); - p->frame_size -= (uint32_t)(end - cur); + p->frame_size -= remaining; + stream_parsing->stats.incoming.data_bytes += remaining; return GRPC_CHTTP2_PARSE_OK; } } diff --git a/src/core/transport/chttp2/frame_data.h b/src/core/transport/chttp2/frame_data.h index 936b7a25899..b0e85a2f5f4 100644 --- a/src/core/transport/chttp2/frame_data.h +++ b/src/core/transport/chttp2/frame_data.h @@ -36,11 +36,12 @@ /* Parser for GRPC streams embedded in DATA frames */ -#include "src/core/iomgr/exec_ctx.h" #include #include +#include "src/core/iomgr/exec_ctx.h" #include "src/core/transport/byte_stream.h" #include "src/core/transport/chttp2/frame.h" +#include "src/core/transport/transport.h" typedef enum { GRPC_CHTTP2_DATA_FH_0, @@ -96,6 +97,7 @@ grpc_chttp2_parse_error grpc_chttp2_data_parser_parse( void grpc_chttp2_encode_data(uint32_t id, gpr_slice_buffer *inbuf, uint32_t write_bytes, int is_eof, + grpc_transport_one_way_stats *stats, gpr_slice_buffer *outbuf); #endif /* GRPC_INTERNAL_CORE_TRANSPORT_CHTTP2_FRAME_DATA_H */ diff --git a/src/core/transport/chttp2/frame_rst_stream.c b/src/core/transport/chttp2/frame_rst_stream.c index 754529e4b92..8063dfbb211 100644 --- a/src/core/transport/chttp2/frame_rst_stream.c +++ b/src/core/transport/chttp2/frame_rst_stream.c @@ -38,8 +38,10 @@ #include "src/core/transport/chttp2/frame.h" -gpr_slice grpc_chttp2_rst_stream_create(uint32_t id, uint32_t code) { +gpr_slice grpc_chttp2_rst_stream_create(uint32_t id, uint32_t code, + grpc_transport_one_way_stats *stats) { gpr_slice slice = gpr_slice_malloc(13); + stats->framing_bytes += 13; uint8_t *p = GPR_SLICE_START_PTR(slice); *p++ = 0; @@ -84,6 +86,7 @@ grpc_chttp2_parse_error grpc_chttp2_rst_stream_parser_parse( cur++; p->byte++; } + stream_parsing->stats.incoming.framing_bytes += (uint64_t)(end - cur); if (p->byte == 4) { GPR_ASSERT(is_last); diff --git a/src/core/transport/chttp2/frame_rst_stream.h b/src/core/transport/chttp2/frame_rst_stream.h index 72ca654c324..96bc15af6b0 100644 --- a/src/core/transport/chttp2/frame_rst_stream.h +++ b/src/core/transport/chttp2/frame_rst_stream.h @@ -35,15 +35,17 @@ #define GRPC_INTERNAL_CORE_TRANSPORT_CHTTP2_FRAME_RST_STREAM_H #include -#include "src/core/transport/chttp2/frame.h" #include "src/core/iomgr/exec_ctx.h" +#include "src/core/transport/chttp2/frame.h" +#include "src/core/transport/transport.h" typedef struct { uint8_t byte; uint8_t reason_bytes[4]; } grpc_chttp2_rst_stream_parser; -gpr_slice grpc_chttp2_rst_stream_create(uint32_t stream_id, uint32_t code); +gpr_slice grpc_chttp2_rst_stream_create(uint32_t stream_id, uint32_t code, + grpc_transport_one_way_stats *stats); grpc_chttp2_parse_error grpc_chttp2_rst_stream_parser_begin_frame( grpc_chttp2_rst_stream_parser *parser, uint32_t length, uint8_t flags); diff --git a/src/core/transport/chttp2/frame_window_update.c b/src/core/transport/chttp2/frame_window_update.c index 62d9bac1179..4a6944eef78 100644 --- a/src/core/transport/chttp2/frame_window_update.c +++ b/src/core/transport/chttp2/frame_window_update.c @@ -36,9 +36,10 @@ #include -gpr_slice grpc_chttp2_window_update_create(uint32_t id, - uint32_t window_update) { +gpr_slice grpc_chttp2_window_update_create( + uint32_t id, uint32_t window_update, grpc_transport_one_way_stats *stats) { gpr_slice slice = gpr_slice_malloc(13); + stats->header_bytes += 13; uint8_t *p = GPR_SLICE_START_PTR(slice); GPR_ASSERT(window_update); @@ -87,6 +88,10 @@ grpc_chttp2_parse_error grpc_chttp2_window_update_parser_parse( p->byte++; } + if (stream_parsing != NULL) { + stream_parsing->stats.incoming.framing_bytes += (uint32_t)(end - cur); + } + if (p->byte == 4) { uint32_t received_update = p->amount; if (received_update == 0 || (received_update & 0x80000000u)) { diff --git a/src/core/transport/chttp2/frame_window_update.h b/src/core/transport/chttp2/frame_window_update.h index 89d835c0797..5f7600f2cc5 100644 --- a/src/core/transport/chttp2/frame_window_update.h +++ b/src/core/transport/chttp2/frame_window_update.h @@ -34,9 +34,10 @@ #ifndef GRPC_INTERNAL_CORE_TRANSPORT_CHTTP2_FRAME_WINDOW_UPDATE_H #define GRPC_INTERNAL_CORE_TRANSPORT_CHTTP2_FRAME_WINDOW_UPDATE_H -#include "src/core/iomgr/exec_ctx.h" #include +#include "src/core/iomgr/exec_ctx.h" #include "src/core/transport/chttp2/frame.h" +#include "src/core/transport/transport.h" typedef struct { uint8_t byte; @@ -44,7 +45,8 @@ typedef struct { uint32_t amount; } grpc_chttp2_window_update_parser; -gpr_slice grpc_chttp2_window_update_create(uint32_t id, uint32_t window_delta); +gpr_slice grpc_chttp2_window_update_create(uint32_t id, uint32_t window_delta, + grpc_transport_one_way_stats *stats); grpc_chttp2_parse_error grpc_chttp2_window_update_parser_begin_frame( grpc_chttp2_window_update_parser *parser, uint32_t length, uint8_t flags); diff --git a/src/core/transport/chttp2/hpack_encoder.c b/src/core/transport/chttp2/hpack_encoder.c index f30f574d063..c56d656e65d 100644 --- a/src/core/transport/chttp2/hpack_encoder.c +++ b/src/core/transport/chttp2/hpack_encoder.c @@ -74,6 +74,7 @@ typedef struct { /* output stream id */ uint32_t stream_id; gpr_slice_buffer *output; + grpc_transport_one_way_stats *stats; } framer_state; /* fills p (which is expected to be 9 bytes long) with a data frame header */ @@ -102,6 +103,7 @@ static void finish_frame(framer_state *st, int is_header_boundary, st->stream_id, st->output->length - st->output_length_at_start_of_frame, (uint8_t)((is_last_in_stream ? GRPC_CHTTP2_DATA_FLAG_END_STREAM : 0) | (is_header_boundary ? GRPC_CHTTP2_DATA_FLAG_END_HEADERS : 0))); + st->stats->framing_bytes += 9; st->is_first_frame = 0; } @@ -147,8 +149,10 @@ static void add_header_data(framer_state *st, gpr_slice slice) { remaining = GRPC_CHTTP2_MAX_PAYLOAD_LENGTH + st->output_length_at_start_of_frame - st->output->length; if (len <= remaining) { + st->stats->header_bytes += len; gpr_slice_buffer_add(st->output, slice); } else { + st->stats->header_bytes += remaining; gpr_slice_buffer_add(st->output, gpr_slice_split_head(&slice, remaining)); finish_frame(st, 0, 0); begin_frame(st); @@ -535,6 +539,7 @@ void grpc_chttp2_hpack_compressor_set_max_table_size( void grpc_chttp2_encode_header(grpc_chttp2_hpack_compressor *c, uint32_t stream_id, grpc_metadata_batch *metadata, int is_eof, + grpc_transport_one_way_stats *stats, gpr_slice_buffer *outbuf) { framer_state st; grpc_linked_mdelem *l; @@ -546,6 +551,7 @@ void grpc_chttp2_encode_header(grpc_chttp2_hpack_compressor *c, st.stream_id = stream_id; st.output = outbuf; st.is_first_frame = 1; + st.stats = stats; /* Encode a metadata batch; store the returned values, representing a metadata element that needs to be unreffed back into the metadata diff --git a/src/core/transport/chttp2/hpack_encoder.h b/src/core/transport/chttp2/hpack_encoder.h index 19b5cb72ae1..9c32f4ef086 100644 --- a/src/core/transport/chttp2/hpack_encoder.h +++ b/src/core/transport/chttp2/hpack_encoder.h @@ -34,12 +34,13 @@ #ifndef GRPC_INTERNAL_CORE_TRANSPORT_CHTTP2_HPACK_ENCODER_H #define GRPC_INTERNAL_CORE_TRANSPORT_CHTTP2_HPACK_ENCODER_H -#include "src/core/transport/chttp2/frame.h" -#include "src/core/transport/metadata.h" -#include "src/core/transport/metadata_batch.h" #include #include #include +#include "src/core/transport/chttp2/frame.h" +#include "src/core/transport/metadata.h" +#include "src/core/transport/metadata_batch.h" +#include "src/core/transport/transport.h" #define GRPC_CHTTP2_HPACKC_NUM_FILTERS 256 #define GRPC_CHTTP2_HPACKC_NUM_VALUES 256 @@ -90,6 +91,7 @@ void grpc_chttp2_hpack_compressor_set_max_usable_size( void grpc_chttp2_encode_header(grpc_chttp2_hpack_compressor *c, uint32_t id, grpc_metadata_batch *metadata, int is_eof, + grpc_transport_one_way_stats *stats, gpr_slice_buffer *outbuf); #endif /* GRPC_INTERNAL_CORE_TRANSPORT_CHTTP2_HPACK_ENCODER_H */ diff --git a/src/core/transport/chttp2/hpack_parser.c b/src/core/transport/chttp2/hpack_parser.c index a63c7db1f61..699feb4fedf 100644 --- a/src/core/transport/chttp2/hpack_parser.c +++ b/src/core/transport/chttp2/hpack_parser.c @@ -34,9 +34,9 @@ #include "src/core/transport/chttp2/hpack_parser.h" #include "src/core/transport/chttp2/internal.h" +#include #include #include -#include /* This is here for grpc_is_binary_header * TODO(murgatroid99): Remove this @@ -1412,6 +1412,9 @@ grpc_chttp2_parse_error grpc_chttp2_header_parser_parse( grpc_chttp2_stream_parsing *stream_parsing, gpr_slice slice, int is_last) { grpc_chttp2_hpack_parser *parser = hpack_parser; GPR_TIMER_BEGIN("grpc_chttp2_hpack_parser_parse", 0); + if (stream_parsing != NULL) { + stream_parsing->stats.incoming.header_bytes += GPR_SLICE_LENGTH(slice); + } if (!grpc_chttp2_hpack_parser_parse(parser, GPR_SLICE_START_PTR(slice), GPR_SLICE_END_PTR(slice))) { GPR_TIMER_END("grpc_chttp2_hpack_parser_parse", 0); diff --git a/src/core/transport/chttp2/internal.h b/src/core/transport/chttp2/internal.h index 47b6ffff626..ef4e186b703 100644 --- a/src/core/transport/chttp2/internal.h +++ b/src/core/transport/chttp2/internal.h @@ -438,6 +438,8 @@ typedef struct { gpr_slice fetching_slice; size_t stream_fetched; grpc_closure finished_fetch; + /** stats gathered during the write */ + grpc_transport_one_way_stats stats; } grpc_chttp2_stream_writing; struct grpc_chttp2_stream_parsing { @@ -463,6 +465,8 @@ struct grpc_chttp2_stream_parsing { int64_t outgoing_window; /** number of bytes received - reset at end of parse thread execution */ int64_t received_bytes; + /** stats gathered during the parse */ + grpc_transport_stream_stats stats; /** incoming metadata */ grpc_chttp2_incoming_metadata_buffer metadata_buffer[2]; diff --git a/src/core/transport/chttp2/parsing.c b/src/core/transport/chttp2/parsing.c index 0516f39fa9e..3e057f8f3d1 100644 --- a/src/core/transport/chttp2/parsing.c +++ b/src/core/transport/chttp2/parsing.c @@ -171,6 +171,9 @@ void grpc_chttp2_publish_reads( grpc_chttp2_list_add_check_read_ops(transport_global, stream_global); } + /* flush stats to global stream state */ + grpc_transport_move_stats(&stream_parsing->stats, &stream_global->stats); + /* update outgoing flow control window */ was_zero = stream_global->outgoing_window <= 0; GRPC_CHTTP2_FLOW_MOVE_STREAM("parsed", transport_global, stream_global, @@ -544,8 +547,13 @@ static int init_data_frame_parser( grpc_chttp2_parsing_lookup_stream(transport_parsing, transport_parsing->incoming_stream_id); grpc_chttp2_parse_error err = GRPC_CHTTP2_PARSE_OK; - if (!stream_parsing || stream_parsing->received_close) + if (stream_parsing == NULL) { + return init_skip_frame_parser(exec_ctx, transport_parsing, 0); + } + stream_parsing->stats.incoming.framing_bytes += 9; + if (stream_parsing->received_close) { return init_skip_frame_parser(exec_ctx, transport_parsing, 0); + } if (err == GRPC_CHTTP2_PARSE_OK) { err = update_incoming_window(exec_ctx, transport_parsing, stream_parsing); } @@ -566,7 +574,8 @@ static int init_data_frame_parser( gpr_slice_buffer_add( &transport_parsing->qbuf, grpc_chttp2_rst_stream_create(transport_parsing->incoming_stream_id, - GRPC_CHTTP2_PROTOCOL_ERROR)); + GRPC_CHTTP2_PROTOCOL_ERROR, + &stream_parsing->stats.outgoing)); return init_skip_frame_parser(exec_ctx, transport_parsing, 0); case GRPC_CHTTP2_CONNECTION_ERROR: return 0; @@ -717,6 +726,7 @@ static int init_header_frame_parser( transport_parsing->incoming_stream = stream_parsing; } GPR_ASSERT(stream_parsing != NULL && (via_accept == 0 || via_accept == 1)); + stream_parsing->stats.incoming.framing_bytes += 9; if (stream_parsing->received_close) { gpr_log(GPR_ERROR, "skipping already closed grpc_chttp2_stream header"); transport_parsing->incoming_stream = NULL; @@ -752,9 +762,14 @@ static int init_window_update_frame_parser( &transport_parsing->simple.window_update, transport_parsing->incoming_frame_size, transport_parsing->incoming_frame_flags); - if (transport_parsing->incoming_stream_id) { - transport_parsing->incoming_stream = grpc_chttp2_parsing_lookup_stream( - transport_parsing, transport_parsing->incoming_stream_id); + if (transport_parsing->incoming_stream_id != 0) { + grpc_chttp2_stream_parsing *stream_parsing = + transport_parsing->incoming_stream = grpc_chttp2_parsing_lookup_stream( + transport_parsing, transport_parsing->incoming_stream_id); + if (stream_parsing == NULL) { + return init_skip_frame_parser(exec_ctx, transport_parsing, 0); + } + stream_parsing->stats.incoming.framing_bytes += 9; } transport_parsing->parser = grpc_chttp2_window_update_parser_parse; transport_parsing->parser_data = &transport_parsing->simple.window_update; @@ -778,11 +793,13 @@ static int init_rst_stream_parser( &transport_parsing->simple.rst_stream, transport_parsing->incoming_frame_size, transport_parsing->incoming_frame_flags); - transport_parsing->incoming_stream = grpc_chttp2_parsing_lookup_stream( - transport_parsing, transport_parsing->incoming_stream_id); + grpc_chttp2_stream_parsing *stream_parsing = + transport_parsing->incoming_stream = grpc_chttp2_parsing_lookup_stream( + transport_parsing, transport_parsing->incoming_stream_id); if (!transport_parsing->incoming_stream) { return init_skip_frame_parser(exec_ctx, transport_parsing, 0); } + stream_parsing->stats.incoming.framing_bytes += 9; transport_parsing->parser = grpc_chttp2_rst_stream_parser_parse; transport_parsing->parser_data = &transport_parsing->simple.rst_stream; return ok; @@ -856,7 +873,8 @@ static int parse_frame_slice(grpc_exec_ctx *exec_ctx, gpr_slice_buffer_add( &transport_parsing->qbuf, grpc_chttp2_rst_stream_create(transport_parsing->incoming_stream_id, - GRPC_CHTTP2_PROTOCOL_ERROR)); + GRPC_CHTTP2_PROTOCOL_ERROR, + &stream_parsing->stats.outgoing)); } return 1; case GRPC_CHTTP2_CONNECTION_ERROR: diff --git a/src/core/transport/chttp2/writing.c b/src/core/transport/chttp2/writing.c index 482994c25d9..e588cf9ac8a 100644 --- a/src/core/transport/chttp2/writing.c +++ b/src/core/transport/chttp2/writing.c @@ -161,8 +161,10 @@ int grpc_chttp2_unlocking_check_writes( transport_global->announce_incoming_window, UINT32_MAX); GRPC_CHTTP2_FLOW_DEBIT_TRANSPORT("write", transport_global, announce_incoming_window, announced); - gpr_slice_buffer_add(&transport_writing->outbuf, - grpc_chttp2_window_update_create(0, announced)); + grpc_transport_one_way_stats throwaway_stats; + gpr_slice_buffer_add( + &transport_writing->outbuf, + grpc_chttp2_window_update_create(0, announced, &throwaway_stats)); } GPR_TIMER_END("grpc_chttp2_unlocking_check_writes", 0); @@ -205,7 +207,8 @@ static void finalize_outbuf(grpc_exec_ctx *exec_ctx, if (stream_writing->send_initial_metadata != NULL) { grpc_chttp2_encode_header( &transport_writing->hpack_compressor, stream_writing->id, - stream_writing->send_initial_metadata, 0, &transport_writing->outbuf); + stream_writing->send_initial_metadata, 0, &stream_writing->stats, + &transport_writing->outbuf); stream_writing->send_initial_metadata = NULL; stream_writing->sent_initial_metadata = 1; } @@ -216,7 +219,8 @@ static void finalize_outbuf(grpc_exec_ctx *exec_ctx, gpr_slice_buffer_add( &transport_writing->outbuf, grpc_chttp2_window_update_create(stream_writing->id, - stream_writing->announce_window)); + stream_writing->announce_window, + &stream_writing->stats)); GRPC_CHTTP2_FLOW_DEBIT_STREAM("write", transport_writing, stream_writing, announce_window, announce); stream_writing->announce_window = 0; @@ -255,7 +259,8 @@ static void finalize_outbuf(grpc_exec_ctx *exec_ctx, stream_writing->send_trailing_metadata); grpc_chttp2_encode_data( stream_writing->id, &stream_writing->flow_controlled_buffer, - send_bytes, is_last_frame, &transport_writing->outbuf); + send_bytes, is_last_frame, &stream_writing->stats, + &transport_writing->outbuf); GRPC_CHTTP2_FLOW_DEBIT_STREAM("write", transport_writing, stream_writing, outgoing_window, send_bytes); @@ -281,19 +286,20 @@ static void finalize_outbuf(grpc_exec_ctx *exec_ctx, stream_writing->send_trailing_metadata != NULL) { if (grpc_metadata_batch_is_empty( stream_writing->send_trailing_metadata)) { - grpc_chttp2_encode_data(stream_writing->id, - &stream_writing->flow_controlled_buffer, 0, 1, - &transport_writing->outbuf); + grpc_chttp2_encode_data( + stream_writing->id, &stream_writing->flow_controlled_buffer, 0, 1, + &stream_writing->stats, &transport_writing->outbuf); } else { - grpc_chttp2_encode_header(&transport_writing->hpack_compressor, - stream_writing->id, - stream_writing->send_trailing_metadata, 1, - &transport_writing->outbuf); + grpc_chttp2_encode_header( + &transport_writing->hpack_compressor, stream_writing->id, + stream_writing->send_trailing_metadata, 1, &stream_writing->stats, + &transport_writing->outbuf); } if (!transport_writing->is_client && !stream_writing->read_closed) { gpr_slice_buffer_add(&transport_writing->outbuf, grpc_chttp2_rst_stream_create( - stream_writing->id, GRPC_CHTTP2_NO_ERROR)); + stream_writing->id, GRPC_CHTTP2_NO_ERROR, + &stream_writing->stats)); } stream_writing->send_trailing_metadata = NULL; stream_writing->sent_trailing_metadata = 1; @@ -331,6 +337,8 @@ void grpc_chttp2_cleanup_writing( exec_ctx, stream_global, &stream_global->send_initial_metadata_finished, 1); } + grpc_transport_move_one_way_stats(&stream_writing->stats, + &stream_global->stats.outgoing); if (stream_writing->sent_message) { GPR_ASSERT(stream_writing->send_message == NULL); grpc_chttp2_complete_closure_step( diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c index 2b87642f17a..ccb8ff97b8e 100644 --- a/src/core/transport/chttp2_transport.c +++ b/src/core/transport/chttp2_transport.c @@ -1150,7 +1150,8 @@ static void cancel_from_api(grpc_exec_ctx *exec_ctx, &transport_global->qbuf, grpc_chttp2_rst_stream_create( stream_global->id, - (uint32_t)grpc_chttp2_grpc_status_to_http2_error(status))); + (uint32_t)grpc_chttp2_grpc_status_to_http2_error(status), + &stream_global->stats.outgoing)); } grpc_chttp2_fake_status(exec_ctx, transport_global, stream_global, status, NULL); @@ -1340,7 +1341,8 @@ static void close_from_api(grpc_exec_ctx *exec_ctx, gpr_slice_buffer_add( &transport_global->qbuf, - grpc_chttp2_rst_stream_create(stream_global->id, GRPC_CHTTP2_NO_ERROR)); + grpc_chttp2_rst_stream_create(stream_global->id, GRPC_CHTTP2_NO_ERROR, + &stream_global->stats.outgoing)); if (optional_message) { gpr_slice_ref(*optional_message); diff --git a/test/core/transport/chttp2/hpack_encoder_test.c b/test/core/transport/chttp2/hpack_encoder_test.c index 4a9d143640a..32f60c10052 100644 --- a/test/core/transport/chttp2/hpack_encoder_test.c +++ b/test/core/transport/chttp2/hpack_encoder_test.c @@ -34,13 +34,15 @@ #include "src/core/transport/chttp2/hpack_encoder.h" #include +#include -#include "src/core/support/string.h" -#include "src/core/transport/chttp2/hpack_parser.h" -#include "src/core/transport/metadata.h" #include #include #include + +#include "src/core/support/string.h" +#include "src/core/transport/chttp2/hpack_parser.h" +#include "src/core/transport/metadata.h" #include "test/core/util/parse_hexstring.h" #include "test/core/util/slice_splitter.h" #include "test/core/util/test_config.h" @@ -93,7 +95,10 @@ static void verify(size_t window_available, int eof, size_t expect_window_used, gpr_slice_buffer_init(&output); - grpc_chttp2_encode_header(&g_compressor, 0xdeadbeef, &b, eof, &output); + grpc_transport_one_way_stats stats; + memset(&stats, 0, sizeof(stats)); + grpc_chttp2_encode_header(&g_compressor, 0xdeadbeef, &b, eof, &stats, + &output); merged = grpc_slice_merge(output.slices, output.count); gpr_slice_buffer_destroy(&output); grpc_metadata_batch_destroy(&b); From 5cb79621d0d958eb3439f40700ac16240de5b65d Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 15 Mar 2016 14:46:54 -0700 Subject: [PATCH 13/36] Initial canaries for downstream merges --- Makefile | 102 +++++++++ build.yaml | 33 +++ test/core/internal_api_canaries/iomgr.c | 115 ++++++++++ test/core/internal_api_canaries/support.c | 58 +++++ test/core/internal_api_canaries/transport.c | 81 +++++++ tools/run_tests/sources_and_headers.json | 48 +++++ vsprojects/buildtests_c.sln | 81 +++++++ .../internal_api_canary_iomgr_test.vcxproj | 199 ++++++++++++++++++ ...rnal_api_canary_iomgr_test.vcxproj.filters | 21 ++ .../internal_api_canary_support_test.vcxproj | 199 ++++++++++++++++++ ...al_api_canary_support_test.vcxproj.filters | 21 ++ ...internal_api_canary_transport_test.vcxproj | 199 ++++++++++++++++++ ..._api_canary_transport_test.vcxproj.filters | 21 ++ 13 files changed, 1178 insertions(+) create mode 100644 test/core/internal_api_canaries/iomgr.c create mode 100644 test/core/internal_api_canaries/support.c create mode 100644 test/core/internal_api_canaries/transport.c create mode 100644 vsprojects/vcxproj/test/internal_api_canary_iomgr_test/internal_api_canary_iomgr_test.vcxproj create mode 100644 vsprojects/vcxproj/test/internal_api_canary_iomgr_test/internal_api_canary_iomgr_test.vcxproj.filters create mode 100644 vsprojects/vcxproj/test/internal_api_canary_support_test/internal_api_canary_support_test.vcxproj create mode 100644 vsprojects/vcxproj/test/internal_api_canary_support_test/internal_api_canary_support_test.vcxproj.filters create mode 100644 vsprojects/vcxproj/test/internal_api_canary_transport_test/internal_api_canary_transport_test.vcxproj create mode 100644 vsprojects/vcxproj/test/internal_api_canary_transport_test/internal_api_canary_transport_test.vcxproj.filters diff --git a/Makefile b/Makefile index f118d542538..3952f935715 100644 --- a/Makefile +++ b/Makefile @@ -901,6 +901,9 @@ httpcli_parser_test: $(BINDIR)/$(CONFIG)/httpcli_parser_test httpcli_test: $(BINDIR)/$(CONFIG)/httpcli_test httpscli_test: $(BINDIR)/$(CONFIG)/httpscli_test init_test: $(BINDIR)/$(CONFIG)/init_test +internal_api_canary_iomgr_test: $(BINDIR)/$(CONFIG)/internal_api_canary_iomgr_test +internal_api_canary_support_test: $(BINDIR)/$(CONFIG)/internal_api_canary_support_test +internal_api_canary_transport_test: $(BINDIR)/$(CONFIG)/internal_api_canary_transport_test invalid_call_argument_test: $(BINDIR)/$(CONFIG)/invalid_call_argument_test json_rewrite: $(BINDIR)/$(CONFIG)/json_rewrite json_rewrite_test: $(BINDIR)/$(CONFIG)/json_rewrite_test @@ -1207,6 +1210,9 @@ buildtests_c: privatelibs_c \ $(BINDIR)/$(CONFIG)/httpcli_test \ $(BINDIR)/$(CONFIG)/httpscli_test \ $(BINDIR)/$(CONFIG)/init_test \ + $(BINDIR)/$(CONFIG)/internal_api_canary_iomgr_test \ + $(BINDIR)/$(CONFIG)/internal_api_canary_support_test \ + $(BINDIR)/$(CONFIG)/internal_api_canary_transport_test \ $(BINDIR)/$(CONFIG)/invalid_call_argument_test \ $(BINDIR)/$(CONFIG)/json_rewrite \ $(BINDIR)/$(CONFIG)/json_rewrite_test \ @@ -7747,6 +7753,102 @@ endif endif +INTERNAL_API_CANARY_IOMGR_TEST_SRC = \ + test/core/internal_api_canaries/iomgr.c \ + +INTERNAL_API_CANARY_IOMGR_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(INTERNAL_API_CANARY_IOMGR_TEST_SRC)))) +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL. + +$(BINDIR)/$(CONFIG)/internal_api_canary_iomgr_test: openssl_dep_error + +else + + + +$(BINDIR)/$(CONFIG)/internal_api_canary_iomgr_test: $(INTERNAL_API_CANARY_IOMGR_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LD) $(LDFLAGS) $(INTERNAL_API_CANARY_IOMGR_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/internal_api_canary_iomgr_test + +endif + +$(OBJDIR)/$(CONFIG)/test/core/internal_api_canaries/iomgr.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + +deps_internal_api_canary_iomgr_test: $(INTERNAL_API_CANARY_IOMGR_TEST_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(INTERNAL_API_CANARY_IOMGR_TEST_OBJS:.o=.dep) +endif +endif + + +INTERNAL_API_CANARY_SUPPORT_TEST_SRC = \ + test/core/internal_api_canaries/iomgr.c \ + +INTERNAL_API_CANARY_SUPPORT_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(INTERNAL_API_CANARY_SUPPORT_TEST_SRC)))) +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL. + +$(BINDIR)/$(CONFIG)/internal_api_canary_support_test: openssl_dep_error + +else + + + +$(BINDIR)/$(CONFIG)/internal_api_canary_support_test: $(INTERNAL_API_CANARY_SUPPORT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LD) $(LDFLAGS) $(INTERNAL_API_CANARY_SUPPORT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/internal_api_canary_support_test + +endif + +$(OBJDIR)/$(CONFIG)/test/core/internal_api_canaries/iomgr.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + +deps_internal_api_canary_support_test: $(INTERNAL_API_CANARY_SUPPORT_TEST_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(INTERNAL_API_CANARY_SUPPORT_TEST_OBJS:.o=.dep) +endif +endif + + +INTERNAL_API_CANARY_TRANSPORT_TEST_SRC = \ + test/core/internal_api_canaries/iomgr.c \ + +INTERNAL_API_CANARY_TRANSPORT_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(INTERNAL_API_CANARY_TRANSPORT_TEST_SRC)))) +ifeq ($(NO_SECURE),true) + +# You can't build secure targets if you don't have OpenSSL. + +$(BINDIR)/$(CONFIG)/internal_api_canary_transport_test: openssl_dep_error + +else + + + +$(BINDIR)/$(CONFIG)/internal_api_canary_transport_test: $(INTERNAL_API_CANARY_TRANSPORT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + $(E) "[LD] Linking $@" + $(Q) mkdir -p `dirname $@` + $(Q) $(LD) $(LDFLAGS) $(INTERNAL_API_CANARY_TRANSPORT_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/internal_api_canary_transport_test + +endif + +$(OBJDIR)/$(CONFIG)/test/core/internal_api_canaries/iomgr.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a + +deps_internal_api_canary_transport_test: $(INTERNAL_API_CANARY_TRANSPORT_TEST_OBJS:.o=.dep) + +ifneq ($(NO_SECURE),true) +ifneq ($(NO_DEPS),true) +-include $(INTERNAL_API_CANARY_TRANSPORT_TEST_OBJS:.o=.dep) +endif +endif + + INVALID_CALL_ARGUMENT_TEST_SRC = \ test/core/end2end/invalid_call_argument_test.c \ diff --git a/build.yaml b/build.yaml index 83b7714e655..a7365a34a35 100644 --- a/build.yaml +++ b/build.yaml @@ -1578,6 +1578,39 @@ targets: - grpc - gpr_test_util - gpr +- name: internal_api_canary_iomgr_test + build: test + run: false + language: c + src: + - test/core/internal_api_canaries/iomgr.c + deps: + - grpc_test_util + - grpc + - gpr_test_util + - gpr +- name: internal_api_canary_support_test + build: test + run: false + language: c + src: + - test/core/internal_api_canaries/iomgr.c + deps: + - grpc_test_util + - grpc + - gpr_test_util + - gpr +- name: internal_api_canary_transport_test + build: test + run: false + language: c + src: + - test/core/internal_api_canaries/iomgr.c + deps: + - grpc_test_util + - grpc + - gpr_test_util + - gpr - name: invalid_call_argument_test build: test language: c diff --git a/test/core/internal_api_canaries/iomgr.c b/test/core/internal_api_canaries/iomgr.c new file mode 100644 index 00000000000..3b1a1bb8994 --- /dev/null +++ b/test/core/internal_api_canaries/iomgr.c @@ -0,0 +1,115 @@ +/* + * + * Copyright 2015-2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "src/core/iomgr/iomgr.h" +#include "src/core/iomgr/closure.h" +#include "src/core/iomgr/endpoint.h" +#include "src/core/iomgr/exec_ctx.h" +#include "src/core/iomgr/executor.h" + +/******************************************************************************* + * NOTE: If this test fails to compile, then the api changes are likely to cause + * merge failures downstream. Please pay special attention to reviewing + * these changes, and solicit help as appropriate when merging downstream. + * + * This test is NOT expected to be run directly. + ******************************************************************************/ + +static void test_code(void) { + /* iomgr.h */ + grpc_iomgr_init(); + grpc_iomgr_shutdown(); + + /* closure.h */ + grpc_closure closure; + closure.cb = NULL; + closure.cb_arg = NULL; + closure.final_data = 0; + + grpc_closure_list closure_list = GRPC_CLOSURE_LIST_INIT; + closure_list.head = NULL; + closure_list.tail = NULL; + + grpc_closure_init(&closure, NULL, NULL); + + grpc_closure_create(NULL, NULL); + + grpc_closure_list_move(NULL, NULL); + grpc_closure_list_add(NULL, NULL, true); + bool x = grpc_closure_list_empty(closure_list); + grpc_closure_next(&closure); + + /* endpoint.h */ + grpc_endpoint_read(NULL, NULL, NULL, NULL); + grpc_endpoint_get_peer(NULL); + grpc_endpoint_write(NULL, NULL, NULL, NULL); + grpc_endpoint_shutdown(NULL, NULL); + grpc_endpoint_destroy(NULL, NULL); + grpc_endpoint_add_to_pollset(NULL, NULL, NULL); + grpc_endpoint_add_to_pollset_set(NULL, NULL, NULL); + + grpc_endpoint endpoint; + grpc_endpoint_vtable vtable = { + grpc_endpoint_read, grpc_endpoint_write, + grpc_endpoint_add_to_pollset, grpc_endpoint_add_to_pollset_set, + grpc_endpoint_shutdown, grpc_endpoint_destroy, + grpc_endpoint_get_peer}; + endpoint.vtable = &vtable; + + /* exec_ctx.h */ + grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; + grpc_exec_ctx_flush(&exec_ctx); + grpc_exec_ctx_finish(&exec_ctx); + grpc_exec_ctx_enqueue(&exec_ctx, &closure, x, NULL); + grpc_exec_ctx_enqueue_list(&exec_ctx, &closure_list, NULL); + + /* executor.h */ + grpc_executor_init(); + grpc_executor_enqueue(&closure, x); + grpc_executor_shutdown(); + + /* pollset.h */ + grpc_pollset_size(); + grpc_pollset_init(NULL, NULL); + grpc_pollset_shutdown(NULL, NULL, NULL); + grpc_pollset_reset(NULL); + grpc_pollset_destroy(NULL); + grpc_pollset_work(NULL, NULL, NULL, gpr_now(GPR_CLOCK_REALTIME), + gpr_now(GPR_CLOCK_MONOTONIC)); + grpc_pollset_kick(NULL, NULL); +} + +int main(void) { + if (false) test_code(); + return 0; +} diff --git a/test/core/internal_api_canaries/support.c b/test/core/internal_api_canaries/support.c new file mode 100644 index 00000000000..e964f71e4c9 --- /dev/null +++ b/test/core/internal_api_canaries/support.c @@ -0,0 +1,58 @@ +/* + * + * Copyright 2015-2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/******************************************************************************* + * NOTE: If this test fails to compile, then the api changes are likely to cause + * merge failures downstream. Please pay special attention to reviewing + * these changes, and solicit help as appropriate when merging downstream. + * + * This test is NOT expected to be run directly. + ******************************************************************************/ + +#include "src/core/support/env.h" +#include "src/core/support/load_file.h" +#include "src/core/support/tmpfile.h" + +static void test_code(void) { + /* env.h */ + gpr_set_env("abc", gpr_getenv("xyz")); + /* load_file.h */ + gpr_load_file("abc", 1, NULL); + /* tmpfile.h */ + fclose(gpr_tmpfile("foo", NULL)); +} + +int main(void) { + if (false) test_code(); + return 0; +} diff --git a/test/core/internal_api_canaries/transport.c b/test/core/internal_api_canaries/transport.c new file mode 100644 index 00000000000..474a8a11ec0 --- /dev/null +++ b/test/core/internal_api_canaries/transport.c @@ -0,0 +1,81 @@ +/* + * + * Copyright 2015-2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/******************************************************************************* + * NOTE: If this test fails to compile, then the api changes are likely to cause + * merge failures downstream. Please pay special attention to reviewing + * these changes, and solicit help as appropriate when merging downstream. + * + * This test is NOT expected to be run directly. + ******************************************************************************/ + +#include "src/core/transport/transport.h" +#include "src/core/transport/transport_impl.h" + +static void test_code(void) { + /* transport_impl.h */ + grpc_transport transport; + grpc_transport_vtable vtable = {12345, + grpc_transport_init_stream, + grpc_transport_set_pollset, + grpc_transport_perform_stream_op, + grpc_transport_perform_op, + grpc_transport_destroy_stream, + grpc_transport_destroy, + grpc_transport_get_peer}; + transport.vtable = &vtable; + + /* transport.h */ + GRPC_STREAM_REF_INIT(NULL, 0, NULL, NULL, "xyz"); + GPR_ASSERT(0 == grpc_transport_stream_size(NULL)); + GPR_ASSERT(grpc_transport_init_stream(&transport, NULL, NULL, NULL, NULL)); + grpc_transport_set_pollset(&transport, NULL, NULL, NULL); + grpc_transport_destroy_stream(&transport, NULL, NULL); + grpc_transport_stream_op_finish_with_failure(NULL, NULL); + grpc_transport_stream_op_add_cancellation(NULL, GRPC_STATUS_UNAVAILABLE); + grpc_transport_stream_op_add_close(NULL, GRPC_STATUS_UNAVAILABLE, + grpc_transport_op_string(NULL)); + grpc_transport_perform_stream_op(&transport, NULL, NULL, NULL); + grpc_transport_perform_op(&transport, NULL, NULL); + grpc_transport_ping(&transport, NULL); + grpc_transport_goaway(&transport, GRPC_STATUS_UNAVAILABLE, + gpr_slice_malloc(0)); + grpc_transport_close(&transport); + grpc_transport_destroy(&transport, NULL); + GPR_ASSERT("xyz" == grpc_transport_get_peer(&transport, NULL)); +} + +int main(void) { + if (false) test_code(); + return 0; +} diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index 092ed35ad97..ea2ab241636 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -980,6 +980,54 @@ "third_party": false, "type": "target" }, + { + "deps": [ + "gpr", + "gpr_test_util", + "grpc", + "grpc_test_util" + ], + "headers": [], + "language": "c", + "name": "internal_api_canary_iomgr_test", + "src": [ + "test/core/internal_api_canaries/iomgr.c" + ], + "third_party": false, + "type": "target" + }, + { + "deps": [ + "gpr", + "gpr_test_util", + "grpc", + "grpc_test_util" + ], + "headers": [], + "language": "c", + "name": "internal_api_canary_support_test", + "src": [ + "test/core/internal_api_canaries/iomgr.c" + ], + "third_party": false, + "type": "target" + }, + { + "deps": [ + "gpr", + "gpr_test_util", + "grpc", + "grpc_test_util" + ], + "headers": [], + "language": "c", + "name": "internal_api_canary_transport_test", + "src": [ + "test/core/internal_api_canaries/iomgr.c" + ], + "third_party": false, + "type": "target" + }, { "deps": [ "gpr", diff --git a/vsprojects/buildtests_c.sln b/vsprojects/buildtests_c.sln index 413ed3e3f38..fdc32175cff 100644 --- a/vsprojects/buildtests_c.sln +++ b/vsprojects/buildtests_c.sln @@ -693,6 +693,39 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "init_test", "vcxproj\test\i {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "internal_api_canary_iomgr_test", "vcxproj\test\internal_api_canary_iomgr_test\internal_api_canary_iomgr_test.vcxproj", "{28AE726B-1BFB-202B-48D2-41AF9D09B9EA}" + ProjectSection(myProperties) = preProject + lib = "False" + EndProjectSection + ProjectSection(ProjectDependencies) = postProject + {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} = {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} + {29D16885-7228-4C31-81ED-5F9187C7F2A9} = {29D16885-7228-4C31-81ED-5F9187C7F2A9} + {EAB0A629-17A9-44DB-B5FF-E91A721FE037} = {EAB0A629-17A9-44DB-B5FF-E91A721FE037} + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "internal_api_canary_support_test", "vcxproj\test\internal_api_canary_support_test\internal_api_canary_support_test.vcxproj", "{D53575C6-713C-E6E3-FD74-E65F20916498}" + ProjectSection(myProperties) = preProject + lib = "False" + EndProjectSection + ProjectSection(ProjectDependencies) = postProject + {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} = {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} + {29D16885-7228-4C31-81ED-5F9187C7F2A9} = {29D16885-7228-4C31-81ED-5F9187C7F2A9} + {EAB0A629-17A9-44DB-B5FF-E91A721FE037} = {EAB0A629-17A9-44DB-B5FF-E91A721FE037} + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "internal_api_canary_transport_test", "vcxproj\test\internal_api_canary_transport_test\internal_api_canary_transport_test.vcxproj", "{ED24E700-964E-B426-6A6A-1944E2EF7BCB}" + ProjectSection(myProperties) = preProject + lib = "False" + EndProjectSection + ProjectSection(ProjectDependencies) = postProject + {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} = {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} + {29D16885-7228-4C31-81ED-5F9187C7F2A9} = {29D16885-7228-4C31-81ED-5F9187C7F2A9} + {EAB0A629-17A9-44DB-B5FF-E91A721FE037} = {EAB0A629-17A9-44DB-B5FF-E91A721FE037} + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + EndProjectSection +EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "invalid_call_argument_test", "vcxproj\test\invalid_call_argument_test\invalid_call_argument_test.vcxproj", "{C32CA8A3-58E6-8EB9-B72F-C295547D36A6}" ProjectSection(myProperties) = preProject lib = "False" @@ -2462,6 +2495,54 @@ Global {117CA7AD-C42B-9217-6C95-42A801777BC5}.Release-DLL|Win32.Build.0 = Release|Win32 {117CA7AD-C42B-9217-6C95-42A801777BC5}.Release-DLL|x64.ActiveCfg = Release|x64 {117CA7AD-C42B-9217-6C95-42A801777BC5}.Release-DLL|x64.Build.0 = Release|x64 + {28AE726B-1BFB-202B-48D2-41AF9D09B9EA}.Debug|Win32.ActiveCfg = Debug|Win32 + {28AE726B-1BFB-202B-48D2-41AF9D09B9EA}.Debug|x64.ActiveCfg = Debug|x64 + {28AE726B-1BFB-202B-48D2-41AF9D09B9EA}.Release|Win32.ActiveCfg = Release|Win32 + {28AE726B-1BFB-202B-48D2-41AF9D09B9EA}.Release|x64.ActiveCfg = Release|x64 + {28AE726B-1BFB-202B-48D2-41AF9D09B9EA}.Debug|Win32.Build.0 = Debug|Win32 + {28AE726B-1BFB-202B-48D2-41AF9D09B9EA}.Debug|x64.Build.0 = Debug|x64 + {28AE726B-1BFB-202B-48D2-41AF9D09B9EA}.Release|Win32.Build.0 = Release|Win32 + {28AE726B-1BFB-202B-48D2-41AF9D09B9EA}.Release|x64.Build.0 = Release|x64 + {28AE726B-1BFB-202B-48D2-41AF9D09B9EA}.Debug-DLL|Win32.ActiveCfg = Debug|Win32 + {28AE726B-1BFB-202B-48D2-41AF9D09B9EA}.Debug-DLL|Win32.Build.0 = Debug|Win32 + {28AE726B-1BFB-202B-48D2-41AF9D09B9EA}.Debug-DLL|x64.ActiveCfg = Debug|x64 + {28AE726B-1BFB-202B-48D2-41AF9D09B9EA}.Debug-DLL|x64.Build.0 = Debug|x64 + {28AE726B-1BFB-202B-48D2-41AF9D09B9EA}.Release-DLL|Win32.ActiveCfg = Release|Win32 + {28AE726B-1BFB-202B-48D2-41AF9D09B9EA}.Release-DLL|Win32.Build.0 = Release|Win32 + {28AE726B-1BFB-202B-48D2-41AF9D09B9EA}.Release-DLL|x64.ActiveCfg = Release|x64 + {28AE726B-1BFB-202B-48D2-41AF9D09B9EA}.Release-DLL|x64.Build.0 = Release|x64 + {D53575C6-713C-E6E3-FD74-E65F20916498}.Debug|Win32.ActiveCfg = Debug|Win32 + {D53575C6-713C-E6E3-FD74-E65F20916498}.Debug|x64.ActiveCfg = Debug|x64 + {D53575C6-713C-E6E3-FD74-E65F20916498}.Release|Win32.ActiveCfg = Release|Win32 + {D53575C6-713C-E6E3-FD74-E65F20916498}.Release|x64.ActiveCfg = Release|x64 + {D53575C6-713C-E6E3-FD74-E65F20916498}.Debug|Win32.Build.0 = Debug|Win32 + {D53575C6-713C-E6E3-FD74-E65F20916498}.Debug|x64.Build.0 = Debug|x64 + {D53575C6-713C-E6E3-FD74-E65F20916498}.Release|Win32.Build.0 = Release|Win32 + {D53575C6-713C-E6E3-FD74-E65F20916498}.Release|x64.Build.0 = Release|x64 + {D53575C6-713C-E6E3-FD74-E65F20916498}.Debug-DLL|Win32.ActiveCfg = Debug|Win32 + {D53575C6-713C-E6E3-FD74-E65F20916498}.Debug-DLL|Win32.Build.0 = Debug|Win32 + {D53575C6-713C-E6E3-FD74-E65F20916498}.Debug-DLL|x64.ActiveCfg = Debug|x64 + {D53575C6-713C-E6E3-FD74-E65F20916498}.Debug-DLL|x64.Build.0 = Debug|x64 + {D53575C6-713C-E6E3-FD74-E65F20916498}.Release-DLL|Win32.ActiveCfg = Release|Win32 + {D53575C6-713C-E6E3-FD74-E65F20916498}.Release-DLL|Win32.Build.0 = Release|Win32 + {D53575C6-713C-E6E3-FD74-E65F20916498}.Release-DLL|x64.ActiveCfg = Release|x64 + {D53575C6-713C-E6E3-FD74-E65F20916498}.Release-DLL|x64.Build.0 = Release|x64 + {ED24E700-964E-B426-6A6A-1944E2EF7BCB}.Debug|Win32.ActiveCfg = Debug|Win32 + {ED24E700-964E-B426-6A6A-1944E2EF7BCB}.Debug|x64.ActiveCfg = Debug|x64 + {ED24E700-964E-B426-6A6A-1944E2EF7BCB}.Release|Win32.ActiveCfg = Release|Win32 + {ED24E700-964E-B426-6A6A-1944E2EF7BCB}.Release|x64.ActiveCfg = Release|x64 + {ED24E700-964E-B426-6A6A-1944E2EF7BCB}.Debug|Win32.Build.0 = Debug|Win32 + {ED24E700-964E-B426-6A6A-1944E2EF7BCB}.Debug|x64.Build.0 = Debug|x64 + {ED24E700-964E-B426-6A6A-1944E2EF7BCB}.Release|Win32.Build.0 = Release|Win32 + {ED24E700-964E-B426-6A6A-1944E2EF7BCB}.Release|x64.Build.0 = Release|x64 + {ED24E700-964E-B426-6A6A-1944E2EF7BCB}.Debug-DLL|Win32.ActiveCfg = Debug|Win32 + {ED24E700-964E-B426-6A6A-1944E2EF7BCB}.Debug-DLL|Win32.Build.0 = Debug|Win32 + {ED24E700-964E-B426-6A6A-1944E2EF7BCB}.Debug-DLL|x64.ActiveCfg = Debug|x64 + {ED24E700-964E-B426-6A6A-1944E2EF7BCB}.Debug-DLL|x64.Build.0 = Debug|x64 + {ED24E700-964E-B426-6A6A-1944E2EF7BCB}.Release-DLL|Win32.ActiveCfg = Release|Win32 + {ED24E700-964E-B426-6A6A-1944E2EF7BCB}.Release-DLL|Win32.Build.0 = Release|Win32 + {ED24E700-964E-B426-6A6A-1944E2EF7BCB}.Release-DLL|x64.ActiveCfg = Release|x64 + {ED24E700-964E-B426-6A6A-1944E2EF7BCB}.Release-DLL|x64.Build.0 = Release|x64 {C32CA8A3-58E6-8EB9-B72F-C295547D36A6}.Debug|Win32.ActiveCfg = Debug|Win32 {C32CA8A3-58E6-8EB9-B72F-C295547D36A6}.Debug|x64.ActiveCfg = Debug|x64 {C32CA8A3-58E6-8EB9-B72F-C295547D36A6}.Release|Win32.ActiveCfg = Release|Win32 diff --git a/vsprojects/vcxproj/test/internal_api_canary_iomgr_test/internal_api_canary_iomgr_test.vcxproj b/vsprojects/vcxproj/test/internal_api_canary_iomgr_test/internal_api_canary_iomgr_test.vcxproj new file mode 100644 index 00000000000..11d89a01c15 --- /dev/null +++ b/vsprojects/vcxproj/test/internal_api_canary_iomgr_test/internal_api_canary_iomgr_test.vcxproj @@ -0,0 +1,199 @@ + + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {28AE726B-1BFB-202B-48D2-41AF9D09B9EA} + true + $(SolutionDir)IntDir\$(MSBuildProjectName)\ + + + + v100 + + + v110 + + + v120 + + + v140 + + + Application + true + Unicode + + + Application + false + true + Unicode + + + + + + + + + + + + + + internal_api_canary_iomgr_test + static + Debug + static + Debug + + + internal_api_canary_iomgr_test + static + Release + static + Release + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreadedDebug + true + None + false + + + Console + true + false + + + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreadedDebug + true + None + false + + + Console + true + false + + + + + + NotUsing + Level3 + MaxSpeed + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + true + true + MultiThreaded + true + None + false + + + Console + true + false + true + true + + + + + + NotUsing + Level3 + MaxSpeed + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + true + true + MultiThreaded + true + None + false + + + Console + true + false + true + true + + + + + + + + + + {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} + + + {29D16885-7228-4C31-81ED-5F9187C7F2A9} + + + {EAB0A629-17A9-44DB-B5FF-E91A721FE037} + + + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + diff --git a/vsprojects/vcxproj/test/internal_api_canary_iomgr_test/internal_api_canary_iomgr_test.vcxproj.filters b/vsprojects/vcxproj/test/internal_api_canary_iomgr_test/internal_api_canary_iomgr_test.vcxproj.filters new file mode 100644 index 00000000000..f1ee82d1f4c --- /dev/null +++ b/vsprojects/vcxproj/test/internal_api_canary_iomgr_test/internal_api_canary_iomgr_test.vcxproj.filters @@ -0,0 +1,21 @@ + + + + + test\core\internal_api_canaries + + + + + + {881986d1-d1fe-b377-cf26-b3377af95009} + + + {4f9a544e-5680-18ee-30d7-38179bf82cee} + + + {6ab29f78-ec9d-d63a-8e8f-0d7552b3edd4} + + + + diff --git a/vsprojects/vcxproj/test/internal_api_canary_support_test/internal_api_canary_support_test.vcxproj b/vsprojects/vcxproj/test/internal_api_canary_support_test/internal_api_canary_support_test.vcxproj new file mode 100644 index 00000000000..59092dc2b3c --- /dev/null +++ b/vsprojects/vcxproj/test/internal_api_canary_support_test/internal_api_canary_support_test.vcxproj @@ -0,0 +1,199 @@ + + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {D53575C6-713C-E6E3-FD74-E65F20916498} + true + $(SolutionDir)IntDir\$(MSBuildProjectName)\ + + + + v100 + + + v110 + + + v120 + + + v140 + + + Application + true + Unicode + + + Application + false + true + Unicode + + + + + + + + + + + + + + internal_api_canary_support_test + static + Debug + static + Debug + + + internal_api_canary_support_test + static + Release + static + Release + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreadedDebug + true + None + false + + + Console + true + false + + + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreadedDebug + true + None + false + + + Console + true + false + + + + + + NotUsing + Level3 + MaxSpeed + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + true + true + MultiThreaded + true + None + false + + + Console + true + false + true + true + + + + + + NotUsing + Level3 + MaxSpeed + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + true + true + MultiThreaded + true + None + false + + + Console + true + false + true + true + + + + + + + + + + {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} + + + {29D16885-7228-4C31-81ED-5F9187C7F2A9} + + + {EAB0A629-17A9-44DB-B5FF-E91A721FE037} + + + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + diff --git a/vsprojects/vcxproj/test/internal_api_canary_support_test/internal_api_canary_support_test.vcxproj.filters b/vsprojects/vcxproj/test/internal_api_canary_support_test/internal_api_canary_support_test.vcxproj.filters new file mode 100644 index 00000000000..f7f4e3200ed --- /dev/null +++ b/vsprojects/vcxproj/test/internal_api_canary_support_test/internal_api_canary_support_test.vcxproj.filters @@ -0,0 +1,21 @@ + + + + + test\core\internal_api_canaries + + + + + + {a6c31cba-af9d-78ea-8980-8b77c9fc4485} + + + {d84283b8-4529-6c09-18bf-20a69f14f7ab} + + + {ea379f93-9285-7180-0d69-24a56da2b201} + + + + diff --git a/vsprojects/vcxproj/test/internal_api_canary_transport_test/internal_api_canary_transport_test.vcxproj b/vsprojects/vcxproj/test/internal_api_canary_transport_test/internal_api_canary_transport_test.vcxproj new file mode 100644 index 00000000000..110f7e3b048 --- /dev/null +++ b/vsprojects/vcxproj/test/internal_api_canary_transport_test/internal_api_canary_transport_test.vcxproj @@ -0,0 +1,199 @@ + + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {ED24E700-964E-B426-6A6A-1944E2EF7BCB} + true + $(SolutionDir)IntDir\$(MSBuildProjectName)\ + + + + v100 + + + v110 + + + v120 + + + v140 + + + Application + true + Unicode + + + Application + false + true + Unicode + + + + + + + + + + + + + + internal_api_canary_transport_test + static + Debug + static + Debug + + + internal_api_canary_transport_test + static + Release + static + Release + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreadedDebug + true + None + false + + + Console + true + false + + + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + MultiThreadedDebug + true + None + false + + + Console + true + false + + + + + + NotUsing + Level3 + MaxSpeed + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + true + true + MultiThreaded + true + None + false + + + Console + true + false + true + true + + + + + + NotUsing + Level3 + MaxSpeed + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + true + true + MultiThreaded + true + None + false + + + Console + true + false + true + true + + + + + + + + + + {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} + + + {29D16885-7228-4C31-81ED-5F9187C7F2A9} + + + {EAB0A629-17A9-44DB-B5FF-E91A721FE037} + + + {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + diff --git a/vsprojects/vcxproj/test/internal_api_canary_transport_test/internal_api_canary_transport_test.vcxproj.filters b/vsprojects/vcxproj/test/internal_api_canary_transport_test/internal_api_canary_transport_test.vcxproj.filters new file mode 100644 index 00000000000..1e0b4c5557e --- /dev/null +++ b/vsprojects/vcxproj/test/internal_api_canary_transport_test/internal_api_canary_transport_test.vcxproj.filters @@ -0,0 +1,21 @@ + + + + + test\core\internal_api_canaries + + + + + + {38e59e26-aad9-60fd-a1a7-c8fd9b606e2f} + + + {79aad60f-59b8-09e2-2cad-5b5e083ac008} + + + {e4f0214e-e3ec-b5b8-c00b-2932b5ec2422} + + + + From 2a577fb7936ad33793cbbd652b496209382a8c17 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 15 Mar 2016 16:44:34 -0700 Subject: [PATCH 14/36] clang-format --- test/core/internal_api_canaries/iomgr.c | 7 +++---- test/core/internal_api_canaries/transport.c | 13 +++++-------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/test/core/internal_api_canaries/iomgr.c b/test/core/internal_api_canaries/iomgr.c index 3b1a1bb8994..cd74ccc562f 100644 --- a/test/core/internal_api_canaries/iomgr.c +++ b/test/core/internal_api_canaries/iomgr.c @@ -80,10 +80,9 @@ static void test_code(void) { grpc_endpoint endpoint; grpc_endpoint_vtable vtable = { - grpc_endpoint_read, grpc_endpoint_write, - grpc_endpoint_add_to_pollset, grpc_endpoint_add_to_pollset_set, - grpc_endpoint_shutdown, grpc_endpoint_destroy, - grpc_endpoint_get_peer}; + grpc_endpoint_read, grpc_endpoint_write, grpc_endpoint_add_to_pollset, + grpc_endpoint_add_to_pollset_set, grpc_endpoint_shutdown, + grpc_endpoint_destroy, grpc_endpoint_get_peer}; endpoint.vtable = &vtable; /* exec_ctx.h */ diff --git a/test/core/internal_api_canaries/transport.c b/test/core/internal_api_canaries/transport.c index 474a8a11ec0..006d4cfd818 100644 --- a/test/core/internal_api_canaries/transport.c +++ b/test/core/internal_api_canaries/transport.c @@ -45,14 +45,11 @@ static void test_code(void) { /* transport_impl.h */ grpc_transport transport; - grpc_transport_vtable vtable = {12345, - grpc_transport_init_stream, - grpc_transport_set_pollset, - grpc_transport_perform_stream_op, - grpc_transport_perform_op, - grpc_transport_destroy_stream, - grpc_transport_destroy, - grpc_transport_get_peer}; + grpc_transport_vtable vtable = { + 12345, grpc_transport_init_stream, grpc_transport_set_pollset, + grpc_transport_perform_stream_op, grpc_transport_perform_op, + grpc_transport_destroy_stream, grpc_transport_destroy, + grpc_transport_get_peer}; transport.vtable = &vtable; /* transport.h */ From 28457cb007413381bdf30540c58acbea91ba81eb Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 22 Mar 2016 16:51:14 -0700 Subject: [PATCH 15/36] clang-fmt --- src/core/transport/chttp2_transport.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c index c3d03cc93a2..f1a6deb4b90 100644 --- a/src/core/transport/chttp2_transport.c +++ b/src/core/transport/chttp2_transport.c @@ -1423,8 +1423,8 @@ static void recv_data(grpc_exec_ctx *exec_ctx, void *tp, bool success) { gpr_mu_unlock(&t->mu); GPR_TIMER_BEGIN("recv_data.parse", 0); for (; i < t->read_buffer.count && - grpc_chttp2_perform_read(exec_ctx, transport_parsing, - t->read_buffer.slices[i]); + grpc_chttp2_perform_read(exec_ctx, transport_parsing, + t->read_buffer.slices[i]); i++) ; GPR_TIMER_END("recv_data.parse", 0); @@ -1499,10 +1499,9 @@ static void connectivity_state_set( grpc_connectivity_state state, const char *reason) { GRPC_CHTTP2_IF_TRACING( gpr_log(GPR_DEBUG, "set connectivity_state=%d", state)); - grpc_connectivity_state_set( - exec_ctx, - &TRANSPORT_FROM_GLOBAL(transport_global)->channel_callback.state_tracker, - state, reason); + grpc_connectivity_state_set(exec_ctx, &TRANSPORT_FROM_GLOBAL(transport_global) + ->channel_callback.state_tracker, + state, reason); } /******************************************************************************* @@ -1782,15 +1781,10 @@ static char *chttp2_get_peer(grpc_exec_ctx *exec_ctx, grpc_transport *t) { return gpr_strdup(((grpc_chttp2_transport *)t)->peer_string); } -static const grpc_transport_vtable vtable = {sizeof(grpc_chttp2_stream), - "chttp2", - init_stream, - set_pollset, - perform_stream_op, - perform_transport_op, - destroy_stream, - destroy_transport, - chttp2_get_peer}; +static const grpc_transport_vtable vtable = { + sizeof(grpc_chttp2_stream), "chttp2", init_stream, set_pollset, + perform_stream_op, perform_transport_op, destroy_stream, destroy_transport, + chttp2_get_peer}; grpc_transport *grpc_create_chttp2_transport( grpc_exec_ctx *exec_ctx, const grpc_channel_args *channel_args, From 273a9cece07913cfe350984d4bad85772529cda7 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 23 Mar 2016 14:44:31 -0700 Subject: [PATCH 16/36] Fix copyrights --- src/core/transport/chttp2/frame_data.c | 2 +- src/core/transport/chttp2/frame_rst_stream.c | 2 +- src/core/transport/chttp2/frame_window_update.c | 2 +- test/core/transport/chttp2/hpack_encoder_test.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/transport/chttp2/frame_data.c b/src/core/transport/chttp2/frame_data.c index 6c0b2af04b2..64c0b482ad7 100644 --- a/src/core/transport/chttp2/frame_data.c +++ b/src/core/transport/chttp2/frame_data.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/core/transport/chttp2/frame_rst_stream.c b/src/core/transport/chttp2/frame_rst_stream.c index 8063dfbb211..a5655ce79ba 100644 --- a/src/core/transport/chttp2/frame_rst_stream.c +++ b/src/core/transport/chttp2/frame_rst_stream.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/core/transport/chttp2/frame_window_update.c b/src/core/transport/chttp2/frame_window_update.c index 4a6944eef78..f7ae6003c84 100644 --- a/src/core/transport/chttp2/frame_window_update.c +++ b/src/core/transport/chttp2/frame_window_update.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/test/core/transport/chttp2/hpack_encoder_test.c b/test/core/transport/chttp2/hpack_encoder_test.c index 32f60c10052..5222888a791 100644 --- a/test/core/transport/chttp2/hpack_encoder_test.c +++ b/test/core/transport/chttp2/hpack_encoder_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without From 968483ff955513c2bf8a41b56bf8ab5eeea379bc Mon Sep 17 00:00:00 2001 From: vjpai Date: Thu, 24 Mar 2016 09:31:16 -0700 Subject: [PATCH 17/36] Fix the #ifdef to align with the new unix socket ifdef in general --- src/core/surface/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/surface/init.c b/src/core/surface/init.c index 233572a9f34..bd58f1d0670 100644 --- a/src/core/surface/init.c +++ b/src/core/surface/init.c @@ -172,7 +172,7 @@ void grpc_init(void) { grpc_register_resolver_type(grpc_dns_resolver_factory_create()); grpc_register_resolver_type(grpc_ipv4_resolver_factory_create()); grpc_register_resolver_type(grpc_ipv6_resolver_factory_create()); -#ifdef GPR_POSIX_SOCKET +#ifdef GPR_HAVE_UNIX_SOCKET grpc_register_resolver_type(grpc_unix_resolver_factory_create()); #endif grpc_register_tracer("api", &grpc_api_trace); From 81dbf84ded56f5f0fe8884e0bc151167fd5bec1c Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Thu, 24 Mar 2016 10:34:27 -0700 Subject: [PATCH 18/36] Change empty function to an assert since calling this code would be very bad right now. Added a TODO --- src/core/iomgr/unix_sockets_posix_noop.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/iomgr/unix_sockets_posix_noop.c b/src/core/iomgr/unix_sockets_posix_noop.c index 045467bea4f..5e797dbdc45 100644 --- a/src/core/iomgr/unix_sockets_posix_noop.c +++ b/src/core/iomgr/unix_sockets_posix_noop.c @@ -35,7 +35,10 @@ #ifndef GPR_HAVE_UNIX_SOCKET -void grpc_create_socketpair_if_unix(int sv[2]) {} +void grpc_create_socketpair_if_unix(int sv[2]) { + // TODO(ahedberg): Please fill in an implementation for non-Unix-sockets case + GPR_ASSERT(0); +} grpc_resolved_addresses *grpc_resolve_unix_domain_address(const char *name) { return NULL; From 761f7bc3e4cb87af5521eae8803d27dbee64c958 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Thu, 24 Mar 2016 11:05:48 -0700 Subject: [PATCH 19/36] Fix todo, do not explicitly mark assignment --- src/core/iomgr/unix_sockets_posix_noop.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/iomgr/unix_sockets_posix_noop.c b/src/core/iomgr/unix_sockets_posix_noop.c index 5e797dbdc45..d899b46093e 100644 --- a/src/core/iomgr/unix_sockets_posix_noop.c +++ b/src/core/iomgr/unix_sockets_posix_noop.c @@ -36,7 +36,9 @@ #ifndef GPR_HAVE_UNIX_SOCKET void grpc_create_socketpair_if_unix(int sv[2]) { - // TODO(ahedberg): Please fill in an implementation for non-Unix-sockets case + // TODO: Either implement this for the non-Unix socket case or make + // sure that it is never called in any such case. Until then, leave an + // assertion to notify if this gets called inadvertently GPR_ASSERT(0); } From ac9a6031f370dbc480f4adb158389d9dc877e0b5 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 28 Mar 2016 08:50:30 -0700 Subject: [PATCH 20/36] Sprinkle constants here and there --- src/core/transport/chttp2/frame_data.c | 5 +++-- src/core/transport/chttp2/frame_rst_stream.c | 5 +++-- src/core/transport/chttp2/frame_window_update.c | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/core/transport/chttp2/frame_data.c b/src/core/transport/chttp2/frame_data.c index 64c0b482ad7..39ec084e9ac 100644 --- a/src/core/transport/chttp2/frame_data.c +++ b/src/core/transport/chttp2/frame_data.c @@ -117,8 +117,9 @@ void grpc_chttp2_encode_data(uint32_t id, gpr_slice_buffer *inbuf, gpr_slice_buffer *outbuf) { gpr_slice hdr; uint8_t *p; + static const size_t header_size = 9; - hdr = gpr_slice_malloc(9); + hdr = gpr_slice_malloc(header_size); p = GPR_SLICE_START_PTR(hdr); GPR_ASSERT(write_bytes < (1 << 24)); *p++ = (uint8_t)(write_bytes >> 16); @@ -134,7 +135,7 @@ void grpc_chttp2_encode_data(uint32_t id, gpr_slice_buffer *inbuf, gpr_slice_buffer_move_first(inbuf, write_bytes, outbuf); - stats->framing_bytes += 9; + stats->framing_bytes += header_size; stats->data_bytes += write_bytes; } diff --git a/src/core/transport/chttp2/frame_rst_stream.c b/src/core/transport/chttp2/frame_rst_stream.c index a5655ce79ba..f87d2e58dd5 100644 --- a/src/core/transport/chttp2/frame_rst_stream.c +++ b/src/core/transport/chttp2/frame_rst_stream.c @@ -40,8 +40,9 @@ gpr_slice grpc_chttp2_rst_stream_create(uint32_t id, uint32_t code, grpc_transport_one_way_stats *stats) { - gpr_slice slice = gpr_slice_malloc(13); - stats->framing_bytes += 13; + static const size_t frame_size = 13; + gpr_slice slice = gpr_slice_malloc(frame_size); + stats->framing_bytes += frame_size; uint8_t *p = GPR_SLICE_START_PTR(slice); *p++ = 0; diff --git a/src/core/transport/chttp2/frame_window_update.c b/src/core/transport/chttp2/frame_window_update.c index f7ae6003c84..301e6a10de4 100644 --- a/src/core/transport/chttp2/frame_window_update.c +++ b/src/core/transport/chttp2/frame_window_update.c @@ -38,8 +38,9 @@ gpr_slice grpc_chttp2_window_update_create( uint32_t id, uint32_t window_update, grpc_transport_one_way_stats *stats) { - gpr_slice slice = gpr_slice_malloc(13); - stats->header_bytes += 13; + static const size_t frame_size = 13; + gpr_slice slice = gpr_slice_malloc(frame_size); + stats->header_bytes += frame_size; uint8_t *p = GPR_SLICE_START_PTR(slice); GPR_ASSERT(window_update); From 14e0d9862fac27558372ce4703787af6426189af Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 28 Mar 2016 17:11:26 -0700 Subject: [PATCH 21/36] Begin optionalizing lb policies: initial code movement --- BUILD | 48 +++++++++---------- Makefile | 16 +++---- binding.gyp | 8 ++-- build.yaml | 16 +++---- config.m4 | 10 ++-- gRPC.podspec | 24 +++++----- grpc.gemspec | 16 +++---- package.json | 16 +++---- package.xml | 16 +++---- .../lb_policy/grpclb}/load_balancer_api.c | 2 +- .../lb_policy/grpclb}/load_balancer_api.h | 2 +- .../proto/grpc/lb/v0/load_balancer.pb.c | 2 +- .../proto/grpc/lb/v0/load_balancer.pb.h | 0 .../lb_policy/pick_first}/pick_first.c | 2 +- .../lb_policy/pick_first}/pick_first.h | 0 .../lb_policy/round_robin}/round_robin.c | 2 +- .../lb_policy/round_robin}/round_robin.h | 0 src/core/lib/surface/init.c | 4 +- src/python/grpcio/grpc_core_dependencies.py | 8 ++-- test/core/client_config/lb_policies_test.c | 2 +- test/cpp/grpclb/grpclb_api_test.cc | 2 +- .../codegen/core/gen_load_balancing_proto.sh | 4 +- tools/distrib/check_include_guards.py | 2 +- tools/distrib/check_nanopb_output.sh | 4 +- tools/doxygen/Doxyfile.core.internal | 16 +++---- tools/run_tests/sources_and_headers.json | 48 +++++++++---------- 26 files changed, 135 insertions(+), 135 deletions(-) rename src/core/{lib/client_config/lb_policies => ext/lb_policy/grpclb}/load_balancer_api.c (98%) rename src/core/{lib/client_config/lb_policies => ext/lb_policy/grpclb}/load_balancer_api.h (97%) rename src/core/{lib => ext/lb_policy/grpclb}/proto/grpc/lb/v0/load_balancer.pb.c (98%) rename src/core/{lib => ext/lb_policy/grpclb}/proto/grpc/lb/v0/load_balancer.pb.h (100%) rename src/core/{lib/client_config/lb_policies => ext/lb_policy/pick_first}/pick_first.c (99%) rename src/core/{lib/client_config/lb_policies => ext/lb_policy/pick_first}/pick_first.h (100%) rename src/core/{lib/client_config/lb_policies => ext/lb_policy/round_robin}/round_robin.c (99%) rename src/core/{lib/client_config/lb_policies => ext/lb_policy/round_robin}/round_robin.h (100%) diff --git a/BUILD b/BUILD index 52d1d5a69f0..cd33480b85b 100644 --- a/BUILD +++ b/BUILD @@ -196,9 +196,9 @@ cc_library( "src/core/lib/client_config/client_config.h", "src/core/lib/client_config/connector.h", "src/core/lib/client_config/initial_connect_string.h", - "src/core/lib/client_config/lb_policies/load_balancer_api.h", - "src/core/lib/client_config/lb_policies/pick_first.h", - "src/core/lib/client_config/lb_policies/round_robin.h", + "src/core/ext/lb_policy/grpclb/load_balancer_api.h", + "src/core/ext/lb_policy/pick_first/pick_first.h", + "src/core/ext/lb_policy/round_robin/round_robin.h", "src/core/lib/client_config/lb_policy.h", "src/core/lib/client_config/lb_policy_factory.h", "src/core/lib/client_config/lb_policy_registry.h", @@ -258,7 +258,7 @@ cc_library( "src/core/lib/json/json_common.h", "src/core/lib/json/json_reader.h", "src/core/lib/json/json_writer.h", - "src/core/lib/proto/grpc/lb/v0/load_balancer.pb.h", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", "src/core/lib/security/auth_filters.h", "src/core/lib/security/b64.h", "src/core/lib/security/credentials.h", @@ -345,9 +345,9 @@ cc_library( "src/core/lib/client_config/connector.c", "src/core/lib/client_config/default_initial_connect_string.c", "src/core/lib/client_config/initial_connect_string.c", - "src/core/lib/client_config/lb_policies/load_balancer_api.c", - "src/core/lib/client_config/lb_policies/pick_first.c", - "src/core/lib/client_config/lb_policies/round_robin.c", + "src/core/ext/lb_policy/grpclb/load_balancer_api.c", + "src/core/ext/lb_policy/pick_first/pick_first.c", + "src/core/ext/lb_policy/round_robin/round_robin.c", "src/core/lib/client_config/lb_policy.c", "src/core/lib/client_config/lb_policy_factory.c", "src/core/lib/client_config/lb_policy_registry.c", @@ -413,7 +413,7 @@ cc_library( "src/core/lib/json/json_reader.c", "src/core/lib/json/json_string.c", "src/core/lib/json/json_writer.c", - "src/core/lib/proto/grpc/lb/v0/load_balancer.pb.c", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", "src/core/lib/security/b64.c", "src/core/lib/security/client_auth_filter.c", "src/core/lib/security/credentials.c", @@ -571,9 +571,9 @@ cc_library( "src/core/lib/client_config/client_config.h", "src/core/lib/client_config/connector.h", "src/core/lib/client_config/initial_connect_string.h", - "src/core/lib/client_config/lb_policies/load_balancer_api.h", - "src/core/lib/client_config/lb_policies/pick_first.h", - "src/core/lib/client_config/lb_policies/round_robin.h", + "src/core/ext/lb_policy/grpclb/load_balancer_api.h", + "src/core/ext/lb_policy/pick_first/pick_first.h", + "src/core/ext/lb_policy/round_robin/round_robin.h", "src/core/lib/client_config/lb_policy.h", "src/core/lib/client_config/lb_policy_factory.h", "src/core/lib/client_config/lb_policy_registry.h", @@ -633,7 +633,7 @@ cc_library( "src/core/lib/json/json_common.h", "src/core/lib/json/json_reader.h", "src/core/lib/json/json_writer.h", - "src/core/lib/proto/grpc/lb/v0/load_balancer.pb.h", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", "src/core/lib/statistics/census_interface.h", "src/core/lib/statistics/census_rpc_stats.h", "src/core/lib/surface/api_trace.h", @@ -704,9 +704,9 @@ cc_library( "src/core/lib/client_config/connector.c", "src/core/lib/client_config/default_initial_connect_string.c", "src/core/lib/client_config/initial_connect_string.c", - "src/core/lib/client_config/lb_policies/load_balancer_api.c", - "src/core/lib/client_config/lb_policies/pick_first.c", - "src/core/lib/client_config/lb_policies/round_robin.c", + "src/core/ext/lb_policy/grpclb/load_balancer_api.c", + "src/core/ext/lb_policy/pick_first/pick_first.c", + "src/core/ext/lb_policy/round_robin/round_robin.c", "src/core/lib/client_config/lb_policy.c", "src/core/lib/client_config/lb_policy_factory.c", "src/core/lib/client_config/lb_policy_registry.c", @@ -771,7 +771,7 @@ cc_library( "src/core/lib/json/json_reader.c", "src/core/lib/json/json_string.c", "src/core/lib/json/json_writer.c", - "src/core/lib/proto/grpc/lb/v0/load_balancer.pb.c", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", "src/core/lib/surface/alarm.c", "src/core/lib/surface/api_trace.c", "src/core/lib/surface/byte_buffer.c", @@ -1407,9 +1407,9 @@ objc_library( "src/core/lib/client_config/connector.c", "src/core/lib/client_config/default_initial_connect_string.c", "src/core/lib/client_config/initial_connect_string.c", - "src/core/lib/client_config/lb_policies/load_balancer_api.c", - "src/core/lib/client_config/lb_policies/pick_first.c", - "src/core/lib/client_config/lb_policies/round_robin.c", + "src/core/ext/lb_policy/grpclb/load_balancer_api.c", + "src/core/ext/lb_policy/pick_first/pick_first.c", + "src/core/ext/lb_policy/round_robin/round_robin.c", "src/core/lib/client_config/lb_policy.c", "src/core/lib/client_config/lb_policy_factory.c", "src/core/lib/client_config/lb_policy_registry.c", @@ -1475,7 +1475,7 @@ objc_library( "src/core/lib/json/json_reader.c", "src/core/lib/json/json_string.c", "src/core/lib/json/json_writer.c", - "src/core/lib/proto/grpc/lb/v0/load_balancer.pb.c", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", "src/core/lib/security/b64.c", "src/core/lib/security/client_auth_filter.c", "src/core/lib/security/credentials.c", @@ -1578,9 +1578,9 @@ objc_library( "src/core/lib/client_config/client_config.h", "src/core/lib/client_config/connector.h", "src/core/lib/client_config/initial_connect_string.h", - "src/core/lib/client_config/lb_policies/load_balancer_api.h", - "src/core/lib/client_config/lb_policies/pick_first.h", - "src/core/lib/client_config/lb_policies/round_robin.h", + "src/core/ext/lb_policy/grpclb/load_balancer_api.h", + "src/core/ext/lb_policy/pick_first/pick_first.h", + "src/core/ext/lb_policy/round_robin/round_robin.h", "src/core/lib/client_config/lb_policy.h", "src/core/lib/client_config/lb_policy_factory.h", "src/core/lib/client_config/lb_policy_registry.h", @@ -1640,7 +1640,7 @@ objc_library( "src/core/lib/json/json_common.h", "src/core/lib/json/json_reader.h", "src/core/lib/json/json_writer.h", - "src/core/lib/proto/grpc/lb/v0/load_balancer.pb.h", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", "src/core/lib/security/auth_filters.h", "src/core/lib/security/b64.h", "src/core/lib/security/credentials.h", diff --git a/Makefile b/Makefile index 3773a8091cd..2ab4e7903e5 100644 --- a/Makefile +++ b/Makefile @@ -2467,9 +2467,9 @@ LIBGRPC_SRC = \ src/core/lib/client_config/connector.c \ src/core/lib/client_config/default_initial_connect_string.c \ src/core/lib/client_config/initial_connect_string.c \ - src/core/lib/client_config/lb_policies/load_balancer_api.c \ - src/core/lib/client_config/lb_policies/pick_first.c \ - src/core/lib/client_config/lb_policies/round_robin.c \ + src/core/ext/lb_policy/grpclb/load_balancer_api.c \ + src/core/ext/lb_policy/pick_first/pick_first.c \ + src/core/ext/lb_policy/round_robin/round_robin.c \ src/core/lib/client_config/lb_policy.c \ src/core/lib/client_config/lb_policy_factory.c \ src/core/lib/client_config/lb_policy_registry.c \ @@ -2535,7 +2535,7 @@ LIBGRPC_SRC = \ src/core/lib/json/json_reader.c \ src/core/lib/json/json_string.c \ src/core/lib/json/json_writer.c \ - src/core/lib/proto/grpc/lb/v0/load_balancer.pb.c \ + src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c \ src/core/lib/security/b64.c \ src/core/lib/security/client_auth_filter.c \ src/core/lib/security/credentials.c \ @@ -2826,9 +2826,9 @@ LIBGRPC_UNSECURE_SRC = \ src/core/lib/client_config/connector.c \ src/core/lib/client_config/default_initial_connect_string.c \ src/core/lib/client_config/initial_connect_string.c \ - src/core/lib/client_config/lb_policies/load_balancer_api.c \ - src/core/lib/client_config/lb_policies/pick_first.c \ - src/core/lib/client_config/lb_policies/round_robin.c \ + src/core/ext/lb_policy/grpclb/load_balancer_api.c \ + src/core/ext/lb_policy/pick_first/pick_first.c \ + src/core/ext/lb_policy/round_robin/round_robin.c \ src/core/lib/client_config/lb_policy.c \ src/core/lib/client_config/lb_policy_factory.c \ src/core/lib/client_config/lb_policy_registry.c \ @@ -2893,7 +2893,7 @@ LIBGRPC_UNSECURE_SRC = \ src/core/lib/json/json_reader.c \ src/core/lib/json/json_string.c \ src/core/lib/json/json_writer.c \ - src/core/lib/proto/grpc/lb/v0/load_balancer.pb.c \ + src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c \ src/core/lib/surface/alarm.c \ src/core/lib/surface/api_trace.c \ src/core/lib/surface/byte_buffer.c \ diff --git a/binding.gyp b/binding.gyp index a1cdf2ec366..1d18c8e7378 100644 --- a/binding.gyp +++ b/binding.gyp @@ -605,9 +605,9 @@ 'src/core/lib/client_config/connector.c', 'src/core/lib/client_config/default_initial_connect_string.c', 'src/core/lib/client_config/initial_connect_string.c', - 'src/core/lib/client_config/lb_policies/load_balancer_api.c', - 'src/core/lib/client_config/lb_policies/pick_first.c', - 'src/core/lib/client_config/lb_policies/round_robin.c', + 'src/core/ext/lb_policy/grpclb/load_balancer_api.c', + 'src/core/ext/lb_policy/pick_first/pick_first.c', + 'src/core/ext/lb_policy/round_robin/round_robin.c', 'src/core/lib/client_config/lb_policy.c', 'src/core/lib/client_config/lb_policy_factory.c', 'src/core/lib/client_config/lb_policy_registry.c', @@ -673,7 +673,7 @@ 'src/core/lib/json/json_reader.c', 'src/core/lib/json/json_string.c', 'src/core/lib/json/json_writer.c', - 'src/core/lib/proto/grpc/lb/v0/load_balancer.pb.c', + 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c', 'src/core/lib/security/b64.c', 'src/core/lib/security/client_auth_filter.c', 'src/core/lib/security/credentials.c', diff --git a/build.yaml b/build.yaml index c16712ea5a8..749aabceb5f 100644 --- a/build.yaml +++ b/build.yaml @@ -262,9 +262,9 @@ filegroups: - src/core/lib/client_config/client_config.h - src/core/lib/client_config/connector.h - src/core/lib/client_config/initial_connect_string.h - - src/core/lib/client_config/lb_policies/load_balancer_api.h - - src/core/lib/client_config/lb_policies/pick_first.h - - src/core/lib/client_config/lb_policies/round_robin.h + - src/core/ext/lb_policy/grpclb/load_balancer_api.h + - src/core/ext/lb_policy/pick_first/pick_first.h + - src/core/ext/lb_policy/round_robin/round_robin.h - src/core/lib/client_config/lb_policy.h - src/core/lib/client_config/lb_policy_factory.h - src/core/lib/client_config/lb_policy_registry.h @@ -324,7 +324,7 @@ filegroups: - src/core/lib/json/json_common.h - src/core/lib/json/json_reader.h - src/core/lib/json/json_writer.h - - src/core/lib/proto/grpc/lb/v0/load_balancer.pb.h + - src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h - src/core/lib/statistics/census_interface.h - src/core/lib/statistics/census_rpc_stats.h - src/core/lib/surface/api_trace.h @@ -363,9 +363,9 @@ filegroups: - src/core/lib/client_config/connector.c - src/core/lib/client_config/default_initial_connect_string.c - src/core/lib/client_config/initial_connect_string.c - - src/core/lib/client_config/lb_policies/load_balancer_api.c - - src/core/lib/client_config/lb_policies/pick_first.c - - src/core/lib/client_config/lb_policies/round_robin.c + - src/core/ext/lb_policy/grpclb/load_balancer_api.c + - src/core/ext/lb_policy/pick_first/pick_first.c + - src/core/ext/lb_policy/round_robin/round_robin.c - src/core/lib/client_config/lb_policy.c - src/core/lib/client_config/lb_policy_factory.c - src/core/lib/client_config/lb_policy_registry.c @@ -430,7 +430,7 @@ filegroups: - src/core/lib/json/json_reader.c - src/core/lib/json/json_string.c - src/core/lib/json/json_writer.c - - src/core/lib/proto/grpc/lb/v0/load_balancer.pb.c + - src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c - src/core/lib/surface/alarm.c - src/core/lib/surface/api_trace.c - src/core/lib/surface/byte_buffer.c diff --git a/config.m4 b/config.m4 index 653b2870677..fa249a99be1 100644 --- a/config.m4 +++ b/config.m4 @@ -127,9 +127,9 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/client_config/connector.c \ src/core/lib/client_config/default_initial_connect_string.c \ src/core/lib/client_config/initial_connect_string.c \ - src/core/lib/client_config/lb_policies/load_balancer_api.c \ - src/core/lib/client_config/lb_policies/pick_first.c \ - src/core/lib/client_config/lb_policies/round_robin.c \ + src/core/ext/lb_policy/grpclb/load_balancer_api.c \ + src/core/ext/lb_policy/pick_first/pick_first.c \ + src/core/ext/lb_policy/round_robin/round_robin.c \ src/core/lib/client_config/lb_policy.c \ src/core/lib/client_config/lb_policy_factory.c \ src/core/lib/client_config/lb_policy_registry.c \ @@ -195,7 +195,7 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/json/json_reader.c \ src/core/lib/json/json_string.c \ src/core/lib/json/json_writer.c \ - src/core/lib/proto/grpc/lb/v0/load_balancer.pb.c \ + src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c \ src/core/lib/security/b64.c \ src/core/lib/security/client_auth_filter.c \ src/core/lib/security/credentials.c \ @@ -562,7 +562,7 @@ if test "$PHP_GRPC" != "no"; then PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/iomgr) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/json) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/profiling) - PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/proto/grpc/lb/v0) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/security) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/support) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/surface) diff --git a/gRPC.podspec b/gRPC.podspec index 08330eb8e18..feedfdc9714 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -200,9 +200,9 @@ Pod::Spec.new do |s| 'src/core/lib/client_config/client_config.h', 'src/core/lib/client_config/connector.h', 'src/core/lib/client_config/initial_connect_string.h', - 'src/core/lib/client_config/lb_policies/load_balancer_api.h', - 'src/core/lib/client_config/lb_policies/pick_first.h', - 'src/core/lib/client_config/lb_policies/round_robin.h', + 'src/core/ext/lb_policy/grpclb/load_balancer_api.h', + 'src/core/ext/lb_policy/pick_first/pick_first.h', + 'src/core/ext/lb_policy/round_robin/round_robin.h', 'src/core/lib/client_config/lb_policy.h', 'src/core/lib/client_config/lb_policy_factory.h', 'src/core/lib/client_config/lb_policy_registry.h', @@ -262,7 +262,7 @@ Pod::Spec.new do |s| 'src/core/lib/json/json_common.h', 'src/core/lib/json/json_reader.h', 'src/core/lib/json/json_writer.h', - 'src/core/lib/proto/grpc/lb/v0/load_balancer.pb.h', + 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h', 'src/core/lib/security/auth_filters.h', 'src/core/lib/security/b64.h', 'src/core/lib/security/credentials.h', @@ -362,9 +362,9 @@ Pod::Spec.new do |s| 'src/core/lib/client_config/connector.c', 'src/core/lib/client_config/default_initial_connect_string.c', 'src/core/lib/client_config/initial_connect_string.c', - 'src/core/lib/client_config/lb_policies/load_balancer_api.c', - 'src/core/lib/client_config/lb_policies/pick_first.c', - 'src/core/lib/client_config/lb_policies/round_robin.c', + 'src/core/ext/lb_policy/grpclb/load_balancer_api.c', + 'src/core/ext/lb_policy/pick_first/pick_first.c', + 'src/core/ext/lb_policy/round_robin/round_robin.c', 'src/core/lib/client_config/lb_policy.c', 'src/core/lib/client_config/lb_policy_factory.c', 'src/core/lib/client_config/lb_policy_registry.c', @@ -430,7 +430,7 @@ Pod::Spec.new do |s| 'src/core/lib/json/json_reader.c', 'src/core/lib/json/json_string.c', 'src/core/lib/json/json_writer.c', - 'src/core/lib/proto/grpc/lb/v0/load_balancer.pb.c', + 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c', 'src/core/lib/security/b64.c', 'src/core/lib/security/client_auth_filter.c', 'src/core/lib/security/credentials.c', @@ -531,9 +531,9 @@ Pod::Spec.new do |s| 'src/core/lib/client_config/client_config.h', 'src/core/lib/client_config/connector.h', 'src/core/lib/client_config/initial_connect_string.h', - 'src/core/lib/client_config/lb_policies/load_balancer_api.h', - 'src/core/lib/client_config/lb_policies/pick_first.h', - 'src/core/lib/client_config/lb_policies/round_robin.h', + 'src/core/ext/lb_policy/grpclb/load_balancer_api.h', + 'src/core/ext/lb_policy/pick_first/pick_first.h', + 'src/core/ext/lb_policy/round_robin/round_robin.h', 'src/core/lib/client_config/lb_policy.h', 'src/core/lib/client_config/lb_policy_factory.h', 'src/core/lib/client_config/lb_policy_registry.h', @@ -593,7 +593,7 @@ Pod::Spec.new do |s| 'src/core/lib/json/json_common.h', 'src/core/lib/json/json_reader.h', 'src/core/lib/json/json_writer.h', - 'src/core/lib/proto/grpc/lb/v0/load_balancer.pb.h', + 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h', 'src/core/lib/security/auth_filters.h', 'src/core/lib/security/b64.h', 'src/core/lib/security/credentials.h', diff --git a/grpc.gemspec b/grpc.gemspec index c516f5278f2..713a3f238fa 100755 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -196,9 +196,9 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/client_config/client_config.h ) s.files += %w( src/core/lib/client_config/connector.h ) s.files += %w( src/core/lib/client_config/initial_connect_string.h ) - s.files += %w( src/core/lib/client_config/lb_policies/load_balancer_api.h ) - s.files += %w( src/core/lib/client_config/lb_policies/pick_first.h ) - s.files += %w( src/core/lib/client_config/lb_policies/round_robin.h ) + s.files += %w( src/core/ext/lb_policy/grpclb/load_balancer_api.h ) + s.files += %w( src/core/ext/lb_policy/pick_first/pick_first.h ) + s.files += %w( src/core/ext/lb_policy/round_robin/round_robin.h ) s.files += %w( src/core/lib/client_config/lb_policy.h ) s.files += %w( src/core/lib/client_config/lb_policy_factory.h ) s.files += %w( src/core/lib/client_config/lb_policy_registry.h ) @@ -258,7 +258,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/json/json_common.h ) s.files += %w( src/core/lib/json/json_reader.h ) s.files += %w( src/core/lib/json/json_writer.h ) - s.files += %w( src/core/lib/proto/grpc/lb/v0/load_balancer.pb.h ) + s.files += %w( src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h ) s.files += %w( src/core/lib/security/auth_filters.h ) s.files += %w( src/core/lib/security/b64.h ) s.files += %w( src/core/lib/security/credentials.h ) @@ -345,9 +345,9 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/client_config/connector.c ) s.files += %w( src/core/lib/client_config/default_initial_connect_string.c ) s.files += %w( src/core/lib/client_config/initial_connect_string.c ) - s.files += %w( src/core/lib/client_config/lb_policies/load_balancer_api.c ) - s.files += %w( src/core/lib/client_config/lb_policies/pick_first.c ) - s.files += %w( src/core/lib/client_config/lb_policies/round_robin.c ) + s.files += %w( src/core/ext/lb_policy/grpclb/load_balancer_api.c ) + s.files += %w( src/core/ext/lb_policy/pick_first/pick_first.c ) + s.files += %w( src/core/ext/lb_policy/round_robin/round_robin.c ) s.files += %w( src/core/lib/client_config/lb_policy.c ) s.files += %w( src/core/lib/client_config/lb_policy_factory.c ) s.files += %w( src/core/lib/client_config/lb_policy_registry.c ) @@ -413,7 +413,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/json/json_reader.c ) s.files += %w( src/core/lib/json/json_string.c ) s.files += %w( src/core/lib/json/json_writer.c ) - s.files += %w( src/core/lib/proto/grpc/lb/v0/load_balancer.pb.c ) + s.files += %w( src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c ) s.files += %w( src/core/lib/security/b64.c ) s.files += %w( src/core/lib/security/client_auth_filter.c ) s.files += %w( src/core/lib/security/credentials.c ) diff --git a/package.json b/package.json index d430dfe28fc..ba3bb606ffc 100644 --- a/package.json +++ b/package.json @@ -138,9 +138,9 @@ "src/core/lib/client_config/client_config.h", "src/core/lib/client_config/connector.h", "src/core/lib/client_config/initial_connect_string.h", - "src/core/lib/client_config/lb_policies/load_balancer_api.h", - "src/core/lib/client_config/lb_policies/pick_first.h", - "src/core/lib/client_config/lb_policies/round_robin.h", + "src/core/ext/lb_policy/grpclb/load_balancer_api.h", + "src/core/ext/lb_policy/pick_first/pick_first.h", + "src/core/ext/lb_policy/round_robin/round_robin.h", "src/core/lib/client_config/lb_policy.h", "src/core/lib/client_config/lb_policy_factory.h", "src/core/lib/client_config/lb_policy_registry.h", @@ -200,7 +200,7 @@ "src/core/lib/json/json_common.h", "src/core/lib/json/json_reader.h", "src/core/lib/json/json_writer.h", - "src/core/lib/proto/grpc/lb/v0/load_balancer.pb.h", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", "src/core/lib/security/auth_filters.h", "src/core/lib/security/b64.h", "src/core/lib/security/credentials.h", @@ -287,9 +287,9 @@ "src/core/lib/client_config/connector.c", "src/core/lib/client_config/default_initial_connect_string.c", "src/core/lib/client_config/initial_connect_string.c", - "src/core/lib/client_config/lb_policies/load_balancer_api.c", - "src/core/lib/client_config/lb_policies/pick_first.c", - "src/core/lib/client_config/lb_policies/round_robin.c", + "src/core/ext/lb_policy/grpclb/load_balancer_api.c", + "src/core/ext/lb_policy/pick_first/pick_first.c", + "src/core/ext/lb_policy/round_robin/round_robin.c", "src/core/lib/client_config/lb_policy.c", "src/core/lib/client_config/lb_policy_factory.c", "src/core/lib/client_config/lb_policy_registry.c", @@ -355,7 +355,7 @@ "src/core/lib/json/json_reader.c", "src/core/lib/json/json_string.c", "src/core/lib/json/json_writer.c", - "src/core/lib/proto/grpc/lb/v0/load_balancer.pb.c", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", "src/core/lib/security/b64.c", "src/core/lib/security/client_auth_filter.c", "src/core/lib/security/credentials.c", diff --git a/package.xml b/package.xml index a40cd160ae5..9975360af95 100644 --- a/package.xml +++ b/package.xml @@ -200,9 +200,9 @@ - - - + + + @@ -262,7 +262,7 @@ - + @@ -349,9 +349,9 @@ - - - + + + @@ -417,7 +417,7 @@ - + diff --git a/src/core/lib/client_config/lb_policies/load_balancer_api.c b/src/core/ext/lb_policy/grpclb/load_balancer_api.c similarity index 98% rename from src/core/lib/client_config/lb_policies/load_balancer_api.c rename to src/core/ext/lb_policy/grpclb/load_balancer_api.c index 4cbed200df3..d8af644870d 100644 --- a/src/core/lib/client_config/lb_policies/load_balancer_api.c +++ b/src/core/ext/lb_policy/grpclb/load_balancer_api.c @@ -31,7 +31,7 @@ * */ -#include "src/core/lib/client_config/lb_policies/load_balancer_api.h" +#include "src/core/ext/lb_policy/grpclb/load_balancer_api.h" #include "third_party/nanopb/pb_decode.h" #include "third_party/nanopb/pb_encode.h" diff --git a/src/core/lib/client_config/lb_policies/load_balancer_api.h b/src/core/ext/lb_policy/grpclb/load_balancer_api.h similarity index 97% rename from src/core/lib/client_config/lb_policies/load_balancer_api.h rename to src/core/ext/lb_policy/grpclb/load_balancer_api.h index 83299adfa9d..c1af304f682 100644 --- a/src/core/lib/client_config/lb_policies/load_balancer_api.h +++ b/src/core/ext/lb_policy/grpclb/load_balancer_api.h @@ -37,7 +37,7 @@ #include #include "src/core/lib/client_config/lb_policy_factory.h" -#include "src/core/lib/proto/grpc/lb/v0/load_balancer.pb.h" +#include "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h" #ifdef __cplusplus extern "C" { diff --git a/src/core/lib/proto/grpc/lb/v0/load_balancer.pb.c b/src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c similarity index 98% rename from src/core/lib/proto/grpc/lb/v0/load_balancer.pb.c rename to src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c index 8f82141f96d..97196731810 100644 --- a/src/core/lib/proto/grpc/lb/v0/load_balancer.pb.c +++ b/src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c @@ -33,7 +33,7 @@ /* Automatically generated nanopb constant definitions */ /* Generated by nanopb-0.3.5-dev */ -#include "src/core/lib/proto/grpc/lb/v0/load_balancer.pb.h" +#include "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h" #if PB_PROTO_HEADER_VERSION != 30 #error Regenerate this file with the current version of nanopb generator. diff --git a/src/core/lib/proto/grpc/lb/v0/load_balancer.pb.h b/src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h similarity index 100% rename from src/core/lib/proto/grpc/lb/v0/load_balancer.pb.h rename to src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h diff --git a/src/core/lib/client_config/lb_policies/pick_first.c b/src/core/ext/lb_policy/pick_first/pick_first.c similarity index 99% rename from src/core/lib/client_config/lb_policies/pick_first.c rename to src/core/ext/lb_policy/pick_first/pick_first.c index 2e399b73f90..e1dae82c277 100644 --- a/src/core/lib/client_config/lb_policies/pick_first.c +++ b/src/core/ext/lb_policy/pick_first/pick_first.c @@ -31,7 +31,7 @@ * */ -#include "src/core/lib/client_config/lb_policies/pick_first.h" +#include "src/core/ext/lb_policy/pick_first/pick_first.h" #include "src/core/lib/client_config/lb_policy_factory.h" #include diff --git a/src/core/lib/client_config/lb_policies/pick_first.h b/src/core/ext/lb_policy/pick_first/pick_first.h similarity index 100% rename from src/core/lib/client_config/lb_policies/pick_first.h rename to src/core/ext/lb_policy/pick_first/pick_first.h diff --git a/src/core/lib/client_config/lb_policies/round_robin.c b/src/core/ext/lb_policy/round_robin/round_robin.c similarity index 99% rename from src/core/lib/client_config/lb_policies/round_robin.c rename to src/core/ext/lb_policy/round_robin/round_robin.c index c904c5f9215..31056ea1385 100644 --- a/src/core/lib/client_config/lb_policies/round_robin.c +++ b/src/core/ext/lb_policy/round_robin/round_robin.c @@ -31,7 +31,7 @@ * */ -#include "src/core/lib/client_config/lb_policies/round_robin.h" +#include "src/core/ext/lb_policy/round_robin/round_robin.h" #include diff --git a/src/core/lib/client_config/lb_policies/round_robin.h b/src/core/ext/lb_policy/round_robin/round_robin.h similarity index 100% rename from src/core/lib/client_config/lb_policies/round_robin.h rename to src/core/ext/lb_policy/round_robin/round_robin.h diff --git a/src/core/lib/surface/init.c b/src/core/lib/surface/init.c index dbfc8a9336e..5bf275b97a6 100644 --- a/src/core/lib/surface/init.c +++ b/src/core/lib/surface/init.c @@ -48,8 +48,8 @@ #include "src/core/lib/channel/connected_channel.h" #include "src/core/lib/channel/http_client_filter.h" #include "src/core/lib/channel/http_server_filter.h" -#include "src/core/lib/client_config/lb_policies/pick_first.h" -#include "src/core/lib/client_config/lb_policies/round_robin.h" +#include "src/core/ext/lb_policy/pick_first/pick_first.h" +#include "src/core/ext/lb_policy/round_robin/round_robin.h" #include "src/core/lib/client_config/lb_policy_registry.h" #include "src/core/lib/client_config/resolver_registry.h" #include "src/core/lib/client_config/resolvers/dns_resolver.h" diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 3c57ad71daa..509a45d29d1 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -121,9 +121,9 @@ CORE_SOURCE_FILES = [ 'src/core/lib/client_config/connector.c', 'src/core/lib/client_config/default_initial_connect_string.c', 'src/core/lib/client_config/initial_connect_string.c', - 'src/core/lib/client_config/lb_policies/load_balancer_api.c', - 'src/core/lib/client_config/lb_policies/pick_first.c', - 'src/core/lib/client_config/lb_policies/round_robin.c', + 'src/core/ext/lb_policy/grpclb/load_balancer_api.c', + 'src/core/ext/lb_policy/pick_first/pick_first.c', + 'src/core/ext/lb_policy/round_robin/round_robin.c', 'src/core/lib/client_config/lb_policy.c', 'src/core/lib/client_config/lb_policy_factory.c', 'src/core/lib/client_config/lb_policy_registry.c', @@ -189,7 +189,7 @@ CORE_SOURCE_FILES = [ 'src/core/lib/json/json_reader.c', 'src/core/lib/json/json_string.c', 'src/core/lib/json/json_writer.c', - 'src/core/lib/proto/grpc/lb/v0/load_balancer.pb.c', + 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c', 'src/core/lib/security/b64.c', 'src/core/lib/security/client_auth_filter.c', 'src/core/lib/security/credentials.c', diff --git a/test/core/client_config/lb_policies_test.c b/test/core/client_config/lb_policies_test.c index bae3e7d18cc..bd2f0e5e750 100644 --- a/test/core/client_config/lb_policies_test.c +++ b/test/core/client_config/lb_policies_test.c @@ -43,7 +43,7 @@ #include "src/core/lib/channel/channel_stack.h" #include "src/core/lib/channel/client_channel.h" -#include "src/core/lib/client_config/lb_policies/round_robin.h" +#include "src/core/ext/lb_policy/round_robin/round_robin.h" #include "src/core/lib/client_config/lb_policy_registry.h" #include "src/core/lib/support/string.h" #include "src/core/lib/surface/channel.h" diff --git a/test/cpp/grpclb/grpclb_api_test.cc b/test/cpp/grpclb/grpclb_api_test.cc index bc8219c1c7a..92f93c869c7 100644 --- a/test/cpp/grpclb/grpclb_api_test.cc +++ b/test/cpp/grpclb/grpclb_api_test.cc @@ -34,7 +34,7 @@ #include #include -#include "src/core/lib/client_config/lb_policies/load_balancer_api.h" +#include "src/core/ext/lb_policy/grpclb/load_balancer_api.h" #include "src/proto/grpc/lb/v0/load_balancer.pb.h" // C++ version namespace grpc { diff --git a/tools/codegen/core/gen_load_balancing_proto.sh b/tools/codegen/core/gen_load_balancing_proto.sh index 6a5363eeb32..339da0a7339 100755 --- a/tools/codegen/core/gen_load_balancing_proto.sh +++ b/tools/codegen/core/gen_load_balancing_proto.sh @@ -82,7 +82,7 @@ fi readonly GRPC_ROOT=$PWD -OUTPUT_DIR="$GRPC_ROOT/src/core/lib/proto/grpc/lb/v0" +OUTPUT_DIR="$GRPC_ROOT/src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0" if [ $# -eq 2 ]; then mkdir -p "$2" if [ $? != 0 ]; then @@ -122,7 +122,7 @@ protoc \ "$(basename $1)" readonly PROTO_BASENAME=$(basename $1 .proto) -sed -i "s:$PROTO_BASENAME.pb.h:src/core/lib/proto/grpc/lb/v0/$PROTO_BASENAME.pb.h:g" \ +sed -i "s:$PROTO_BASENAME.pb.h:src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/$PROTO_BASENAME.pb.h:g" \ "$OUTPUT_DIR/$PROTO_BASENAME.pb.c" # prepend copyright diff --git a/tools/distrib/check_include_guards.py b/tools/distrib/check_include_guards.py index 463e3168858..6406fe6ae70 100755 --- a/tools/distrib/check_include_guards.py +++ b/tools/distrib/check_include_guards.py @@ -167,7 +167,7 @@ argp.add_argument('--precommit', args = argp.parse_args() KNOWN_BAD = set([ - 'src/core/lib/proto/grpc/lb/v0/load_balancer.pb.h', + 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h', ]) diff --git a/tools/distrib/check_nanopb_output.sh b/tools/distrib/check_nanopb_output.sh index e0a60946a99..4032ae1d9db 100755 --- a/tools/distrib/check_nanopb_output.sh +++ b/tools/distrib/check_nanopb_output.sh @@ -60,7 +60,7 @@ PATH="$PROTOC_PATH:$PATH" ./tools/codegen/core/gen_load_balancing_proto.sh \ $NANOPB_TMP_OUTPUT # compare outputs to checked compiled code -if ! diff -r $NANOPB_TMP_OUTPUT src/core/lib/proto/grpc/lb/v0; then - echo "Outputs differ: $NANOPB_TMP_OUTPUT vs src/core/lib/proto/grpc/lb/v0" +if ! diff -r $NANOPB_TMP_OUTPUT src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0; then + echo "Outputs differ: $NANOPB_TMP_OUTPUT vs src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0" exit 2 fi diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index bb7177f52f2..2d308dbcf49 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -812,9 +812,9 @@ src/core/lib/channel/subchannel_call_holder.h \ src/core/lib/client_config/client_config.h \ src/core/lib/client_config/connector.h \ src/core/lib/client_config/initial_connect_string.h \ -src/core/lib/client_config/lb_policies/load_balancer_api.h \ -src/core/lib/client_config/lb_policies/pick_first.h \ -src/core/lib/client_config/lb_policies/round_robin.h \ +src/core/ext/lb_policy/grpclb/load_balancer_api.h \ +src/core/ext/lb_policy/pick_first/pick_first.h \ +src/core/ext/lb_policy/round_robin/round_robin.h \ src/core/lib/client_config/lb_policy.h \ src/core/lib/client_config/lb_policy_factory.h \ src/core/lib/client_config/lb_policy_registry.h \ @@ -874,7 +874,7 @@ src/core/lib/json/json.h \ src/core/lib/json/json_common.h \ src/core/lib/json/json_reader.h \ src/core/lib/json/json_writer.h \ -src/core/lib/proto/grpc/lb/v0/load_balancer.pb.h \ +src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h \ src/core/lib/security/auth_filters.h \ src/core/lib/security/b64.h \ src/core/lib/security/credentials.h \ @@ -961,9 +961,9 @@ src/core/lib/client_config/client_config.c \ src/core/lib/client_config/connector.c \ src/core/lib/client_config/default_initial_connect_string.c \ src/core/lib/client_config/initial_connect_string.c \ -src/core/lib/client_config/lb_policies/load_balancer_api.c \ -src/core/lib/client_config/lb_policies/pick_first.c \ -src/core/lib/client_config/lb_policies/round_robin.c \ +src/core/ext/lb_policy/grpclb/load_balancer_api.c \ +src/core/ext/lb_policy/pick_first/pick_first.c \ +src/core/ext/lb_policy/round_robin/round_robin.c \ src/core/lib/client_config/lb_policy.c \ src/core/lib/client_config/lb_policy_factory.c \ src/core/lib/client_config/lb_policy_registry.c \ @@ -1029,7 +1029,7 @@ src/core/lib/json/json.c \ src/core/lib/json/json_reader.c \ src/core/lib/json/json_string.c \ src/core/lib/json/json_writer.c \ -src/core/lib/proto/grpc/lb/v0/load_balancer.pb.c \ +src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c \ src/core/lib/security/b64.c \ src/core/lib/security/client_auth_filter.c \ src/core/lib/security/credentials.c \ diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index e1bfa8719b6..4627a7c7bc3 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -3963,9 +3963,9 @@ "src/core/lib/client_config/client_config.h", "src/core/lib/client_config/connector.h", "src/core/lib/client_config/initial_connect_string.h", - "src/core/lib/client_config/lb_policies/load_balancer_api.h", - "src/core/lib/client_config/lb_policies/pick_first.h", - "src/core/lib/client_config/lb_policies/round_robin.h", + "src/core/ext/lb_policy/grpclb/load_balancer_api.h", + "src/core/ext/lb_policy/pick_first/pick_first.h", + "src/core/ext/lb_policy/round_robin/round_robin.h", "src/core/lib/client_config/lb_policy.h", "src/core/lib/client_config/lb_policy_factory.h", "src/core/lib/client_config/lb_policy_registry.h", @@ -4025,7 +4025,7 @@ "src/core/lib/json/json_common.h", "src/core/lib/json/json_reader.h", "src/core/lib/json/json_writer.h", - "src/core/lib/proto/grpc/lb/v0/load_balancer.pb.h", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", "src/core/lib/security/auth_filters.h", "src/core/lib/security/b64.h", "src/core/lib/security/credentials.h", @@ -4168,12 +4168,12 @@ "src/core/lib/client_config/default_initial_connect_string.c", "src/core/lib/client_config/initial_connect_string.c", "src/core/lib/client_config/initial_connect_string.h", - "src/core/lib/client_config/lb_policies/load_balancer_api.c", - "src/core/lib/client_config/lb_policies/load_balancer_api.h", - "src/core/lib/client_config/lb_policies/pick_first.c", - "src/core/lib/client_config/lb_policies/pick_first.h", - "src/core/lib/client_config/lb_policies/round_robin.c", - "src/core/lib/client_config/lb_policies/round_robin.h", + "src/core/ext/lb_policy/grpclb/load_balancer_api.c", + "src/core/ext/lb_policy/grpclb/load_balancer_api.h", + "src/core/ext/lb_policy/pick_first/pick_first.c", + "src/core/ext/lb_policy/pick_first/pick_first.h", + "src/core/ext/lb_policy/round_robin/round_robin.c", + "src/core/ext/lb_policy/round_robin/round_robin.h", "src/core/lib/client_config/lb_policy.c", "src/core/lib/client_config/lb_policy.h", "src/core/lib/client_config/lb_policy_factory.c", @@ -4298,8 +4298,8 @@ "src/core/lib/json/json_string.c", "src/core/lib/json/json_writer.c", "src/core/lib/json/json_writer.h", - "src/core/lib/proto/grpc/lb/v0/load_balancer.pb.c", - "src/core/lib/proto/grpc/lb/v0/load_balancer.pb.h", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", "src/core/lib/security/auth_filters.h", "src/core/lib/security/b64.c", "src/core/lib/security/b64.h", @@ -4591,9 +4591,9 @@ "src/core/lib/client_config/client_config.h", "src/core/lib/client_config/connector.h", "src/core/lib/client_config/initial_connect_string.h", - "src/core/lib/client_config/lb_policies/load_balancer_api.h", - "src/core/lib/client_config/lb_policies/pick_first.h", - "src/core/lib/client_config/lb_policies/round_robin.h", + "src/core/ext/lb_policy/grpclb/load_balancer_api.h", + "src/core/ext/lb_policy/pick_first/pick_first.h", + "src/core/ext/lb_policy/round_robin/round_robin.h", "src/core/lib/client_config/lb_policy.h", "src/core/lib/client_config/lb_policy_factory.h", "src/core/lib/client_config/lb_policy_registry.h", @@ -4653,7 +4653,7 @@ "src/core/lib/json/json_common.h", "src/core/lib/json/json_reader.h", "src/core/lib/json/json_writer.h", - "src/core/lib/proto/grpc/lb/v0/load_balancer.pb.h", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", "src/core/lib/statistics/census_interface.h", "src/core/lib/statistics/census_rpc_stats.h", "src/core/lib/surface/api_trace.h", @@ -4779,12 +4779,12 @@ "src/core/lib/client_config/default_initial_connect_string.c", "src/core/lib/client_config/initial_connect_string.c", "src/core/lib/client_config/initial_connect_string.h", - "src/core/lib/client_config/lb_policies/load_balancer_api.c", - "src/core/lib/client_config/lb_policies/load_balancer_api.h", - "src/core/lib/client_config/lb_policies/pick_first.c", - "src/core/lib/client_config/lb_policies/pick_first.h", - "src/core/lib/client_config/lb_policies/round_robin.c", - "src/core/lib/client_config/lb_policies/round_robin.h", + "src/core/ext/lb_policy/grpclb/load_balancer_api.c", + "src/core/ext/lb_policy/grpclb/load_balancer_api.h", + "src/core/ext/lb_policy/pick_first/pick_first.c", + "src/core/ext/lb_policy/pick_first/pick_first.h", + "src/core/ext/lb_policy/round_robin/round_robin.c", + "src/core/ext/lb_policy/round_robin/round_robin.h", "src/core/lib/client_config/lb_policy.c", "src/core/lib/client_config/lb_policy.h", "src/core/lib/client_config/lb_policy_factory.c", @@ -4908,8 +4908,8 @@ "src/core/lib/json/json_string.c", "src/core/lib/json/json_writer.c", "src/core/lib/json/json_writer.h", - "src/core/lib/proto/grpc/lb/v0/load_balancer.pb.c", - "src/core/lib/proto/grpc/lb/v0/load_balancer.pb.h", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", "src/core/lib/statistics/census_interface.h", "src/core/lib/statistics/census_rpc_stats.h", "src/core/lib/surface/alarm.c", From 9c84fc308039bcac7bcec3cc7d7de1a26328f4df Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Mon, 28 Mar 2016 17:11:55 -0700 Subject: [PATCH 22/36] Fix include guards --- src/core/ext/lb_policy/grpclb/load_balancer_api.h | 6 +++--- src/core/ext/lb_policy/pick_first/pick_first.h | 6 +++--- src/core/ext/lb_policy/round_robin/round_robin.h | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/core/ext/lb_policy/grpclb/load_balancer_api.h b/src/core/ext/lb_policy/grpclb/load_balancer_api.h index c1af304f682..b39b4635d34 100644 --- a/src/core/ext/lb_policy/grpclb/load_balancer_api.h +++ b/src/core/ext/lb_policy/grpclb/load_balancer_api.h @@ -31,8 +31,8 @@ * */ -#ifndef GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICIES_LOAD_BALANCER_API_H -#define GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICIES_LOAD_BALANCER_API_H +#ifndef GRPC_CORE_EXT_LB_POLICY_GRPCLB_LOAD_BALANCER_API_H +#define GRPC_CORE_EXT_LB_POLICY_GRPCLB_LOAD_BALANCER_API_H #include @@ -82,4 +82,4 @@ void grpc_grpclb_response_destroy(grpc_grpclb_response *response); } #endif -#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICIES_LOAD_BALANCER_API_H */ +#endif /* GRPC_CORE_EXT_LB_POLICY_GRPCLB_LOAD_BALANCER_API_H */ diff --git a/src/core/ext/lb_policy/pick_first/pick_first.h b/src/core/ext/lb_policy/pick_first/pick_first.h index dba86ea7ad3..23a018ba448 100644 --- a/src/core/ext/lb_policy/pick_first/pick_first.h +++ b/src/core/ext/lb_policy/pick_first/pick_first.h @@ -31,8 +31,8 @@ * */ -#ifndef GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICIES_PICK_FIRST_H -#define GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICIES_PICK_FIRST_H +#ifndef GRPC_CORE_EXT_LB_POLICY_PICK_FIRST_PICK_FIRST_H +#define GRPC_CORE_EXT_LB_POLICY_PICK_FIRST_PICK_FIRST_H #include "src/core/lib/client_config/lb_policy_factory.h" @@ -40,4 +40,4 @@ * the first subchannel from \a subchannels to succesfully connect */ grpc_lb_policy_factory *grpc_pick_first_lb_factory_create(); -#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICIES_PICK_FIRST_H */ +#endif /* GRPC_CORE_EXT_LB_POLICY_PICK_FIRST_PICK_FIRST_H */ diff --git a/src/core/ext/lb_policy/round_robin/round_robin.h b/src/core/ext/lb_policy/round_robin/round_robin.h index 52db1caa0c2..4cac8682f6a 100644 --- a/src/core/ext/lb_policy/round_robin/round_robin.h +++ b/src/core/ext/lb_policy/round_robin/round_robin.h @@ -31,8 +31,8 @@ * */ -#ifndef GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICIES_ROUND_ROBIN_H -#define GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICIES_ROUND_ROBIN_H +#ifndef GRPC_CORE_EXT_LB_POLICY_ROUND_ROBIN_ROUND_ROBIN_H +#define GRPC_CORE_EXT_LB_POLICY_ROUND_ROBIN_ROUND_ROBIN_H #include "src/core/lib/client_config/lb_policy.h" @@ -43,4 +43,4 @@ extern int grpc_lb_round_robin_trace; /** Returns a load balancing factory for the round robin policy */ grpc_lb_policy_factory *grpc_round_robin_lb_factory_create(); -#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICIES_ROUND_ROBIN_H */ +#endif /* GRPC_CORE_EXT_LB_POLICY_ROUND_ROBIN_ROUND_ROBIN_H */ From b27584486474cf4cf6d38641c6446e7114529c83 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Mon, 28 Mar 2016 09:32:20 -0700 Subject: [PATCH 23/36] add run_performance_tests.py script --- tools/run_tests/jobset.py | 7 +- .../performance/build_performance.sh | 40 ++ .../performance/remote_host_build.sh | 36 ++ .../performance/remote_host_prepare.sh | 44 +++ tools/run_tests/run_performance_tests.py | 353 ++++++++++++++++++ 5 files changed, 478 insertions(+), 2 deletions(-) create mode 100755 tools/run_tests/performance/build_performance.sh create mode 100755 tools/run_tests/performance/remote_host_build.sh create mode 100755 tools/run_tests/performance/remote_host_prepare.sh create mode 100755 tools/run_tests/run_performance_tests.py diff --git a/tools/run_tests/jobset.py b/tools/run_tests/jobset.py index a3b246dc084..d1cfc5952f1 100755 --- a/tools/run_tests/jobset.py +++ b/tools/run_tests/jobset.py @@ -151,7 +151,8 @@ class JobSpec(object): def __init__(self, cmdline, shortname=None, environ=None, hash_targets=None, cwd=None, shell=False, timeout_seconds=5*60, flake_retries=0, - timeout_retries=0, kill_handler=None, cpu_cost=1.0): + timeout_retries=0, kill_handler=None, cpu_cost=1.0, + verbose_success=False): """ Arguments: cmdline: a list of arguments to pass as the command line @@ -176,6 +177,7 @@ class JobSpec(object): self.timeout_retries = timeout_retries self.kill_handler = kill_handler self.cpu_cost = cpu_cost + self.verbose_success = verbose_success def identity(self): return '%r %r %r' % (self.cmdline, self.environ, self.hash_targets) @@ -287,7 +289,8 @@ class Job(object): cores = (user + sys) / real measurement = '; cpu_cost=%.01f; estimated=%.01f' % (cores, self._spec.cpu_cost) message('PASSED', '%s [time=%.1fsec; retries=%d:%d%s]' % ( - self._spec.shortname, elapsed, self._retries, self._timeout_retries, measurement), + self._spec.shortname, elapsed, self._retries, self._timeout_retries, measurement), + stdout() if self._spec.verbose_success else None, do_newline=self._newline_on_success or self._travis) self.result.state = 'PASSED' if self._bin_hash: diff --git a/tools/run_tests/performance/build_performance.sh b/tools/run_tests/performance/build_performance.sh new file mode 100755 index 00000000000..00cc41ec73f --- /dev/null +++ b/tools/run_tests/performance/build_performance.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# Copyright 2015-2016, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +set -ex + +cd $(dirname $0)/../../.. + +#TODO(jtattermusch): add support for more languages + +CONFIG=${CONFIG:-opt} + +# build C++ qps worker & driver +make CONFIG=${CONFIG} qps_worker qps_driver -j8 diff --git a/tools/run_tests/performance/remote_host_build.sh b/tools/run_tests/performance/remote_host_build.sh new file mode 100755 index 00000000000..f23ea921ce3 --- /dev/null +++ b/tools/run_tests/performance/remote_host_build.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# Copyright 2015-2016, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +set -ex + +cd $(dirname $0)/../../.. + +# execute the build script remotely +ssh "${USER_AT_HOST}" "CONFIG=${CONFIG} ~/performance_workspace/grpc/tools/run_tests/performance/build_performance.sh" diff --git a/tools/run_tests/performance/remote_host_prepare.sh b/tools/run_tests/performance/remote_host_prepare.sh new file mode 100755 index 00000000000..bad2424a6b1 --- /dev/null +++ b/tools/run_tests/performance/remote_host_prepare.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# Copyright 2015-2016, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +set -ex + +cd $(dirname $0)/../../.. + +# cleanup after previous builds +ssh "${USER_AT_HOST}" "rm -rf ~/performance_workspace && mkdir -p ~/performance_workspace" + +# TODO(jtattermusch): To be sure there are not running processes that would +# mess with the results, be rough and reboot the slave here +# and wait for it to come back online. + +# push the current sources to the slave and unpack it. +scp ../grpc.tar "${USER_AT_HOST}:~/performance_workspace" +ssh "${USER_AT_HOST}" "tar -xf ~/performance_workspace/grpc.tar -C ~/performance_workspace" \ No newline at end of file diff --git a/tools/run_tests/run_performance_tests.py b/tools/run_tests/run_performance_tests.py new file mode 100755 index 00000000000..77c0addb42e --- /dev/null +++ b/tools/run_tests/run_performance_tests.py @@ -0,0 +1,353 @@ +#!/usr/bin/env python2.7 +# Copyright 2016, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""Run performance tests locally or remotely.""" + +import argparse +import jobset +import multiprocessing +import os +import subprocess +import sys +import tempfile +import time +import uuid + + +_ROOT = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '../..')) +os.chdir(_ROOT) + + +_REMOTE_HOST_USERNAME = 'jenkins' + + +class CXXLanguage: + + def __init__(self): + self.safename = 'cxx' + + def scenarios(self): + # TODO(jtattermusch): add more scenarios + return { + # Scenario 1: generic async streaming ping-pong (contentionless latency) + 'cpp_async_generic_streaming_ping_pong': [ + '--rpc_type=STREAMING', + '--client_type=ASYNC_CLIENT', + '--server_type=ASYNC_GENERIC_SERVER', + '--outstanding_rpcs_per_channel=1', + '--client_channels=1', + '--bbuf_req_size=0', + '--bbuf_resp_size=0', + '--async_client_threads=1', + '--async_server_threads=1', + '--secure_test=true', + '--num_servers=1', + '--num_clients=1', + '--server_core_limit=0', + '--client_core_limit=0'], + # Scenario 5: Sync unary ping-pong with protobufs + 'cpp_sync_unary_ping_pong_protobuf': [ + '--rpc_type=UNARY', + '--client_type=SYNC_CLIENT', + '--server_type=SYNC_SERVER', + '--outstanding_rpcs_per_channel=1', + '--client_channels=1', + '--simple_req_size=0', + '--simple_resp_size=0', + '--secure_test=true', + '--num_servers=1', + '--num_clients=1', + '--server_core_limit=0', + '--client_core_limit=0']} + + def __str__(self): + return 'c++' + + +class CSharpLanguage: + + def __init__(self): + self.safename = str(self) + + def __str__(self): + return 'csharp' + + +class NodeLanguage: + + def __init__(self): + pass + self.safename = str(self) + + def __str__(self): + return 'node' + + +_LANGUAGES = { + 'c++' : CXXLanguage(), + 'csharp' : CSharpLanguage(), + 'node' : NodeLanguage(), +} + + +class QpsWorkerJob: + """Encapsulates a qps worker server job.""" + + def __init__(self, spec, host_and_port): + self._spec = spec + self.host_and_port = host_and_port + self._job = jobset.Job(spec, bin_hash=None, newline_on_success=True, travis=True, add_env={}) + + def is_running(self): + """Polls a job and returns True if given job is still running.""" + return self._job.state(jobset.NoCache()) == jobset._RUNNING + + def kill(self): + return self._job.kill() + + +def create_qpsworker_job(language, port=10000, remote_host=None): + # TODO: support more languages + cmd = 'bins/opt/qps_worker --driver_port=%s' % port + if remote_host: + user_at_host = '%s@%s' % (_REMOTE_HOST_USERNAME, remote_host) + cmd = 'ssh %s "cd ~/performance_workspace/grpc/ && %s"' % (user_at_host, cmd) + host_and_port='%s:%s' % (remote_host, port) + else: + host_and_port='localhost:%s' % port + + jobspec = jobset.JobSpec( + cmdline=[cmd], + shortname='qps_worker', + timeout_seconds=15*60, + shell=True) + return QpsWorkerJob(jobspec, host_and_port) + + +def create_scenario_jobspec(scenario_name, driver_args, workers, remote_host=None): + """Runs one scenario using QPS driver.""" + # setting QPS_WORKERS env variable here makes sure it works with SSH too. + cmd = 'QPS_WORKERS="%s" bins/opt/qps_driver ' % ','.join(workers) + cmd += ' '.join(driver_args) + if remote_host: + user_at_host = '%s@%s' % (_REMOTE_HOST_USERNAME, remote_host) + cmd = 'ssh %s "cd ~/performance_workspace/grpc/ && %s"' % (user_at_host, cmd) + + return jobset.JobSpec( + cmdline=[cmd], + shortname='qps_driver.%s' % scenario_name, + timeout_seconds=3*60, + shell=True, + verbose_success=True) + + +def archive_repo(): + """Archives local version of repo including submodules.""" + # TODO: also archive grpc-go and grpc-java repos + archive_job = jobset.JobSpec( + cmdline=['tar', '-cf', '../grpc.tar', '../grpc/'], + shortname='archive_repo', + timeout_seconds=3*60) + + jobset.message('START', 'Archiving local repository.', do_newline=True) + num_failures, _ = jobset.run( + [archive_job], newline_on_success=True, maxjobs=1) + if num_failures == 0: + jobset.message('SUCCESS', + 'Archive with local repository create successfully.', + do_newline=True) + else: + jobset.message('FAILED', 'Failed to archive local repository.', + do_newline=True) + sys.exit(1) + + +def prepare_remote_hosts(hosts): + """Prepares remote hosts.""" + prepare_jobs = [] + for host in hosts: + user_at_host = '%s@%s' % (_REMOTE_HOST_USERNAME, host) + prepare_jobs.append( + jobset.JobSpec( + cmdline=['tools/run_tests/performance/remote_host_prepare.sh'], + shortname='remote_host_prepare.%s' % host, + environ = {'USER_AT_HOST': user_at_host}, + timeout_seconds=3*60)) + jobset.message('START', 'Preparing remote hosts.', do_newline=True) + num_failures, _ = jobset.run( + prepare_jobs, newline_on_success=True, maxjobs=10) + if num_failures == 0: + jobset.message('SUCCESS', + 'Remote hosts ready to start build.', + do_newline=True) + else: + jobset.message('FAILED', 'Failed to prepare remote hosts.', + do_newline=True) + sys.exit(1) + + +def build_on_remote_hosts(hosts, build_local=False): + """Builds performance worker on remote hosts.""" + build_timeout = 15*60 + build_jobs = [] + for host in hosts: + user_at_host = '%s@%s' % (_REMOTE_HOST_USERNAME, host) + build_jobs.append( + jobset.JobSpec( + cmdline=['tools/run_tests/performance/remote_host_build.sh'], + shortname='remote_host_build.%s' % host, + environ = {'USER_AT_HOST': user_at_host, 'CONFIG': 'opt'}, + timeout_seconds=build_timeout)) + if build_local: + # Build locally as well + build_jobs.append( + jobset.JobSpec( + cmdline=['tools/run_tests/performance/build_performance.sh'], + shortname='local_build', + environ = {'CONFIG': 'opt'}, + timeout_seconds=build_timeout)) + jobset.message('START', 'Building on remote hosts.', do_newline=True) + num_failures, _ = jobset.run( + build_jobs, newline_on_success=True, maxjobs=10) + if num_failures == 0: + jobset.message('SUCCESS', + 'Build on remote hosts was successful.', + do_newline=True) + else: + jobset.message('FAILED', 'Failed to build on remote hosts.', + do_newline=True) + sys.exit(1) + + +def start_qpsworkers(worker_hosts): + """Starts QPS workers as background jobs.""" + if not worker_hosts: + # run two workers locally + workers=[(None, 10000), (None, 10010)] + elif len(worker_hosts) == 1: + # run two workers on the remote host + workers=[(worker_hosts[0], 10000), (worker_hosts[0], 10010)] + else: + # run one worker per each remote host + workers=[(worker_host, 10000) for worker_host in worker_hosts] + + return [create_qpsworker_job(CXXLanguage(), + port=worker[1], + remote_host=worker[0]) + for worker in workers] + + +def create_scenarios(languages, workers, remote_host=None): + """Create jobspecs for scenarios to run.""" + scenarios = [] + for language in languages: + for scenario_name, driver_args in language.scenarios().iteritems(): + scenario = create_scenario_jobspec(scenario_name, + driver_args, + workers, + remote_host=remote_host) + scenarios.append(scenario) + + # the very last scenario requests shutting down the workers. + scenarios.append(create_scenario_jobspec('quit_workers', + ['--quit=true'], + workers, + remote_host=remote_host)) + return scenarios + + +def finish_qps_workers(jobs): + """Waits for given jobs to finish and eventually kills them.""" + retries = 0 + while any(job.is_running() for job in jobs): + for job in qpsworker_jobs: + if job.is_running(): + print 'QPS worker "%s" is still running.' % job.host_and_port + if retries > 10: + print 'Killing all QPS workers.' + for job in jobs: + job.kill() + retries += 1 + time.sleep(3) + print 'All QPS workers finished.' + + +argp = argparse.ArgumentParser(description='Run performance tests.') +argp.add_argument('--remote_driver_host', + default=None, + help='Run QPS driver on given host. By default, QPS driver is run locally.') +argp.add_argument('--remote_worker_host', + nargs='+', + default=[], + help='Worker hosts where to start QPS workers.') + +args = argp.parse_args() + +# Put together set of remote hosts where to run and build +remote_hosts = set() +if args.remote_worker_host: + for host in args.remote_worker_host: + remote_hosts.add(host) +if args.remote_driver_host: + remote_hosts.add(args.remote_driver_host) + +if remote_hosts: + archive_repo() + prepare_remote_hosts(remote_hosts) + +build_local = False +if not args.remote_driver_host: + build_local = True +build_on_remote_hosts(remote_hosts, build_local=build_local) + +qpsworker_jobs = start_qpsworkers(args.remote_worker_host) + +worker_addresses = [job.host_and_port for job in qpsworker_jobs] + +try: + scenarios = create_scenarios(languages=[CXXLanguage()], + workers=worker_addresses, + remote_host=args.remote_driver_host) + if not scenarios: + raise Exception('No scenarios to run') + + jobset.message('START', 'Running scenarios.', do_newline=True) + num_failures, _ = jobset.run( + scenarios, newline_on_success=True, maxjobs=1) + if num_failures == 0: + jobset.message('SUCCESS', + 'All scenarios finished successfully.', + do_newline=True) + else: + jobset.message('FAILED', 'Some of the scenarios failed.', + do_newline=True) + sys.exit(1) +finally: + finish_qps_workers(qpsworker_jobs) From ca5acf819d94e8c3de4a28d0a8f6dedc3068148f Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 29 Mar 2016 07:38:27 -0700 Subject: [PATCH 24/36] Fix test by naming parameters --- test/core/internal_api_canaries/iomgr.c | 33 +++++++++++++------------ 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/test/core/internal_api_canaries/iomgr.c b/test/core/internal_api_canaries/iomgr.c index cd74ccc562f..647ccb9df96 100644 --- a/test/core/internal_api_canaries/iomgr.c +++ b/test/core/internal_api_canaries/iomgr.c @@ -69,22 +69,6 @@ static void test_code(void) { bool x = grpc_closure_list_empty(closure_list); grpc_closure_next(&closure); - /* endpoint.h */ - grpc_endpoint_read(NULL, NULL, NULL, NULL); - grpc_endpoint_get_peer(NULL); - grpc_endpoint_write(NULL, NULL, NULL, NULL); - grpc_endpoint_shutdown(NULL, NULL); - grpc_endpoint_destroy(NULL, NULL); - grpc_endpoint_add_to_pollset(NULL, NULL, NULL); - grpc_endpoint_add_to_pollset_set(NULL, NULL, NULL); - - grpc_endpoint endpoint; - grpc_endpoint_vtable vtable = { - grpc_endpoint_read, grpc_endpoint_write, grpc_endpoint_add_to_pollset, - grpc_endpoint_add_to_pollset_set, grpc_endpoint_shutdown, - grpc_endpoint_destroy, grpc_endpoint_get_peer}; - endpoint.vtable = &vtable; - /* exec_ctx.h */ grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_exec_ctx_flush(&exec_ctx); @@ -92,6 +76,23 @@ static void test_code(void) { grpc_exec_ctx_enqueue(&exec_ctx, &closure, x, NULL); grpc_exec_ctx_enqueue_list(&exec_ctx, &closure_list, NULL); + /* endpoint.h */ + grpc_endpoint endpoint; + grpc_endpoint_vtable vtable = { + grpc_endpoint_read, grpc_endpoint_write, + grpc_endpoint_add_to_pollset, grpc_endpoint_add_to_pollset_set, + grpc_endpoint_shutdown, grpc_endpoint_destroy, + grpc_endpoint_get_peer}; + endpoint.vtable = &vtable; + + grpc_endpoint_read(&exec_ctx, &endpoint, NULL, NULL); + grpc_endpoint_get_peer(&endpoint); + grpc_endpoint_write(&exec_ctx, &endpoint, NULL, NULL); + grpc_endpoint_shutdown(&exec_ctx, &endpoint); + grpc_endpoint_destroy(&exec_ctx, &endpoint); + grpc_endpoint_add_to_pollset(&exec_ctx, &endpoint, NULL); + grpc_endpoint_add_to_pollset_set(&exec_ctx, &endpoint, NULL); + /* executor.h */ grpc_executor_init(); grpc_executor_enqueue(&closure, x); From 1206423aa229bf2bce4a07ffc26c12e6dd8d9eb6 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 29 Mar 2016 07:40:47 -0700 Subject: [PATCH 25/36] Fix include paths --- test/core/internal_api_canaries/iomgr.c | 10 +++++----- test/core/internal_api_canaries/support.c | 6 +++--- test/core/internal_api_canaries/transport.c | 17 ++++++++++------- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/test/core/internal_api_canaries/iomgr.c b/test/core/internal_api_canaries/iomgr.c index 647ccb9df96..04d66994cd2 100644 --- a/test/core/internal_api_canaries/iomgr.c +++ b/test/core/internal_api_canaries/iomgr.c @@ -31,11 +31,11 @@ * */ -#include "src/core/iomgr/iomgr.h" -#include "src/core/iomgr/closure.h" -#include "src/core/iomgr/endpoint.h" -#include "src/core/iomgr/exec_ctx.h" -#include "src/core/iomgr/executor.h" +#include "src/core/lib/iomgr/iomgr.h" +#include "src/core/lib/iomgr/closure.h" +#include "src/core/lib/iomgr/endpoint.h" +#include "src/core/lib/iomgr/exec_ctx.h" +#include "src/core/lib/iomgr/executor.h" /******************************************************************************* * NOTE: If this test fails to compile, then the api changes are likely to cause diff --git a/test/core/internal_api_canaries/support.c b/test/core/internal_api_canaries/support.c index e964f71e4c9..7e00e0d2ff7 100644 --- a/test/core/internal_api_canaries/support.c +++ b/test/core/internal_api_canaries/support.c @@ -39,9 +39,9 @@ * This test is NOT expected to be run directly. ******************************************************************************/ -#include "src/core/support/env.h" -#include "src/core/support/load_file.h" -#include "src/core/support/tmpfile.h" +#include "src/core/lib/support/env.h" +#include "src/core/lib/support/load_file.h" +#include "src/core/lib/support/tmpfile.h" static void test_code(void) { /* env.h */ diff --git a/test/core/internal_api_canaries/transport.c b/test/core/internal_api_canaries/transport.c index 006d4cfd818..01daabaa566 100644 --- a/test/core/internal_api_canaries/transport.c +++ b/test/core/internal_api_canaries/transport.c @@ -39,17 +39,20 @@ * This test is NOT expected to be run directly. ******************************************************************************/ -#include "src/core/transport/transport.h" -#include "src/core/transport/transport_impl.h" +#include "src/core/lib/transport/transport.h" +#include "src/core/lib/transport/transport_impl.h" static void test_code(void) { /* transport_impl.h */ grpc_transport transport; - grpc_transport_vtable vtable = { - 12345, grpc_transport_init_stream, grpc_transport_set_pollset, - grpc_transport_perform_stream_op, grpc_transport_perform_op, - grpc_transport_destroy_stream, grpc_transport_destroy, - grpc_transport_get_peer}; + grpc_transport_vtable vtable = {12345, + grpc_transport_init_stream, + grpc_transport_set_pollset, + grpc_transport_perform_stream_op, + grpc_transport_perform_op, + grpc_transport_destroy_stream, + grpc_transport_destroy, + grpc_transport_get_peer}; transport.vtable = &vtable; /* transport.h */ From 023caf1846bc8b285704ea973bfae27fbd0df8e0 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 29 Mar 2016 08:00:30 -0700 Subject: [PATCH 26/36] Refactor build to have lb policies as extensions --- BUILD | 48 +++++----- Makefile | 16 ++-- binding.gyp | 8 +- build.yaml | 37 ++++++-- config.m4 | 14 +-- gRPC.podspec | 24 ++--- grpc.gemspec | 16 ++-- package.json | 16 ++-- package.xml | 16 ++-- src/python/grpcio/grpc_core_dependencies.py | 8 +- tools/doxygen/Doxyfile.core.internal | 16 ++-- tools/run_tests/sources_and_headers.json | 48 +++++----- vsprojects/vcxproj/grpc/grpc.vcxproj | 24 ++--- vsprojects/vcxproj/grpc/grpc.vcxproj.filters | 87 ++++++++++--------- .../grpc_unsecure/grpc_unsecure.vcxproj | 24 ++--- .../grpc_unsecure.vcxproj.filters | 87 ++++++++++--------- 16 files changed, 265 insertions(+), 224 deletions(-) diff --git a/BUILD b/BUILD index cd33480b85b..f6f02d2244f 100644 --- a/BUILD +++ b/BUILD @@ -157,6 +157,10 @@ cc_library( cc_library( name = "grpc", srcs = [ + "src/core/ext/lb_policy/grpclb/load_balancer_api.h", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", + "src/core/ext/lb_policy/pick_first/pick_first.h", + "src/core/ext/lb_policy/round_robin/round_robin.h", "src/core/ext/transport/chttp2/transport/alpn.h", "src/core/ext/transport/chttp2/transport/bin_encoder.h", "src/core/ext/transport/chttp2/transport/chttp2_transport.h", @@ -196,9 +200,6 @@ cc_library( "src/core/lib/client_config/client_config.h", "src/core/lib/client_config/connector.h", "src/core/lib/client_config/initial_connect_string.h", - "src/core/ext/lb_policy/grpclb/load_balancer_api.h", - "src/core/ext/lb_policy/pick_first/pick_first.h", - "src/core/ext/lb_policy/round_robin/round_robin.h", "src/core/lib/client_config/lb_policy.h", "src/core/lib/client_config/lb_policy_factory.h", "src/core/lib/client_config/lb_policy_registry.h", @@ -258,7 +259,6 @@ cc_library( "src/core/lib/json/json_common.h", "src/core/lib/json/json_reader.h", "src/core/lib/json/json_writer.h", - "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", "src/core/lib/security/auth_filters.h", "src/core/lib/security/b64.h", "src/core/lib/security/credentials.h", @@ -298,6 +298,10 @@ cc_library( "third_party/nanopb/pb_common.h", "third_party/nanopb/pb_decode.h", "third_party/nanopb/pb_encode.h", + "src/core/ext/lb_policy/grpclb/load_balancer_api.c", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", + "src/core/ext/lb_policy/pick_first/pick_first.c", + "src/core/ext/lb_policy/round_robin/round_robin.c", "src/core/ext/transport/chttp2/client/insecure/channel_create.c", "src/core/ext/transport/chttp2/client/secure/secure_channel_create.c", "src/core/ext/transport/chttp2/server/insecure/server_chttp2.c", @@ -345,9 +349,6 @@ cc_library( "src/core/lib/client_config/connector.c", "src/core/lib/client_config/default_initial_connect_string.c", "src/core/lib/client_config/initial_connect_string.c", - "src/core/ext/lb_policy/grpclb/load_balancer_api.c", - "src/core/ext/lb_policy/pick_first/pick_first.c", - "src/core/ext/lb_policy/round_robin/round_robin.c", "src/core/lib/client_config/lb_policy.c", "src/core/lib/client_config/lb_policy_factory.c", "src/core/lib/client_config/lb_policy_registry.c", @@ -413,7 +414,6 @@ cc_library( "src/core/lib/json/json_reader.c", "src/core/lib/json/json_string.c", "src/core/lib/json/json_writer.c", - "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", "src/core/lib/security/b64.c", "src/core/lib/security/client_auth_filter.c", "src/core/lib/security/credentials.c", @@ -532,6 +532,10 @@ cc_library( cc_library( name = "grpc_unsecure", srcs = [ + "src/core/ext/lb_policy/grpclb/load_balancer_api.h", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", + "src/core/ext/lb_policy/pick_first/pick_first.h", + "src/core/ext/lb_policy/round_robin/round_robin.h", "src/core/ext/transport/chttp2/transport/alpn.h", "src/core/ext/transport/chttp2/transport/bin_encoder.h", "src/core/ext/transport/chttp2/transport/chttp2_transport.h", @@ -571,9 +575,6 @@ cc_library( "src/core/lib/client_config/client_config.h", "src/core/lib/client_config/connector.h", "src/core/lib/client_config/initial_connect_string.h", - "src/core/ext/lb_policy/grpclb/load_balancer_api.h", - "src/core/ext/lb_policy/pick_first/pick_first.h", - "src/core/ext/lb_policy/round_robin/round_robin.h", "src/core/lib/client_config/lb_policy.h", "src/core/lib/client_config/lb_policy_factory.h", "src/core/lib/client_config/lb_policy_registry.h", @@ -633,7 +634,6 @@ cc_library( "src/core/lib/json/json_common.h", "src/core/lib/json/json_reader.h", "src/core/lib/json/json_writer.h", - "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", "src/core/lib/statistics/census_interface.h", "src/core/lib/statistics/census_rpc_stats.h", "src/core/lib/surface/api_trace.h", @@ -659,6 +659,10 @@ cc_library( "third_party/nanopb/pb_common.h", "third_party/nanopb/pb_decode.h", "third_party/nanopb/pb_encode.h", + "src/core/ext/lb_policy/grpclb/load_balancer_api.c", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", + "src/core/ext/lb_policy/pick_first/pick_first.c", + "src/core/ext/lb_policy/round_robin/round_robin.c", "src/core/ext/transport/chttp2/client/insecure/channel_create.c", "src/core/ext/transport/chttp2/server/insecure/server_chttp2.c", "src/core/ext/transport/chttp2/transport/alpn.c", @@ -704,9 +708,6 @@ cc_library( "src/core/lib/client_config/connector.c", "src/core/lib/client_config/default_initial_connect_string.c", "src/core/lib/client_config/initial_connect_string.c", - "src/core/ext/lb_policy/grpclb/load_balancer_api.c", - "src/core/ext/lb_policy/pick_first/pick_first.c", - "src/core/ext/lb_policy/round_robin/round_robin.c", "src/core/lib/client_config/lb_policy.c", "src/core/lib/client_config/lb_policy_factory.c", "src/core/lib/client_config/lb_policy_registry.c", @@ -771,7 +772,6 @@ cc_library( "src/core/lib/json/json_reader.c", "src/core/lib/json/json_string.c", "src/core/lib/json/json_writer.c", - "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", "src/core/lib/surface/alarm.c", "src/core/lib/surface/api_trace.c", "src/core/lib/surface/byte_buffer.c", @@ -1360,6 +1360,10 @@ objc_library( objc_library( name = "grpc_objc", srcs = [ + "src/core/ext/lb_policy/grpclb/load_balancer_api.c", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", + "src/core/ext/lb_policy/pick_first/pick_first.c", + "src/core/ext/lb_policy/round_robin/round_robin.c", "src/core/ext/transport/chttp2/client/insecure/channel_create.c", "src/core/ext/transport/chttp2/client/secure/secure_channel_create.c", "src/core/ext/transport/chttp2/server/insecure/server_chttp2.c", @@ -1407,9 +1411,6 @@ objc_library( "src/core/lib/client_config/connector.c", "src/core/lib/client_config/default_initial_connect_string.c", "src/core/lib/client_config/initial_connect_string.c", - "src/core/ext/lb_policy/grpclb/load_balancer_api.c", - "src/core/ext/lb_policy/pick_first/pick_first.c", - "src/core/ext/lb_policy/round_robin/round_robin.c", "src/core/lib/client_config/lb_policy.c", "src/core/lib/client_config/lb_policy_factory.c", "src/core/lib/client_config/lb_policy_registry.c", @@ -1475,7 +1476,6 @@ objc_library( "src/core/lib/json/json_reader.c", "src/core/lib/json/json_string.c", "src/core/lib/json/json_writer.c", - "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", "src/core/lib/security/b64.c", "src/core/lib/security/client_auth_filter.c", "src/core/lib/security/credentials.c", @@ -1539,6 +1539,10 @@ objc_library( "include/grpc/impl/codegen/propagation_bits.h", "include/grpc/impl/codegen/status.h", "include/grpc/status.h", + "src/core/ext/lb_policy/grpclb/load_balancer_api.h", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", + "src/core/ext/lb_policy/pick_first/pick_first.h", + "src/core/ext/lb_policy/round_robin/round_robin.h", "src/core/ext/transport/chttp2/transport/alpn.h", "src/core/ext/transport/chttp2/transport/bin_encoder.h", "src/core/ext/transport/chttp2/transport/chttp2_transport.h", @@ -1578,9 +1582,6 @@ objc_library( "src/core/lib/client_config/client_config.h", "src/core/lib/client_config/connector.h", "src/core/lib/client_config/initial_connect_string.h", - "src/core/ext/lb_policy/grpclb/load_balancer_api.h", - "src/core/ext/lb_policy/pick_first/pick_first.h", - "src/core/ext/lb_policy/round_robin/round_robin.h", "src/core/lib/client_config/lb_policy.h", "src/core/lib/client_config/lb_policy_factory.h", "src/core/lib/client_config/lb_policy_registry.h", @@ -1640,7 +1641,6 @@ objc_library( "src/core/lib/json/json_common.h", "src/core/lib/json/json_reader.h", "src/core/lib/json/json_writer.h", - "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", "src/core/lib/security/auth_filters.h", "src/core/lib/security/b64.h", "src/core/lib/security/credentials.h", diff --git a/Makefile b/Makefile index 2ab4e7903e5..e5f83e8a148 100644 --- a/Makefile +++ b/Makefile @@ -2420,6 +2420,10 @@ endif LIBGRPC_SRC = \ + src/core/ext/lb_policy/grpclb/load_balancer_api.c \ + src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c \ + src/core/ext/lb_policy/pick_first/pick_first.c \ + src/core/ext/lb_policy/round_robin/round_robin.c \ src/core/ext/transport/chttp2/client/insecure/channel_create.c \ src/core/ext/transport/chttp2/client/secure/secure_channel_create.c \ src/core/ext/transport/chttp2/server/insecure/server_chttp2.c \ @@ -2467,9 +2471,6 @@ LIBGRPC_SRC = \ src/core/lib/client_config/connector.c \ src/core/lib/client_config/default_initial_connect_string.c \ src/core/lib/client_config/initial_connect_string.c \ - src/core/ext/lb_policy/grpclb/load_balancer_api.c \ - src/core/ext/lb_policy/pick_first/pick_first.c \ - src/core/ext/lb_policy/round_robin/round_robin.c \ src/core/lib/client_config/lb_policy.c \ src/core/lib/client_config/lb_policy_factory.c \ src/core/lib/client_config/lb_policy_registry.c \ @@ -2535,7 +2536,6 @@ LIBGRPC_SRC = \ src/core/lib/json/json_reader.c \ src/core/lib/json/json_string.c \ src/core/lib/json/json_writer.c \ - src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c \ src/core/lib/security/b64.c \ src/core/lib/security/client_auth_filter.c \ src/core/lib/security/credentials.c \ @@ -2781,6 +2781,10 @@ endif LIBGRPC_UNSECURE_SRC = \ + src/core/ext/lb_policy/grpclb/load_balancer_api.c \ + src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c \ + src/core/ext/lb_policy/pick_first/pick_first.c \ + src/core/ext/lb_policy/round_robin/round_robin.c \ src/core/ext/transport/chttp2/client/insecure/channel_create.c \ src/core/ext/transport/chttp2/server/insecure/server_chttp2.c \ src/core/ext/transport/chttp2/transport/alpn.c \ @@ -2826,9 +2830,6 @@ LIBGRPC_UNSECURE_SRC = \ src/core/lib/client_config/connector.c \ src/core/lib/client_config/default_initial_connect_string.c \ src/core/lib/client_config/initial_connect_string.c \ - src/core/ext/lb_policy/grpclb/load_balancer_api.c \ - src/core/ext/lb_policy/pick_first/pick_first.c \ - src/core/ext/lb_policy/round_robin/round_robin.c \ src/core/lib/client_config/lb_policy.c \ src/core/lib/client_config/lb_policy_factory.c \ src/core/lib/client_config/lb_policy_registry.c \ @@ -2893,7 +2894,6 @@ LIBGRPC_UNSECURE_SRC = \ src/core/lib/json/json_reader.c \ src/core/lib/json/json_string.c \ src/core/lib/json/json_writer.c \ - src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c \ src/core/lib/surface/alarm.c \ src/core/lib/surface/api_trace.c \ src/core/lib/surface/byte_buffer.c \ diff --git a/binding.gyp b/binding.gyp index 1d18c8e7378..068161ba06b 100644 --- a/binding.gyp +++ b/binding.gyp @@ -558,6 +558,10 @@ 'gpr', ], 'sources': [ + 'src/core/ext/lb_policy/grpclb/load_balancer_api.c', + 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c', + 'src/core/ext/lb_policy/pick_first/pick_first.c', + 'src/core/ext/lb_policy/round_robin/round_robin.c', 'src/core/ext/transport/chttp2/client/insecure/channel_create.c', 'src/core/ext/transport/chttp2/client/secure/secure_channel_create.c', 'src/core/ext/transport/chttp2/server/insecure/server_chttp2.c', @@ -605,9 +609,6 @@ 'src/core/lib/client_config/connector.c', 'src/core/lib/client_config/default_initial_connect_string.c', 'src/core/lib/client_config/initial_connect_string.c', - 'src/core/ext/lb_policy/grpclb/load_balancer_api.c', - 'src/core/ext/lb_policy/pick_first/pick_first.c', - 'src/core/ext/lb_policy/round_robin/round_robin.c', 'src/core/lib/client_config/lb_policy.c', 'src/core/lib/client_config/lb_policy_factory.c', 'src/core/lib/client_config/lb_policy_registry.c', @@ -673,7 +674,6 @@ 'src/core/lib/json/json_reader.c', 'src/core/lib/json/json_string.c', 'src/core/lib/json/json_writer.c', - 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c', 'src/core/lib/security/b64.c', 'src/core/lib/security/client_auth_filter.c', 'src/core/lib/security/credentials.c', diff --git a/build.yaml b/build.yaml index 749aabceb5f..6b9d0929758 100644 --- a/build.yaml +++ b/build.yaml @@ -247,6 +247,7 @@ filegroups: - include/grpc/grpc.h - include/grpc/status.h headers: + - src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h - src/core/lib/census/grpc_filter.h - src/core/lib/census/grpc_plugin.h - src/core/lib/channel/channel_args.h @@ -262,9 +263,6 @@ filegroups: - src/core/lib/client_config/client_config.h - src/core/lib/client_config/connector.h - src/core/lib/client_config/initial_connect_string.h - - src/core/ext/lb_policy/grpclb/load_balancer_api.h - - src/core/ext/lb_policy/pick_first/pick_first.h - - src/core/ext/lb_policy/round_robin/round_robin.h - src/core/lib/client_config/lb_policy.h - src/core/lib/client_config/lb_policy_factory.h - src/core/lib/client_config/lb_policy_registry.h @@ -324,7 +322,6 @@ filegroups: - src/core/lib/json/json_common.h - src/core/lib/json/json_reader.h - src/core/lib/json/json_writer.h - - src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h - src/core/lib/statistics/census_interface.h - src/core/lib/statistics/census_rpc_stats.h - src/core/lib/surface/api_trace.h @@ -347,6 +344,7 @@ filegroups: - src/core/lib/transport/transport.h - src/core/lib/transport/transport_impl.h src: + - src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c - src/core/lib/census/grpc_context.c - src/core/lib/census/grpc_filter.c - src/core/lib/census/grpc_plugin.c @@ -363,9 +361,6 @@ filegroups: - src/core/lib/client_config/connector.c - src/core/lib/client_config/default_initial_connect_string.c - src/core/lib/client_config/initial_connect_string.c - - src/core/ext/lb_policy/grpclb/load_balancer_api.c - - src/core/ext/lb_policy/pick_first/pick_first.c - - src/core/ext/lb_policy/round_robin/round_robin.c - src/core/lib/client_config/lb_policy.c - src/core/lib/client_config/lb_policy_factory.c - src/core/lib/client_config/lb_policy_registry.c @@ -430,7 +425,6 @@ filegroups: - src/core/lib/json/json_reader.c - src/core/lib/json/json_string.c - src/core/lib/json/json_writer.c - - src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c - src/core/lib/surface/alarm.c - src/core/lib/surface/api_trace.c - src/core/lib/surface/byte_buffer.c @@ -466,6 +460,27 @@ filegroups: - include/grpc/impl/codegen/grpc_types.h - include/grpc/impl/codegen/propagation_bits.h - include/grpc/impl/codegen/status.h +- name: grpc_lb_policy_grpclb + headers: + - src/core/ext/lb_policy/grpclb/load_balancer_api.h + src: + - src/core/ext/lb_policy/grpclb/load_balancer_api.c + uses: + - grpc_base +- name: grpc_lb_policy_pick_first + headers: + - src/core/ext/lb_policy/pick_first/pick_first.h + src: + - src/core/ext/lb_policy/pick_first/pick_first.c + uses: + - grpc_base +- name: grpc_lb_policy_round_robin + headers: + - src/core/ext/lb_policy/round_robin/round_robin.h + src: + - src/core/ext/lb_policy/round_robin/round_robin.c + uses: + - grpc_base - name: grpc_secure headers: - src/core/lib/security/auth_filters.h @@ -639,6 +654,9 @@ libs: - grpc_transport_chttp2_client_secure - grpc_transport_chttp2_server_insecure - grpc_transport_chttp2_client_insecure + - grpc_lb_policy_grpclb + - grpc_lb_policy_pick_first + - grpc_lb_policy_round_robin - grpc_secure - grpc_codegen - census @@ -722,6 +740,9 @@ libs: - grpc_base - grpc_transport_chttp2_server_insecure - grpc_transport_chttp2_client_insecure + - grpc_lb_policy_grpclb + - grpc_lb_policy_pick_first + - grpc_lb_policy_round_robin - grpc_codegen - census - nanopb diff --git a/config.m4 b/config.m4 index fa249a99be1..dd1069cb255 100644 --- a/config.m4 +++ b/config.m4 @@ -80,6 +80,10 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/support/tmpfile_posix.c \ src/core/lib/support/tmpfile_win32.c \ src/core/lib/support/wrap_memcpy.c \ + src/core/ext/lb_policy/grpclb/load_balancer_api.c \ + src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c \ + src/core/ext/lb_policy/pick_first/pick_first.c \ + src/core/ext/lb_policy/round_robin/round_robin.c \ src/core/ext/transport/chttp2/client/insecure/channel_create.c \ src/core/ext/transport/chttp2/client/secure/secure_channel_create.c \ src/core/ext/transport/chttp2/server/insecure/server_chttp2.c \ @@ -127,9 +131,6 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/client_config/connector.c \ src/core/lib/client_config/default_initial_connect_string.c \ src/core/lib/client_config/initial_connect_string.c \ - src/core/ext/lb_policy/grpclb/load_balancer_api.c \ - src/core/ext/lb_policy/pick_first/pick_first.c \ - src/core/ext/lb_policy/round_robin/round_robin.c \ src/core/lib/client_config/lb_policy.c \ src/core/lib/client_config/lb_policy_factory.c \ src/core/lib/client_config/lb_policy_registry.c \ @@ -195,7 +196,6 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/json/json_reader.c \ src/core/lib/json/json_string.c \ src/core/lib/json/json_writer.c \ - src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c \ src/core/lib/security/b64.c \ src/core/lib/security/client_auth_filter.c \ src/core/lib/security/credentials.c \ @@ -546,6 +546,10 @@ if test "$PHP_GRPC" != "no"; then PHP_ADD_BUILD_DIR($ext_builddir/src/php/ext/grpc) PHP_ADD_BUILD_DIR($ext_builddir/src/boringssl) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/lb_policy/grpclb) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/lb_policy/pick_first) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/lb_policy/round_robin) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/client/insecure) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/client/secure) PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/server/insecure) @@ -554,7 +558,6 @@ if test "$PHP_GRPC" != "no"; then PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/census) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/channel) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/client_config) - PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/client_config/lb_policies) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/client_config/resolvers) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/compression) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/debug) @@ -562,7 +565,6 @@ if test "$PHP_GRPC" != "no"; then PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/iomgr) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/json) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/profiling) - PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/security) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/support) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/surface) diff --git a/gRPC.podspec b/gRPC.podspec index feedfdc9714..bf687f0accd 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -161,6 +161,10 @@ Pod::Spec.new do |s| 'src/core/lib/support/tmpfile_posix.c', 'src/core/lib/support/tmpfile_win32.c', 'src/core/lib/support/wrap_memcpy.c', + 'src/core/ext/lb_policy/grpclb/load_balancer_api.h', + 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h', + 'src/core/ext/lb_policy/pick_first/pick_first.h', + 'src/core/ext/lb_policy/round_robin/round_robin.h', 'src/core/ext/transport/chttp2/transport/alpn.h', 'src/core/ext/transport/chttp2/transport/bin_encoder.h', 'src/core/ext/transport/chttp2/transport/chttp2_transport.h', @@ -200,9 +204,6 @@ Pod::Spec.new do |s| 'src/core/lib/client_config/client_config.h', 'src/core/lib/client_config/connector.h', 'src/core/lib/client_config/initial_connect_string.h', - 'src/core/ext/lb_policy/grpclb/load_balancer_api.h', - 'src/core/ext/lb_policy/pick_first/pick_first.h', - 'src/core/ext/lb_policy/round_robin/round_robin.h', 'src/core/lib/client_config/lb_policy.h', 'src/core/lib/client_config/lb_policy_factory.h', 'src/core/lib/client_config/lb_policy_registry.h', @@ -262,7 +263,6 @@ Pod::Spec.new do |s| 'src/core/lib/json/json_common.h', 'src/core/lib/json/json_reader.h', 'src/core/lib/json/json_writer.h', - 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h', 'src/core/lib/security/auth_filters.h', 'src/core/lib/security/b64.h', 'src/core/lib/security/credentials.h', @@ -315,6 +315,10 @@ Pod::Spec.new do |s| 'include/grpc/impl/codegen/propagation_bits.h', 'include/grpc/impl/codegen/status.h', 'include/grpc/status.h', + 'src/core/ext/lb_policy/grpclb/load_balancer_api.c', + 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c', + 'src/core/ext/lb_policy/pick_first/pick_first.c', + 'src/core/ext/lb_policy/round_robin/round_robin.c', 'src/core/ext/transport/chttp2/client/insecure/channel_create.c', 'src/core/ext/transport/chttp2/client/secure/secure_channel_create.c', 'src/core/ext/transport/chttp2/server/insecure/server_chttp2.c', @@ -362,9 +366,6 @@ Pod::Spec.new do |s| 'src/core/lib/client_config/connector.c', 'src/core/lib/client_config/default_initial_connect_string.c', 'src/core/lib/client_config/initial_connect_string.c', - 'src/core/ext/lb_policy/grpclb/load_balancer_api.c', - 'src/core/ext/lb_policy/pick_first/pick_first.c', - 'src/core/ext/lb_policy/round_robin/round_robin.c', 'src/core/lib/client_config/lb_policy.c', 'src/core/lib/client_config/lb_policy_factory.c', 'src/core/lib/client_config/lb_policy_registry.c', @@ -430,7 +431,6 @@ Pod::Spec.new do |s| 'src/core/lib/json/json_reader.c', 'src/core/lib/json/json_string.c', 'src/core/lib/json/json_writer.c', - 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c', 'src/core/lib/security/b64.c', 'src/core/lib/security/client_auth_filter.c', 'src/core/lib/security/credentials.c', @@ -492,6 +492,10 @@ Pod::Spec.new do |s| 'src/core/lib/support/thd_internal.h', 'src/core/lib/support/time_precise.h', 'src/core/lib/support/tmpfile.h', + 'src/core/ext/lb_policy/grpclb/load_balancer_api.h', + 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h', + 'src/core/ext/lb_policy/pick_first/pick_first.h', + 'src/core/ext/lb_policy/round_robin/round_robin.h', 'src/core/ext/transport/chttp2/transport/alpn.h', 'src/core/ext/transport/chttp2/transport/bin_encoder.h', 'src/core/ext/transport/chttp2/transport/chttp2_transport.h', @@ -531,9 +535,6 @@ Pod::Spec.new do |s| 'src/core/lib/client_config/client_config.h', 'src/core/lib/client_config/connector.h', 'src/core/lib/client_config/initial_connect_string.h', - 'src/core/ext/lb_policy/grpclb/load_balancer_api.h', - 'src/core/ext/lb_policy/pick_first/pick_first.h', - 'src/core/ext/lb_policy/round_robin/round_robin.h', 'src/core/lib/client_config/lb_policy.h', 'src/core/lib/client_config/lb_policy_factory.h', 'src/core/lib/client_config/lb_policy_registry.h', @@ -593,7 +594,6 @@ Pod::Spec.new do |s| 'src/core/lib/json/json_common.h', 'src/core/lib/json/json_reader.h', 'src/core/lib/json/json_writer.h', - 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h', 'src/core/lib/security/auth_filters.h', 'src/core/lib/security/b64.h', 'src/core/lib/security/credentials.h', diff --git a/grpc.gemspec b/grpc.gemspec index 713a3f238fa..528fe3f58d4 100755 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -157,6 +157,10 @@ Gem::Specification.new do |s| s.files += %w( include/grpc/impl/codegen/propagation_bits.h ) s.files += %w( include/grpc/impl/codegen/status.h ) s.files += %w( include/grpc/status.h ) + s.files += %w( src/core/ext/lb_policy/grpclb/load_balancer_api.h ) + s.files += %w( src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h ) + s.files += %w( src/core/ext/lb_policy/pick_first/pick_first.h ) + s.files += %w( src/core/ext/lb_policy/round_robin/round_robin.h ) s.files += %w( src/core/ext/transport/chttp2/transport/alpn.h ) s.files += %w( src/core/ext/transport/chttp2/transport/bin_encoder.h ) s.files += %w( src/core/ext/transport/chttp2/transport/chttp2_transport.h ) @@ -196,9 +200,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/client_config/client_config.h ) s.files += %w( src/core/lib/client_config/connector.h ) s.files += %w( src/core/lib/client_config/initial_connect_string.h ) - s.files += %w( src/core/ext/lb_policy/grpclb/load_balancer_api.h ) - s.files += %w( src/core/ext/lb_policy/pick_first/pick_first.h ) - s.files += %w( src/core/ext/lb_policy/round_robin/round_robin.h ) s.files += %w( src/core/lib/client_config/lb_policy.h ) s.files += %w( src/core/lib/client_config/lb_policy_factory.h ) s.files += %w( src/core/lib/client_config/lb_policy_registry.h ) @@ -258,7 +259,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/json/json_common.h ) s.files += %w( src/core/lib/json/json_reader.h ) s.files += %w( src/core/lib/json/json_writer.h ) - s.files += %w( src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h ) s.files += %w( src/core/lib/security/auth_filters.h ) s.files += %w( src/core/lib/security/b64.h ) s.files += %w( src/core/lib/security/credentials.h ) @@ -298,6 +298,10 @@ Gem::Specification.new do |s| s.files += %w( third_party/nanopb/pb_common.h ) s.files += %w( third_party/nanopb/pb_decode.h ) s.files += %w( third_party/nanopb/pb_encode.h ) + s.files += %w( src/core/ext/lb_policy/grpclb/load_balancer_api.c ) + s.files += %w( src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c ) + s.files += %w( src/core/ext/lb_policy/pick_first/pick_first.c ) + s.files += %w( src/core/ext/lb_policy/round_robin/round_robin.c ) s.files += %w( src/core/ext/transport/chttp2/client/insecure/channel_create.c ) s.files += %w( src/core/ext/transport/chttp2/client/secure/secure_channel_create.c ) s.files += %w( src/core/ext/transport/chttp2/server/insecure/server_chttp2.c ) @@ -345,9 +349,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/client_config/connector.c ) s.files += %w( src/core/lib/client_config/default_initial_connect_string.c ) s.files += %w( src/core/lib/client_config/initial_connect_string.c ) - s.files += %w( src/core/ext/lb_policy/grpclb/load_balancer_api.c ) - s.files += %w( src/core/ext/lb_policy/pick_first/pick_first.c ) - s.files += %w( src/core/ext/lb_policy/round_robin/round_robin.c ) s.files += %w( src/core/lib/client_config/lb_policy.c ) s.files += %w( src/core/lib/client_config/lb_policy_factory.c ) s.files += %w( src/core/lib/client_config/lb_policy_registry.c ) @@ -413,7 +414,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/json/json_reader.c ) s.files += %w( src/core/lib/json/json_string.c ) s.files += %w( src/core/lib/json/json_writer.c ) - s.files += %w( src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c ) s.files += %w( src/core/lib/security/b64.c ) s.files += %w( src/core/lib/security/client_auth_filter.c ) s.files += %w( src/core/lib/security/credentials.c ) diff --git a/package.json b/package.json index c07ceb2e0c9..fa7ed029543 100644 --- a/package.json +++ b/package.json @@ -100,6 +100,10 @@ "include/grpc/impl/codegen/propagation_bits.h", "include/grpc/impl/codegen/status.h", "include/grpc/status.h", + "src/core/ext/lb_policy/grpclb/load_balancer_api.h", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", + "src/core/ext/lb_policy/pick_first/pick_first.h", + "src/core/ext/lb_policy/round_robin/round_robin.h", "src/core/ext/transport/chttp2/transport/alpn.h", "src/core/ext/transport/chttp2/transport/bin_encoder.h", "src/core/ext/transport/chttp2/transport/chttp2_transport.h", @@ -139,9 +143,6 @@ "src/core/lib/client_config/client_config.h", "src/core/lib/client_config/connector.h", "src/core/lib/client_config/initial_connect_string.h", - "src/core/ext/lb_policy/grpclb/load_balancer_api.h", - "src/core/ext/lb_policy/pick_first/pick_first.h", - "src/core/ext/lb_policy/round_robin/round_robin.h", "src/core/lib/client_config/lb_policy.h", "src/core/lib/client_config/lb_policy_factory.h", "src/core/lib/client_config/lb_policy_registry.h", @@ -201,7 +202,6 @@ "src/core/lib/json/json_common.h", "src/core/lib/json/json_reader.h", "src/core/lib/json/json_writer.h", - "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", "src/core/lib/security/auth_filters.h", "src/core/lib/security/b64.h", "src/core/lib/security/credentials.h", @@ -241,6 +241,10 @@ "third_party/nanopb/pb_common.h", "third_party/nanopb/pb_decode.h", "third_party/nanopb/pb_encode.h", + "src/core/ext/lb_policy/grpclb/load_balancer_api.c", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", + "src/core/ext/lb_policy/pick_first/pick_first.c", + "src/core/ext/lb_policy/round_robin/round_robin.c", "src/core/ext/transport/chttp2/client/insecure/channel_create.c", "src/core/ext/transport/chttp2/client/secure/secure_channel_create.c", "src/core/ext/transport/chttp2/server/insecure/server_chttp2.c", @@ -288,9 +292,6 @@ "src/core/lib/client_config/connector.c", "src/core/lib/client_config/default_initial_connect_string.c", "src/core/lib/client_config/initial_connect_string.c", - "src/core/ext/lb_policy/grpclb/load_balancer_api.c", - "src/core/ext/lb_policy/pick_first/pick_first.c", - "src/core/ext/lb_policy/round_robin/round_robin.c", "src/core/lib/client_config/lb_policy.c", "src/core/lib/client_config/lb_policy_factory.c", "src/core/lib/client_config/lb_policy_registry.c", @@ -356,7 +357,6 @@ "src/core/lib/json/json_reader.c", "src/core/lib/json/json_string.c", "src/core/lib/json/json_writer.c", - "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", "src/core/lib/security/b64.c", "src/core/lib/security/client_auth_filter.c", "src/core/lib/security/credentials.c", diff --git a/package.xml b/package.xml index 9975360af95..e29c55d69f9 100644 --- a/package.xml +++ b/package.xml @@ -161,6 +161,10 @@ + + + + @@ -200,9 +204,6 @@ - - - @@ -262,7 +263,6 @@ - @@ -302,6 +302,10 @@ + + + + @@ -349,9 +353,6 @@ - - - @@ -417,7 +418,6 @@ - diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 509a45d29d1..8c7890c0943 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -74,6 +74,10 @@ CORE_SOURCE_FILES = [ 'src/core/lib/support/tmpfile_posix.c', 'src/core/lib/support/tmpfile_win32.c', 'src/core/lib/support/wrap_memcpy.c', + 'src/core/ext/lb_policy/grpclb/load_balancer_api.c', + 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c', + 'src/core/ext/lb_policy/pick_first/pick_first.c', + 'src/core/ext/lb_policy/round_robin/round_robin.c', 'src/core/ext/transport/chttp2/client/insecure/channel_create.c', 'src/core/ext/transport/chttp2/client/secure/secure_channel_create.c', 'src/core/ext/transport/chttp2/server/insecure/server_chttp2.c', @@ -121,9 +125,6 @@ CORE_SOURCE_FILES = [ 'src/core/lib/client_config/connector.c', 'src/core/lib/client_config/default_initial_connect_string.c', 'src/core/lib/client_config/initial_connect_string.c', - 'src/core/ext/lb_policy/grpclb/load_balancer_api.c', - 'src/core/ext/lb_policy/pick_first/pick_first.c', - 'src/core/ext/lb_policy/round_robin/round_robin.c', 'src/core/lib/client_config/lb_policy.c', 'src/core/lib/client_config/lb_policy_factory.c', 'src/core/lib/client_config/lb_policy_registry.c', @@ -189,7 +190,6 @@ CORE_SOURCE_FILES = [ 'src/core/lib/json/json_reader.c', 'src/core/lib/json/json_string.c', 'src/core/lib/json/json_writer.c', - 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c', 'src/core/lib/security/b64.c', 'src/core/lib/security/client_auth_filter.c', 'src/core/lib/security/credentials.c', diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 2d308dbcf49..d3b7e2b8a28 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -773,6 +773,10 @@ include/grpc/impl/codegen/grpc_types.h \ include/grpc/impl/codegen/propagation_bits.h \ include/grpc/impl/codegen/status.h \ include/grpc/status.h \ +src/core/ext/lb_policy/grpclb/load_balancer_api.h \ +src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h \ +src/core/ext/lb_policy/pick_first/pick_first.h \ +src/core/ext/lb_policy/round_robin/round_robin.h \ src/core/ext/transport/chttp2/transport/alpn.h \ src/core/ext/transport/chttp2/transport/bin_encoder.h \ src/core/ext/transport/chttp2/transport/chttp2_transport.h \ @@ -812,9 +816,6 @@ src/core/lib/channel/subchannel_call_holder.h \ src/core/lib/client_config/client_config.h \ src/core/lib/client_config/connector.h \ src/core/lib/client_config/initial_connect_string.h \ -src/core/ext/lb_policy/grpclb/load_balancer_api.h \ -src/core/ext/lb_policy/pick_first/pick_first.h \ -src/core/ext/lb_policy/round_robin/round_robin.h \ src/core/lib/client_config/lb_policy.h \ src/core/lib/client_config/lb_policy_factory.h \ src/core/lib/client_config/lb_policy_registry.h \ @@ -874,7 +875,6 @@ src/core/lib/json/json.h \ src/core/lib/json/json_common.h \ src/core/lib/json/json_reader.h \ src/core/lib/json/json_writer.h \ -src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h \ src/core/lib/security/auth_filters.h \ src/core/lib/security/b64.h \ src/core/lib/security/credentials.h \ @@ -914,6 +914,10 @@ third_party/nanopb/pb.h \ third_party/nanopb/pb_common.h \ third_party/nanopb/pb_decode.h \ third_party/nanopb/pb_encode.h \ +src/core/ext/lb_policy/grpclb/load_balancer_api.c \ +src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c \ +src/core/ext/lb_policy/pick_first/pick_first.c \ +src/core/ext/lb_policy/round_robin/round_robin.c \ src/core/ext/transport/chttp2/client/insecure/channel_create.c \ src/core/ext/transport/chttp2/client/secure/secure_channel_create.c \ src/core/ext/transport/chttp2/server/insecure/server_chttp2.c \ @@ -961,9 +965,6 @@ src/core/lib/client_config/client_config.c \ src/core/lib/client_config/connector.c \ src/core/lib/client_config/default_initial_connect_string.c \ src/core/lib/client_config/initial_connect_string.c \ -src/core/ext/lb_policy/grpclb/load_balancer_api.c \ -src/core/ext/lb_policy/pick_first/pick_first.c \ -src/core/ext/lb_policy/round_robin/round_robin.c \ src/core/lib/client_config/lb_policy.c \ src/core/lib/client_config/lb_policy_factory.c \ src/core/lib/client_config/lb_policy_registry.c \ @@ -1029,7 +1030,6 @@ src/core/lib/json/json.c \ src/core/lib/json/json_reader.c \ src/core/lib/json/json_string.c \ src/core/lib/json/json_writer.c \ -src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c \ src/core/lib/security/b64.c \ src/core/lib/security/client_auth_filter.c \ src/core/lib/security/credentials.c \ diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index 4627a7c7bc3..3337c84b10a 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -3924,6 +3924,10 @@ "include/grpc/impl/codegen/propagation_bits.h", "include/grpc/impl/codegen/status.h", "include/grpc/status.h", + "src/core/ext/lb_policy/grpclb/load_balancer_api.h", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", + "src/core/ext/lb_policy/pick_first/pick_first.h", + "src/core/ext/lb_policy/round_robin/round_robin.h", "src/core/ext/transport/chttp2/transport/alpn.h", "src/core/ext/transport/chttp2/transport/bin_encoder.h", "src/core/ext/transport/chttp2/transport/chttp2_transport.h", @@ -3963,9 +3967,6 @@ "src/core/lib/client_config/client_config.h", "src/core/lib/client_config/connector.h", "src/core/lib/client_config/initial_connect_string.h", - "src/core/ext/lb_policy/grpclb/load_balancer_api.h", - "src/core/ext/lb_policy/pick_first/pick_first.h", - "src/core/ext/lb_policy/round_robin/round_robin.h", "src/core/lib/client_config/lb_policy.h", "src/core/lib/client_config/lb_policy_factory.h", "src/core/lib/client_config/lb_policy_registry.h", @@ -4025,7 +4026,6 @@ "src/core/lib/json/json_common.h", "src/core/lib/json/json_reader.h", "src/core/lib/json/json_writer.h", - "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", "src/core/lib/security/auth_filters.h", "src/core/lib/security/b64.h", "src/core/lib/security/credentials.h", @@ -4082,6 +4082,14 @@ "include/grpc/impl/codegen/propagation_bits.h", "include/grpc/impl/codegen/status.h", "include/grpc/status.h", + "src/core/ext/lb_policy/grpclb/load_balancer_api.c", + "src/core/ext/lb_policy/grpclb/load_balancer_api.h", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", + "src/core/ext/lb_policy/pick_first/pick_first.c", + "src/core/ext/lb_policy/pick_first/pick_first.h", + "src/core/ext/lb_policy/round_robin/round_robin.c", + "src/core/ext/lb_policy/round_robin/round_robin.h", "src/core/ext/transport/chttp2/client/insecure/channel_create.c", "src/core/ext/transport/chttp2/client/secure/secure_channel_create.c", "src/core/ext/transport/chttp2/server/insecure/server_chttp2.c", @@ -4168,12 +4176,6 @@ "src/core/lib/client_config/default_initial_connect_string.c", "src/core/lib/client_config/initial_connect_string.c", "src/core/lib/client_config/initial_connect_string.h", - "src/core/ext/lb_policy/grpclb/load_balancer_api.c", - "src/core/ext/lb_policy/grpclb/load_balancer_api.h", - "src/core/ext/lb_policy/pick_first/pick_first.c", - "src/core/ext/lb_policy/pick_first/pick_first.h", - "src/core/ext/lb_policy/round_robin/round_robin.c", - "src/core/ext/lb_policy/round_robin/round_robin.h", "src/core/lib/client_config/lb_policy.c", "src/core/lib/client_config/lb_policy.h", "src/core/lib/client_config/lb_policy_factory.c", @@ -4298,8 +4300,6 @@ "src/core/lib/json/json_string.c", "src/core/lib/json/json_writer.c", "src/core/lib/json/json_writer.h", - "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", - "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", "src/core/lib/security/auth_filters.h", "src/core/lib/security/b64.c", "src/core/lib/security/b64.h", @@ -4552,6 +4552,10 @@ "include/grpc/impl/codegen/propagation_bits.h", "include/grpc/impl/codegen/status.h", "include/grpc/status.h", + "src/core/ext/lb_policy/grpclb/load_balancer_api.h", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", + "src/core/ext/lb_policy/pick_first/pick_first.h", + "src/core/ext/lb_policy/round_robin/round_robin.h", "src/core/ext/transport/chttp2/transport/alpn.h", "src/core/ext/transport/chttp2/transport/bin_encoder.h", "src/core/ext/transport/chttp2/transport/chttp2_transport.h", @@ -4591,9 +4595,6 @@ "src/core/lib/client_config/client_config.h", "src/core/lib/client_config/connector.h", "src/core/lib/client_config/initial_connect_string.h", - "src/core/ext/lb_policy/grpclb/load_balancer_api.h", - "src/core/ext/lb_policy/pick_first/pick_first.h", - "src/core/ext/lb_policy/round_robin/round_robin.h", "src/core/lib/client_config/lb_policy.h", "src/core/lib/client_config/lb_policy_factory.h", "src/core/lib/client_config/lb_policy_registry.h", @@ -4653,7 +4654,6 @@ "src/core/lib/json/json_common.h", "src/core/lib/json/json_reader.h", "src/core/lib/json/json_writer.h", - "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", "src/core/lib/statistics/census_interface.h", "src/core/lib/statistics/census_rpc_stats.h", "src/core/lib/surface/api_trace.h", @@ -4695,6 +4695,14 @@ "include/grpc/impl/codegen/propagation_bits.h", "include/grpc/impl/codegen/status.h", "include/grpc/status.h", + "src/core/ext/lb_policy/grpclb/load_balancer_api.c", + "src/core/ext/lb_policy/grpclb/load_balancer_api.h", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", + "src/core/ext/lb_policy/pick_first/pick_first.c", + "src/core/ext/lb_policy/pick_first/pick_first.h", + "src/core/ext/lb_policy/round_robin/round_robin.c", + "src/core/ext/lb_policy/round_robin/round_robin.h", "src/core/ext/transport/chttp2/client/insecure/channel_create.c", "src/core/ext/transport/chttp2/server/insecure/server_chttp2.c", "src/core/ext/transport/chttp2/transport/alpn.c", @@ -4779,12 +4787,6 @@ "src/core/lib/client_config/default_initial_connect_string.c", "src/core/lib/client_config/initial_connect_string.c", "src/core/lib/client_config/initial_connect_string.h", - "src/core/ext/lb_policy/grpclb/load_balancer_api.c", - "src/core/ext/lb_policy/grpclb/load_balancer_api.h", - "src/core/ext/lb_policy/pick_first/pick_first.c", - "src/core/ext/lb_policy/pick_first/pick_first.h", - "src/core/ext/lb_policy/round_robin/round_robin.c", - "src/core/ext/lb_policy/round_robin/round_robin.h", "src/core/lib/client_config/lb_policy.c", "src/core/lib/client_config/lb_policy.h", "src/core/lib/client_config/lb_policy_factory.c", @@ -4908,8 +4910,6 @@ "src/core/lib/json/json_string.c", "src/core/lib/json/json_writer.c", "src/core/lib/json/json_writer.h", - "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", - "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", "src/core/lib/statistics/census_interface.h", "src/core/lib/statistics/census_rpc_stats.h", "src/core/lib/surface/alarm.c", diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj b/vsprojects/vcxproj/grpc/grpc.vcxproj index c20f8d70708..678f913e45f 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj @@ -282,6 +282,10 @@ + + + + @@ -321,9 +325,6 @@ - - - @@ -383,7 +384,6 @@ - @@ -425,6 +425,14 @@ + + + + + + + + @@ -519,12 +527,6 @@ - - - - - - @@ -655,8 +657,6 @@ - - diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters index f03b20703f7..60d0811ec5c 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters @@ -1,6 +1,18 @@ + + src\core\ext\lb_policy\grpclb + + + src\core\ext\lb_policy\grpclb\proto\grpc\lb\v0 + + + src\core\ext\lb_policy\pick_first + + + src\core\ext\lb_policy\round_robin + src\core\ext\transport\chttp2\client\insecure @@ -142,15 +154,6 @@ src\core\lib\client_config - - src\core\lib\client_config\lb_policies - - - src\core\lib\client_config\lb_policies - - - src\core\lib\client_config\lb_policies - src\core\lib\client_config @@ -346,9 +349,6 @@ src\core\lib\json - - src\core\lib\proto\grpc\lb\v0 - src\core\lib\security @@ -536,6 +536,18 @@ + + src\core\ext\lb_policy\grpclb + + + src\core\ext\lb_policy\grpclb\proto\grpc\lb\v0 + + + src\core\ext\lb_policy\pick_first + + + src\core\ext\lb_policy\round_robin + src\core\ext\transport\chttp2\transport @@ -653,15 +665,6 @@ src\core\lib\client_config - - src\core\lib\client_config\lb_policies - - - src\core\lib\client_config\lb_policies - - - src\core\lib\client_config\lb_policies - src\core\lib\client_config @@ -839,9 +842,6 @@ src\core\lib\json - - src\core\lib\proto\grpc\lb\v0 - src\core\lib\security @@ -983,6 +983,30 @@ {3f32a58f-394f-5f13-06aa-6cc52cc2daaf} + + {030f00ff-6c54-76c8-12df-37e3008335d1} + + + {fe41339e-53fb-39b3-7457-7a0fbb238dbe} + + + {a7c27f6b-6d15-01cf-76d9-c30dddea0990} + + + {bc714e6d-8aba-91df-7db9-7f189f05a6ff} + + + {adf7e553-94ef-14fd-e845-03104f00a06f} + + + {0406d191-8817-38c3-a562-e3541201f424} + + + {b63ded00-b24f-708e-333f-ce199e421875} + + + {2472d352-cf94-f317-646e-72b769cea846} + {e3abfd0a-064e-0f2f-c8e8-7c5a7e98142a} @@ -1022,9 +1046,6 @@ {2f3260de-be57-d18d-6882-61d115baa159} - - {118d2bb5-086f-54f3-11de-26d7d7f73f9d} - {b9d8db6c-2c68-1c90-fe5e-37da90f47ae6} @@ -1043,18 +1064,6 @@ {cb2b0073-f2a7-5c63-d182-8874b24bdf36} - - {b4b19f9a-1575-8a21-0bca-537746f858b7} - - - {cbc8ce67-4a97-d533-8dc3-f949c63e2771} - - - {933530ae-447b-ea8d-3531-98f0556960b0} - - - {c33f944f-37d4-42fd-abc3-61f0d4400462} - {c4661d64-349f-01c1-1ba8-0602f9047595} diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj index e89cc8a1257..a2426c7712a 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj @@ -272,6 +272,10 @@ + + + + @@ -311,9 +315,6 @@ - - - @@ -373,7 +374,6 @@ - @@ -401,6 +401,14 @@ + + + + + + + + @@ -491,12 +499,6 @@ - - - - - - @@ -625,8 +627,6 @@ - - diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters index c9f1ad69433..dee6778ffb4 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters @@ -1,6 +1,18 @@ + + src\core\ext\lb_policy\grpclb + + + src\core\ext\lb_policy\grpclb\proto\grpc\lb\v0 + + + src\core\ext\lb_policy\pick_first + + + src\core\ext\lb_policy\round_robin + src\core\ext\transport\chttp2\client\insecure @@ -136,15 +148,6 @@ src\core\lib\client_config - - src\core\lib\client_config\lb_policies - - - src\core\lib\client_config\lb_policies - - - src\core\lib\client_config\lb_policies - src\core\lib\client_config @@ -337,9 +340,6 @@ src\core\lib\json - - src\core\lib\proto\grpc\lb\v0 - src\core\lib\surface @@ -473,6 +473,18 @@ + + src\core\ext\lb_policy\grpclb + + + src\core\ext\lb_policy\grpclb\proto\grpc\lb\v0 + + + src\core\ext\lb_policy\pick_first + + + src\core\ext\lb_policy\round_robin + src\core\ext\transport\chttp2\transport @@ -590,15 +602,6 @@ src\core\lib\client_config - - src\core\lib\client_config\lb_policies - - - src\core\lib\client_config\lb_policies - - - src\core\lib\client_config\lb_policies - src\core\lib\client_config @@ -776,9 +779,6 @@ src\core\lib\json - - src\core\lib\proto\grpc\lb\v0 - src\core\lib\statistics @@ -878,6 +878,30 @@ {82f86e8c-00a4-f566-d235-670fc629798d} + + {a23781d2-27e4-7cb0-12cd-59782ecb21ce} + + + {25a465c8-d1e8-6248-c005-bb2062206472} + + + {40fc2615-d244-0d36-4486-ba6f0fa468bb} + + + {1d129f24-a399-12ef-68de-023aff7dde52} + + + {21858d9d-30b5-8847-5882-6b47df0fa293} + + + {1795a20b-3e7c-e27d-eae1-96582fa9a958} + + + {e27f9ecf-97bb-1a2e-3135-a41f732dcf55} + + + {e5fc1091-5d60-404f-775b-686ef4b3266f} + {967c89fe-c97c-27e2-aac0-9ba5854cb5fa} @@ -911,9 +935,6 @@ {29ca2974-89e4-1a74-3e4d-0d63e2f77566} - - {6c7e36d4-6117-e0cd-c886-b9eb3c994927} - {2d959ef9-9703-dc92-a56f-9fe136dadfb9} @@ -932,18 +953,6 @@ {681cdaeb-c47f-8853-d985-bf13c2873947} - - {4bfbd6c6-f6a8-c6b3-5186-b788f4e11e23} - - - {60f3ab7d-ea44-348f-671e-77fdebbd18bb} - - - {bcd33510-32e7-c2fb-e11d-a3655f97bc84} - - - {bb9b8c80-9eff-5ab6-5b29-c2d54f0fc192} - {d0ab6d54-ae25-fc49-3656-91d9db57366a} From 04b7ca8d5cd99bf96543c7ab4d516586f62ad99c Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 29 Mar 2016 08:07:54 -0700 Subject: [PATCH 27/36] Starting plugin registry --- build.yaml | 4 ++ .../plugin_registry/grpc_plugin_registry.c | 32 ++++++++++++++++ .../grpc_unsecure_plugin_registry.c | 32 ++++++++++++++++ templates/src/core/plugin_registry.template | 38 +++++++++++++++++++ 4 files changed, 106 insertions(+) create mode 100644 src/core/plugin_registry/grpc_plugin_registry.c create mode 100644 src/core/plugin_registry/grpc_unsecure_plugin_registry.c create mode 100644 templates/src/core/plugin_registry.template diff --git a/build.yaml b/build.yaml index 6b9d0929758..8351c20449f 100644 --- a/build.yaml +++ b/build.yaml @@ -472,6 +472,7 @@ filegroups: - src/core/ext/lb_policy/pick_first/pick_first.h src: - src/core/ext/lb_policy/pick_first/pick_first.c + plugin: grpc_lb_policy_pick_first uses: - grpc_base - name: grpc_lb_policy_round_robin @@ -479,6 +480,7 @@ filegroups: - src/core/ext/lb_policy/round_robin/round_robin.h src: - src/core/ext/lb_policy/round_robin/round_robin.c + plugin: grpc_lb_policy_round_robin uses: - grpc_base - name: grpc_secure @@ -661,6 +663,7 @@ libs: - grpc_codegen - census - nanopb + generate_plugin_registry: true secure: true vs_packages: - grpc.dependencies.openssl @@ -746,6 +749,7 @@ libs: - grpc_codegen - census - nanopb + generate_plugin_registry: true secure: false vs_project_guid: '{46CEDFFF-9692-456A-AA24-38B5D6BCF4C5}' - name: grpc_zookeeper diff --git a/src/core/plugin_registry/grpc_plugin_registry.c b/src/core/plugin_registry/grpc_plugin_registry.c new file mode 100644 index 00000000000..b0ac5249328 --- /dev/null +++ b/src/core/plugin_registry/grpc_plugin_registry.c @@ -0,0 +1,32 @@ +/* + * + * Copyright 2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ diff --git a/src/core/plugin_registry/grpc_unsecure_plugin_registry.c b/src/core/plugin_registry/grpc_unsecure_plugin_registry.c new file mode 100644 index 00000000000..b0ac5249328 --- /dev/null +++ b/src/core/plugin_registry/grpc_unsecure_plugin_registry.c @@ -0,0 +1,32 @@ +/* + * + * Copyright 2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ diff --git a/templates/src/core/plugin_registry.template b/templates/src/core/plugin_registry.template new file mode 100644 index 00000000000..5d522c6e9df --- /dev/null +++ b/templates/src/core/plugin_registry.template @@ -0,0 +1,38 @@ +%YAML 1.2 +--- +foreach: libs +cond: selected.get('generate_plugin_registry', False) +output_name: ${selected.name}_plugin_registry.c +template: | + /* + * + * Copyright 2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ From fb433852042e53e010ae1215bc846052ddac2e9b Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 29 Mar 2016 08:51:07 -0700 Subject: [PATCH 28/36] Make plugin registries work --- BUILD | 9 ++-- Makefile | 3 ++ binding.gyp | 1 + build.yaml | 4 -- config.m4 | 2 + gRPC.podspec | 5 +- grpc.gemspec | 3 +- package.json | 3 +- package.xml | 3 +- .../ext/lb_policy/pick_first/pick_first.c | 38 +++++++++------ .../ext/lb_policy/pick_first/pick_first.h | 43 ----------------- .../ext/lb_policy/round_robin/round_robin.c | 29 ++++++++---- .../ext/lb_policy/round_robin/round_robin.h | 46 ------------------- src/core/lib/surface/init.c | 5 -- .../plugin_registry/grpc_plugin_registry.c | 14 ++++++ .../grpc_unsecure_plugin_registry.c | 14 ++++++ src/python/grpcio/grpc_core_dependencies.py | 1 + templates/src/core/plugin_registry.template | 14 ++++++ test/core/client_config/lb_policies_test.c | 3 +- tools/buildgen/plugins/expand_filegroups.py | 20 +++++++- tools/doxygen/Doxyfile.core.internal | 3 +- tools/run_tests/sources_and_headers.json | 14 ++---- vsprojects/vcxproj/grpc/grpc.vcxproj | 4 +- vsprojects/vcxproj/grpc/grpc.vcxproj.filters | 12 ++--- .../grpc_unsecure/grpc_unsecure.vcxproj | 4 +- .../grpc_unsecure.vcxproj.filters | 12 ++--- 26 files changed, 139 insertions(+), 170 deletions(-) delete mode 100644 src/core/ext/lb_policy/pick_first/pick_first.h delete mode 100644 src/core/ext/lb_policy/round_robin/round_robin.h diff --git a/BUILD b/BUILD index f6f02d2244f..22cbf3d0afd 100644 --- a/BUILD +++ b/BUILD @@ -159,8 +159,6 @@ cc_library( srcs = [ "src/core/ext/lb_policy/grpclb/load_balancer_api.h", "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", - "src/core/ext/lb_policy/pick_first/pick_first.h", - "src/core/ext/lb_policy/round_robin/round_robin.h", "src/core/ext/transport/chttp2/transport/alpn.h", "src/core/ext/transport/chttp2/transport/bin_encoder.h", "src/core/ext/transport/chttp2/transport/chttp2_transport.h", @@ -459,6 +457,7 @@ cc_library( "src/core/lib/tsi/fake_transport_security.c", "src/core/lib/tsi/ssl_transport_security.c", "src/core/lib/tsi/transport_security.c", + "src/core/plugin_registry/grpc_plugin_registry.c", "third_party/nanopb/pb_common.c", "third_party/nanopb/pb_decode.c", "third_party/nanopb/pb_encode.c", @@ -534,8 +533,6 @@ cc_library( srcs = [ "src/core/ext/lb_policy/grpclb/load_balancer_api.h", "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", - "src/core/ext/lb_policy/pick_first/pick_first.h", - "src/core/ext/lb_policy/round_robin/round_robin.h", "src/core/ext/transport/chttp2/transport/alpn.h", "src/core/ext/transport/chttp2/transport/bin_encoder.h", "src/core/ext/transport/chttp2/transport/chttp2_transport.h", @@ -800,6 +797,7 @@ cc_library( "src/core/lib/transport/static_metadata.c", "src/core/lib/transport/transport.c", "src/core/lib/transport/transport_op_string.c", + "src/core/plugin_registry/grpc_unsecure_plugin_registry.c", "third_party/nanopb/pb_common.c", "third_party/nanopb/pb_decode.c", "third_party/nanopb/pb_encode.c", @@ -1521,6 +1519,7 @@ objc_library( "src/core/lib/tsi/fake_transport_security.c", "src/core/lib/tsi/ssl_transport_security.c", "src/core/lib/tsi/transport_security.c", + "src/core/plugin_registry/grpc_plugin_registry.c", "third_party/nanopb/pb_common.c", "third_party/nanopb/pb_decode.c", "third_party/nanopb/pb_encode.c", @@ -1541,8 +1540,6 @@ objc_library( "include/grpc/status.h", "src/core/ext/lb_policy/grpclb/load_balancer_api.h", "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", - "src/core/ext/lb_policy/pick_first/pick_first.h", - "src/core/ext/lb_policy/round_robin/round_robin.h", "src/core/ext/transport/chttp2/transport/alpn.h", "src/core/ext/transport/chttp2/transport/bin_encoder.h", "src/core/ext/transport/chttp2/transport/chttp2_transport.h", diff --git a/Makefile b/Makefile index e5f83e8a148..7b7200b6aee 100644 --- a/Makefile +++ b/Makefile @@ -2581,6 +2581,7 @@ LIBGRPC_SRC = \ src/core/lib/tsi/fake_transport_security.c \ src/core/lib/tsi/ssl_transport_security.c \ src/core/lib/tsi/transport_security.c \ + src/core/plugin_registry/grpc_plugin_registry.c \ third_party/nanopb/pb_common.c \ third_party/nanopb/pb_decode.c \ third_party/nanopb/pb_encode.c \ @@ -2922,6 +2923,7 @@ LIBGRPC_UNSECURE_SRC = \ src/core/lib/transport/static_metadata.c \ src/core/lib/transport/transport.c \ src/core/lib/transport/transport_op_string.c \ + src/core/plugin_registry/grpc_unsecure_plugin_registry.c \ third_party/nanopb/pb_common.c \ third_party/nanopb/pb_decode.c \ third_party/nanopb/pb_encode.c \ @@ -13492,6 +13494,7 @@ src/core/lib/surface/init_secure.c: $(OPENSSL_DEP) src/core/lib/tsi/fake_transport_security.c: $(OPENSSL_DEP) src/core/lib/tsi/ssl_transport_security.c: $(OPENSSL_DEP) src/core/lib/tsi/transport_security.c: $(OPENSSL_DEP) +src/core/plugin_registry/grpc_plugin_registry.c: $(OPENSSL_DEP) src/cpp/client/secure_credentials.cc: $(OPENSSL_DEP) src/cpp/common/auth_property_iterator.cc: $(OPENSSL_DEP) src/cpp/common/secure_auth_context.cc: $(OPENSSL_DEP) diff --git a/binding.gyp b/binding.gyp index 068161ba06b..bfae59e50ce 100644 --- a/binding.gyp +++ b/binding.gyp @@ -719,6 +719,7 @@ 'src/core/lib/tsi/fake_transport_security.c', 'src/core/lib/tsi/ssl_transport_security.c', 'src/core/lib/tsi/transport_security.c', + 'src/core/plugin_registry/grpc_plugin_registry.c', 'third_party/nanopb/pb_common.c', 'third_party/nanopb/pb_decode.c', 'third_party/nanopb/pb_encode.c', diff --git a/build.yaml b/build.yaml index 8351c20449f..de4deeb9289 100644 --- a/build.yaml +++ b/build.yaml @@ -468,16 +468,12 @@ filegroups: uses: - grpc_base - name: grpc_lb_policy_pick_first - headers: - - src/core/ext/lb_policy/pick_first/pick_first.h src: - src/core/ext/lb_policy/pick_first/pick_first.c plugin: grpc_lb_policy_pick_first uses: - grpc_base - name: grpc_lb_policy_round_robin - headers: - - src/core/ext/lb_policy/round_robin/round_robin.h src: - src/core/ext/lb_policy/round_robin/round_robin.c plugin: grpc_lb_policy_round_robin diff --git a/config.m4 b/config.m4 index dd1069cb255..1b414a1142b 100644 --- a/config.m4 +++ b/config.m4 @@ -241,6 +241,7 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/tsi/fake_transport_security.c \ src/core/lib/tsi/ssl_transport_security.c \ src/core/lib/tsi/transport_security.c \ + src/core/plugin_registry/grpc_plugin_registry.c \ third_party/nanopb/pb_common.c \ third_party/nanopb/pb_decode.c \ third_party/nanopb/pb_encode.c \ @@ -570,6 +571,7 @@ if test "$PHP_GRPC" != "no"; then PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/surface) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/transport) PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/tsi) + PHP_ADD_BUILD_DIR($ext_builddir/src/core/plugin_registry) PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/crypto) PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/crypto/aes) PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl/crypto/asn1) diff --git a/gRPC.podspec b/gRPC.podspec index bf687f0accd..d94905ce2a6 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -163,8 +163,6 @@ Pod::Spec.new do |s| 'src/core/lib/support/wrap_memcpy.c', 'src/core/ext/lb_policy/grpclb/load_balancer_api.h', 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h', - 'src/core/ext/lb_policy/pick_first/pick_first.h', - 'src/core/ext/lb_policy/round_robin/round_robin.h', 'src/core/ext/transport/chttp2/transport/alpn.h', 'src/core/ext/transport/chttp2/transport/bin_encoder.h', 'src/core/ext/transport/chttp2/transport/chttp2_transport.h', @@ -476,6 +474,7 @@ Pod::Spec.new do |s| 'src/core/lib/tsi/fake_transport_security.c', 'src/core/lib/tsi/ssl_transport_security.c', 'src/core/lib/tsi/transport_security.c', + 'src/core/plugin_registry/grpc_plugin_registry.c', 'third_party/nanopb/pb_common.c', 'third_party/nanopb/pb_decode.c', 'third_party/nanopb/pb_encode.c' @@ -494,8 +493,6 @@ Pod::Spec.new do |s| 'src/core/lib/support/tmpfile.h', 'src/core/ext/lb_policy/grpclb/load_balancer_api.h', 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h', - 'src/core/ext/lb_policy/pick_first/pick_first.h', - 'src/core/ext/lb_policy/round_robin/round_robin.h', 'src/core/ext/transport/chttp2/transport/alpn.h', 'src/core/ext/transport/chttp2/transport/bin_encoder.h', 'src/core/ext/transport/chttp2/transport/chttp2_transport.h', diff --git a/grpc.gemspec b/grpc.gemspec index 528fe3f58d4..e96bedb5875 100755 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -159,8 +159,6 @@ Gem::Specification.new do |s| s.files += %w( include/grpc/status.h ) s.files += %w( src/core/ext/lb_policy/grpclb/load_balancer_api.h ) s.files += %w( src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h ) - s.files += %w( src/core/ext/lb_policy/pick_first/pick_first.h ) - s.files += %w( src/core/ext/lb_policy/round_robin/round_robin.h ) s.files += %w( src/core/ext/transport/chttp2/transport/alpn.h ) s.files += %w( src/core/ext/transport/chttp2/transport/bin_encoder.h ) s.files += %w( src/core/ext/transport/chttp2/transport/chttp2_transport.h ) @@ -459,6 +457,7 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/tsi/fake_transport_security.c ) s.files += %w( src/core/lib/tsi/ssl_transport_security.c ) s.files += %w( src/core/lib/tsi/transport_security.c ) + s.files += %w( src/core/plugin_registry/grpc_plugin_registry.c ) s.files += %w( third_party/nanopb/pb_common.c ) s.files += %w( third_party/nanopb/pb_decode.c ) s.files += %w( third_party/nanopb/pb_encode.c ) diff --git a/package.json b/package.json index fa7ed029543..cbcfc19ee3c 100644 --- a/package.json +++ b/package.json @@ -102,8 +102,6 @@ "include/grpc/status.h", "src/core/ext/lb_policy/grpclb/load_balancer_api.h", "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", - "src/core/ext/lb_policy/pick_first/pick_first.h", - "src/core/ext/lb_policy/round_robin/round_robin.h", "src/core/ext/transport/chttp2/transport/alpn.h", "src/core/ext/transport/chttp2/transport/bin_encoder.h", "src/core/ext/transport/chttp2/transport/chttp2_transport.h", @@ -402,6 +400,7 @@ "src/core/lib/tsi/fake_transport_security.c", "src/core/lib/tsi/ssl_transport_security.c", "src/core/lib/tsi/transport_security.c", + "src/core/plugin_registry/grpc_plugin_registry.c", "third_party/nanopb/pb_common.c", "third_party/nanopb/pb_decode.c", "third_party/nanopb/pb_encode.c", diff --git a/package.xml b/package.xml index e29c55d69f9..1caf850c561 100644 --- a/package.xml +++ b/package.xml @@ -163,8 +163,6 @@ - - @@ -463,6 +461,7 @@ + diff --git a/src/core/ext/lb_policy/pick_first/pick_first.c b/src/core/ext/lb_policy/pick_first/pick_first.c index e1dae82c277..609c2d62d43 100644 --- a/src/core/ext/lb_policy/pick_first/pick_first.c +++ b/src/core/ext/lb_policy/pick_first/pick_first.c @@ -31,12 +31,10 @@ * */ -#include "src/core/ext/lb_policy/pick_first/pick_first.h" -#include "src/core/lib/client_config/lb_policy_factory.h" - #include #include +#include "src/core/lib/client_config/lb_policy_registry.h" #include "src/core/lib/transport/connectivity_state.h" typedef struct pending_pick { @@ -78,7 +76,7 @@ typedef struct { #define GET_SELECTED(p) \ ((grpc_connected_subchannel *)gpr_atm_acq_load(&(p)->selected)) -void pf_destroy(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) { +static void pf_destroy(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) { pick_first_lb_policy *p = (pick_first_lb_policy *)pol; grpc_connected_subchannel *selected = GET_SELECTED(p); size_t i; @@ -95,7 +93,7 @@ void pf_destroy(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) { gpr_free(p); } -void pf_shutdown(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) { +static void pf_shutdown(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) { pick_first_lb_policy *p = (pick_first_lb_policy *)pol; pending_pick *pp; grpc_connected_subchannel *selected; @@ -162,7 +160,7 @@ static void start_picking(grpc_exec_ctx *exec_ctx, pick_first_lb_policy *p) { &p->connectivity_changed); } -void pf_exit_idle(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) { +static void pf_exit_idle(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) { pick_first_lb_policy *p = (pick_first_lb_policy *)pol; gpr_mu_lock(&p->mu); if (!p->started_picking) { @@ -171,9 +169,10 @@ void pf_exit_idle(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) { gpr_mu_unlock(&p->mu); } -int pf_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol, grpc_pollset *pollset, - grpc_metadata_batch *initial_metadata, - grpc_connected_subchannel **target, grpc_closure *on_complete) { +static int pf_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol, + grpc_pollset *pollset, grpc_metadata_batch *initial_metadata, + grpc_connected_subchannel **target, + grpc_closure *on_complete) { pick_first_lb_policy *p = (pick_first_lb_policy *)pol; pending_pick *pp; @@ -356,9 +355,10 @@ static grpc_connectivity_state pf_check_connectivity(grpc_exec_ctx *exec_ctx, return st; } -void pf_notify_on_state_change(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol, - grpc_connectivity_state *current, - grpc_closure *notify) { +static void pf_notify_on_state_change(grpc_exec_ctx *exec_ctx, + grpc_lb_policy *pol, + grpc_connectivity_state *current, + grpc_closure *notify) { pick_first_lb_policy *p = (pick_first_lb_policy *)pol; gpr_mu_lock(&p->mu); grpc_connectivity_state_notify_on_state_change(exec_ctx, &p->state_tracker, @@ -366,8 +366,8 @@ void pf_notify_on_state_change(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol, gpr_mu_unlock(&p->mu); } -void pf_ping_one(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol, - grpc_closure *closure) { +static void pf_ping_one(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol, + grpc_closure *closure) { pick_first_lb_policy *p = (pick_first_lb_policy *)pol; grpc_connected_subchannel *selected = GET_SELECTED(p); if (selected) { @@ -416,6 +416,14 @@ static const grpc_lb_policy_factory_vtable pick_first_factory_vtable = { static grpc_lb_policy_factory pick_first_lb_policy_factory = { &pick_first_factory_vtable}; -grpc_lb_policy_factory *grpc_pick_first_lb_factory_create() { +static grpc_lb_policy_factory *pick_first_lb_factory_create() { return &pick_first_lb_policy_factory; } + +/* Plugin registration */ + +void grpc_lb_policy_pick_first_init() { + grpc_lb_policy_registry_init(pick_first_lb_factory_create()); +} + +void grpc_lb_policy_pick_first_shutdown() {} diff --git a/src/core/ext/lb_policy/pick_first/pick_first.h b/src/core/ext/lb_policy/pick_first/pick_first.h deleted file mode 100644 index 23a018ba448..00000000000 --- a/src/core/ext/lb_policy/pick_first/pick_first.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * - * Copyright 2015-2016, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef GRPC_CORE_EXT_LB_POLICY_PICK_FIRST_PICK_FIRST_H -#define GRPC_CORE_EXT_LB_POLICY_PICK_FIRST_PICK_FIRST_H - -#include "src/core/lib/client_config/lb_policy_factory.h" - -/** Returns a load balancing factory for the pick first policy, which picks up - * the first subchannel from \a subchannels to succesfully connect */ -grpc_lb_policy_factory *grpc_pick_first_lb_factory_create(); - -#endif /* GRPC_CORE_EXT_LB_POLICY_PICK_FIRST_PICK_FIRST_H */ diff --git a/src/core/ext/lb_policy/round_robin/round_robin.c b/src/core/ext/lb_policy/round_robin/round_robin.c index 31056ea1385..318980892c5 100644 --- a/src/core/ext/lb_policy/round_robin/round_robin.c +++ b/src/core/ext/lb_policy/round_robin/round_robin.c @@ -31,11 +31,12 @@ * */ -#include "src/core/ext/lb_policy/round_robin/round_robin.h" - #include #include + +#include "src/core/lib/client_config/lb_policy_registry.h" +#include "src/core/lib/debug/trace.h" #include "src/core/lib/transport/connectivity_state.h" typedef struct round_robin_lb_policy round_robin_lb_policy; @@ -199,7 +200,7 @@ static void remove_disconnected_sc_locked(round_robin_lb_policy *p, gpr_free(node); } -void rr_destroy(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) { +static void rr_destroy(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) { round_robin_lb_policy *p = (round_robin_lb_policy *)pol; size_t i; ready_list *elem; @@ -226,7 +227,7 @@ void rr_destroy(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) { gpr_free(p); } -void rr_shutdown(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) { +static void rr_shutdown(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) { round_robin_lb_policy *p = (round_robin_lb_policy *)pol; pending_pick *pp; size_t i; @@ -291,7 +292,7 @@ static void start_picking(grpc_exec_ctx *exec_ctx, round_robin_lb_policy *p) { } } -void rr_exit_idle(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) { +static void rr_exit_idle(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) { round_robin_lb_policy *p = (round_robin_lb_policy *)pol; gpr_mu_lock(&p->mu); if (!p->started_picking) { @@ -300,9 +301,10 @@ void rr_exit_idle(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) { gpr_mu_unlock(&p->mu); } -int rr_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol, grpc_pollset *pollset, - grpc_metadata_batch *initial_metadata, - grpc_connected_subchannel **target, grpc_closure *on_complete) { +static int rr_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol, + grpc_pollset *pollset, grpc_metadata_batch *initial_metadata, + grpc_connected_subchannel **target, + grpc_closure *on_complete) { round_robin_lb_policy *p = (round_robin_lb_policy *)pol; pending_pick *pp; ready_list *selected; @@ -537,6 +539,15 @@ static const grpc_lb_policy_factory_vtable round_robin_factory_vtable = { static grpc_lb_policy_factory round_robin_lb_policy_factory = { &round_robin_factory_vtable}; -grpc_lb_policy_factory *grpc_round_robin_lb_factory_create() { +static grpc_lb_policy_factory *round_robin_lb_factory_create() { return &round_robin_lb_policy_factory; } + +/* Plugin registration */ + +void grpc_lb_policy_round_robin_init() { + grpc_lb_policy_registry_init(round_robin_lb_factory_create()); + grpc_register_tracer("round_robin", &grpc_lb_round_robin_trace); +} + +void grpc_lb_policy_round_robin_shutdown() {} diff --git a/src/core/ext/lb_policy/round_robin/round_robin.h b/src/core/ext/lb_policy/round_robin/round_robin.h deleted file mode 100644 index 4cac8682f6a..00000000000 --- a/src/core/ext/lb_policy/round_robin/round_robin.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * - * Copyright 2015-2016, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#ifndef GRPC_CORE_EXT_LB_POLICY_ROUND_ROBIN_ROUND_ROBIN_H -#define GRPC_CORE_EXT_LB_POLICY_ROUND_ROBIN_ROUND_ROBIN_H - -#include "src/core/lib/client_config/lb_policy.h" - -extern int grpc_lb_round_robin_trace; - -#include "src/core/lib/client_config/lb_policy_factory.h" - -/** Returns a load balancing factory for the round robin policy */ -grpc_lb_policy_factory *grpc_round_robin_lb_factory_create(); - -#endif /* GRPC_CORE_EXT_LB_POLICY_ROUND_ROBIN_ROUND_ROBIN_H */ diff --git a/src/core/lib/surface/init.c b/src/core/lib/surface/init.c index 5bf275b97a6..69e0e692be4 100644 --- a/src/core/lib/surface/init.c +++ b/src/core/lib/surface/init.c @@ -48,8 +48,6 @@ #include "src/core/lib/channel/connected_channel.h" #include "src/core/lib/channel/http_client_filter.h" #include "src/core/lib/channel/http_server_filter.h" -#include "src/core/ext/lb_policy/pick_first/pick_first.h" -#include "src/core/ext/lb_policy/round_robin/round_robin.h" #include "src/core/lib/client_config/lb_policy_registry.h" #include "src/core/lib/client_config/resolver_registry.h" #include "src/core/lib/client_config/resolvers/dns_resolver.h" @@ -165,9 +163,6 @@ void grpc_init(void) { gpr_time_init(); grpc_mdctx_global_init(); grpc_channel_init_init(); - grpc_lb_policy_registry_init(grpc_pick_first_lb_factory_create()); - grpc_register_lb_policy(grpc_pick_first_lb_factory_create()); - grpc_register_lb_policy(grpc_round_robin_lb_factory_create()); grpc_resolver_registry_init(GRPC_DEFAULT_NAME_PREFIX); grpc_register_resolver_type(grpc_dns_resolver_factory_create()); grpc_register_resolver_type(grpc_ipv4_resolver_factory_create()); diff --git a/src/core/plugin_registry/grpc_plugin_registry.c b/src/core/plugin_registry/grpc_plugin_registry.c index b0ac5249328..3e3c214c221 100644 --- a/src/core/plugin_registry/grpc_plugin_registry.c +++ b/src/core/plugin_registry/grpc_plugin_registry.c @@ -30,3 +30,17 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ + +#include + +extern void grpc_lb_policy_pick_first_init(void); +extern void grpc_lb_policy_pick_first_shutdown(void); +extern void grpc_lb_policy_round_robin_init(void); +extern void grpc_lb_policy_round_robin_shutdown(void); + +void grpc_register_built_in_plugins(void) { + grpc_register_plugin(grpc_lb_policy_pick_first_init, + grpc_lb_policy_pick_first_shutdown); + grpc_register_plugin(grpc_lb_policy_round_robin_init, + grpc_lb_policy_round_robin_shutdown); +} diff --git a/src/core/plugin_registry/grpc_unsecure_plugin_registry.c b/src/core/plugin_registry/grpc_unsecure_plugin_registry.c index b0ac5249328..3e3c214c221 100644 --- a/src/core/plugin_registry/grpc_unsecure_plugin_registry.c +++ b/src/core/plugin_registry/grpc_unsecure_plugin_registry.c @@ -30,3 +30,17 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ + +#include + +extern void grpc_lb_policy_pick_first_init(void); +extern void grpc_lb_policy_pick_first_shutdown(void); +extern void grpc_lb_policy_round_robin_init(void); +extern void grpc_lb_policy_round_robin_shutdown(void); + +void grpc_register_built_in_plugins(void) { + grpc_register_plugin(grpc_lb_policy_pick_first_init, + grpc_lb_policy_pick_first_shutdown); + grpc_register_plugin(grpc_lb_policy_round_robin_init, + grpc_lb_policy_round_robin_shutdown); +} diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 8c7890c0943..3cd8f62221f 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -235,6 +235,7 @@ CORE_SOURCE_FILES = [ 'src/core/lib/tsi/fake_transport_security.c', 'src/core/lib/tsi/ssl_transport_security.c', 'src/core/lib/tsi/transport_security.c', + 'src/core/plugin_registry/grpc_plugin_registry.c', 'third_party/nanopb/pb_common.c', 'third_party/nanopb/pb_decode.c', 'third_party/nanopb/pb_encode.c', diff --git a/templates/src/core/plugin_registry.template b/templates/src/core/plugin_registry.template index 5d522c6e9df..352682c3f0b 100644 --- a/templates/src/core/plugin_registry.template +++ b/templates/src/core/plugin_registry.template @@ -36,3 +36,17 @@ template: | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ + + #include + + %for plugin in selected.plugins: + extern void ${plugin}_init(void); + extern void ${plugin}_shutdown(void); + %endfor + + void grpc_register_built_in_plugins(void) { + %for plugin in selected.plugins: + grpc_register_plugin(${plugin}_init, + ${plugin}_shutdown); + %endfor + } diff --git a/test/core/client_config/lb_policies_test.c b/test/core/client_config/lb_policies_test.c index bd2f0e5e750..fcb8630cabb 100644 --- a/test/core/client_config/lb_policies_test.c +++ b/test/core/client_config/lb_policies_test.c @@ -43,7 +43,6 @@ #include "src/core/lib/channel/channel_stack.h" #include "src/core/lib/channel/client_channel.h" -#include "src/core/ext/lb_policy/round_robin/round_robin.h" #include "src/core/lib/client_config/lb_policy_registry.h" #include "src/core/lib/support/string.h" #include "src/core/lib/surface/channel.h" @@ -880,7 +879,7 @@ int main(int argc, char **argv) { grpc_test_init(argc, argv); grpc_init(); - grpc_lb_round_robin_trace = 1; + grpc_tracer_set_enabled("round_robin", 1); GPR_ASSERT(grpc_lb_policy_create("this-lb-policy-does-not-exist", NULL) == NULL); diff --git a/tools/buildgen/plugins/expand_filegroups.py b/tools/buildgen/plugins/expand_filegroups.py index c40143ef958..0294a43271a 100755 --- a/tools/buildgen/plugins/expand_filegroups.py +++ b/tools/buildgen/plugins/expand_filegroups.py @@ -75,11 +75,20 @@ def mako_plugin(dictionary): todo.append(cur) else: skips = 0 + assert 'plugins' not in cur + plugins = [] for uses in cur.get('uses', []): + for plugin in filegroups[uses]['plugins']: + if plugin not in plugins: + plugins.append(plugin) for lst in FILEGROUP_LISTS: vals = cur.get(lst, []) vals.extend(filegroups[uses].get(lst, [])) cur[lst] = vals + cur_plugin_name = cur.get('plugin') + if cur_plugin_name: + plugins.append(cur_plugin_name) + cur['plugins'] = plugins filegroups[cur['name']] = cur # the above expansion can introduce duplicate filenames: contract them here @@ -88,13 +97,20 @@ def mako_plugin(dictionary): fg[lst] = sorted(list(set(fg.get(lst, [])))) for lib in libs: + assert 'plugins' not in lib + plugins = [] for fg_name in lib.get('filegroups', []): fg = filegroups[fg_name] - + for plugin in fg['plugins']: + if plugin not in plugins: + plugins.append(plugin) for lst in FILEGROUP_LISTS: vals = lib.get(lst, []) vals.extend(fg.get(lst, [])) lib[lst] = vals - + lib['plugins'] = plugins + if lib.get('generate_plugin_registry', False): + lib['src'].append('src/core/plugin_registry/%s_plugin_registry.c' % + lib['name']) for lst in FILEGROUP_LISTS: lib[lst] = sorted(list(set(lib.get(lst, [])))) diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index d3b7e2b8a28..b94447c5550 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -775,8 +775,6 @@ include/grpc/impl/codegen/status.h \ include/grpc/status.h \ src/core/ext/lb_policy/grpclb/load_balancer_api.h \ src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h \ -src/core/ext/lb_policy/pick_first/pick_first.h \ -src/core/ext/lb_policy/round_robin/round_robin.h \ src/core/ext/transport/chttp2/transport/alpn.h \ src/core/ext/transport/chttp2/transport/bin_encoder.h \ src/core/ext/transport/chttp2/transport/chttp2_transport.h \ @@ -1075,6 +1073,7 @@ src/core/lib/transport/transport_op_string.c \ src/core/lib/tsi/fake_transport_security.c \ src/core/lib/tsi/ssl_transport_security.c \ src/core/lib/tsi/transport_security.c \ +src/core/plugin_registry/grpc_plugin_registry.c \ third_party/nanopb/pb_common.c \ third_party/nanopb/pb_decode.c \ third_party/nanopb/pb_encode.c \ diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index 3337c84b10a..9fbf7ba2a7a 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -3926,8 +3926,6 @@ "include/grpc/status.h", "src/core/ext/lb_policy/grpclb/load_balancer_api.h", "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", - "src/core/ext/lb_policy/pick_first/pick_first.h", - "src/core/ext/lb_policy/round_robin/round_robin.h", "src/core/ext/transport/chttp2/transport/alpn.h", "src/core/ext/transport/chttp2/transport/bin_encoder.h", "src/core/ext/transport/chttp2/transport/chttp2_transport.h", @@ -4087,9 +4085,7 @@ "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", "src/core/ext/lb_policy/pick_first/pick_first.c", - "src/core/ext/lb_policy/pick_first/pick_first.h", "src/core/ext/lb_policy/round_robin/round_robin.c", - "src/core/ext/lb_policy/round_robin/round_robin.h", "src/core/ext/transport/chttp2/client/insecure/channel_create.c", "src/core/ext/transport/chttp2/client/secure/secure_channel_create.c", "src/core/ext/transport/chttp2/server/insecure/server_chttp2.c", @@ -4379,7 +4375,8 @@ "src/core/lib/tsi/ssl_types.h", "src/core/lib/tsi/transport_security.c", "src/core/lib/tsi/transport_security.h", - "src/core/lib/tsi/transport_security_interface.h" + "src/core/lib/tsi/transport_security_interface.h", + "src/core/plugin_registry/grpc_plugin_registry.c" ], "third_party": false, "type": "lib" @@ -4554,8 +4551,6 @@ "include/grpc/status.h", "src/core/ext/lb_policy/grpclb/load_balancer_api.h", "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", - "src/core/ext/lb_policy/pick_first/pick_first.h", - "src/core/ext/lb_policy/round_robin/round_robin.h", "src/core/ext/transport/chttp2/transport/alpn.h", "src/core/ext/transport/chttp2/transport/bin_encoder.h", "src/core/ext/transport/chttp2/transport/chttp2_transport.h", @@ -4700,9 +4695,7 @@ "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", "src/core/ext/lb_policy/pick_first/pick_first.c", - "src/core/ext/lb_policy/pick_first/pick_first.h", "src/core/ext/lb_policy/round_robin/round_robin.c", - "src/core/ext/lb_policy/round_robin/round_robin.h", "src/core/ext/transport/chttp2/client/insecure/channel_create.c", "src/core/ext/transport/chttp2/server/insecure/server_chttp2.c", "src/core/ext/transport/chttp2/transport/alpn.c", @@ -4958,7 +4951,8 @@ "src/core/lib/transport/transport.c", "src/core/lib/transport/transport.h", "src/core/lib/transport/transport_impl.h", - "src/core/lib/transport/transport_op_string.c" + "src/core/lib/transport/transport_op_string.c", + "src/core/plugin_registry/grpc_unsecure_plugin_registry.c" ], "third_party": false, "type": "lib" diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj b/vsprojects/vcxproj/grpc/grpc.vcxproj index 678f913e45f..93d5a9b02fa 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj @@ -284,8 +284,6 @@ - - @@ -747,6 +745,8 @@ + + diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters index 60d0811ec5c..3e5032db0e1 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters @@ -484,6 +484,9 @@ src\core\lib\tsi + + src\core\plugin_registry + third_party\nanopb @@ -542,12 +545,6 @@ src\core\ext\lb_policy\grpclb\proto\grpc\lb\v0 - - src\core\ext\lb_policy\pick_first - - - src\core\ext\lb_policy\round_robin - src\core\ext\transport\chttp2\transport @@ -1079,6 +1076,9 @@ {95ad2811-c8d0-7a42-2a73-baf03fcbf699} + + {02bec99b-ff39-88d7-9dea-e0ff9f4a2701} + {aaab30a4-2a15-732e-c141-3fbc0f0f5a7a} diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj index a2426c7712a..98a6bee1704 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj @@ -274,8 +274,6 @@ - - @@ -683,6 +681,8 @@ + + diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters index dee6778ffb4..81c8a874fc9 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters @@ -424,6 +424,9 @@ src\core\lib\transport + + src\core\plugin_registry + third_party\nanopb @@ -479,12 +482,6 @@ src\core\ext\lb_policy\grpclb\proto\grpc\lb\v0 - - src\core\ext\lb_policy\pick_first - - - src\core\ext\lb_policy\round_robin - src\core\ext\transport\chttp2\transport @@ -962,6 +959,9 @@ {6c3394d1-27e9-003e-19ed-8116d210f7cc} + + {babf0a90-e934-f599-5475-e6937d9580fe} + {025c051e-8eba-125b-67f9-173f95176eb2} From 3113ef48ab8ae6e8c879cfb15ef0ccfe9a7cc824 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 29 Mar 2016 09:03:14 -0700 Subject: [PATCH 29/36] Register plugins correctly --- src/core/ext/lb_policy/pick_first/pick_first.c | 2 +- src/core/ext/lb_policy/round_robin/round_robin.c | 2 +- src/core/lib/client_config/lb_policy_registry.c | 7 +------ src/core/lib/client_config/lb_policy_registry.h | 2 +- src/core/lib/surface/init.c | 5 +++++ 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/core/ext/lb_policy/pick_first/pick_first.c b/src/core/ext/lb_policy/pick_first/pick_first.c index 609c2d62d43..8dc7ed01e28 100644 --- a/src/core/ext/lb_policy/pick_first/pick_first.c +++ b/src/core/ext/lb_policy/pick_first/pick_first.c @@ -423,7 +423,7 @@ static grpc_lb_policy_factory *pick_first_lb_factory_create() { /* Plugin registration */ void grpc_lb_policy_pick_first_init() { - grpc_lb_policy_registry_init(pick_first_lb_factory_create()); + grpc_register_lb_policy(pick_first_lb_factory_create()); } void grpc_lb_policy_pick_first_shutdown() {} diff --git a/src/core/ext/lb_policy/round_robin/round_robin.c b/src/core/ext/lb_policy/round_robin/round_robin.c index 318980892c5..b1996922bf9 100644 --- a/src/core/ext/lb_policy/round_robin/round_robin.c +++ b/src/core/ext/lb_policy/round_robin/round_robin.c @@ -546,7 +546,7 @@ static grpc_lb_policy_factory *round_robin_lb_factory_create() { /* Plugin registration */ void grpc_lb_policy_round_robin_init() { - grpc_lb_policy_registry_init(round_robin_lb_factory_create()); + grpc_register_lb_policy(round_robin_lb_factory_create()); grpc_register_tracer("round_robin", &grpc_lb_round_robin_trace); } diff --git a/src/core/lib/client_config/lb_policy_registry.c b/src/core/lib/client_config/lb_policy_registry.c index 13acfe78cda..82f70ed8c0b 100644 --- a/src/core/lib/client_config/lb_policy_registry.c +++ b/src/core/lib/client_config/lb_policy_registry.c @@ -40,12 +40,7 @@ static grpc_lb_policy_factory *g_all_of_the_lb_policies[MAX_POLICIES]; static int g_number_of_lb_policies = 0; -static grpc_lb_policy_factory *g_default_lb_policy_factory; - -void grpc_lb_policy_registry_init(grpc_lb_policy_factory *default_factory) { - g_number_of_lb_policies = 0; - g_default_lb_policy_factory = default_factory; -} +void grpc_lb_policy_registry_init(void) { g_number_of_lb_policies = 0; } void grpc_lb_policy_registry_shutdown(void) { int i; diff --git a/src/core/lib/client_config/lb_policy_registry.h b/src/core/lib/client_config/lb_policy_registry.h index c251fd9f080..da3a5d5e797 100644 --- a/src/core/lib/client_config/lb_policy_registry.h +++ b/src/core/lib/client_config/lb_policy_registry.h @@ -38,7 +38,7 @@ /** Initialize the registry and set \a default_factory as the factory to be * returned when no name is provided in a lookup */ -void grpc_lb_policy_registry_init(grpc_lb_policy_factory *default_factory); +void grpc_lb_policy_registry_init(void); void grpc_lb_policy_registry_shutdown(void); /** Register a LB policy factory. */ diff --git a/src/core/lib/surface/init.c b/src/core/lib/surface/init.c index 69e0e692be4..d59323b2bc4 100644 --- a/src/core/lib/surface/init.c +++ b/src/core/lib/surface/init.c @@ -73,6 +73,9 @@ #define GRPC_DEFAULT_NAME_PREFIX "dns:///" #endif +/* (generated) built in registry of plugins */ +extern void grpc_register_built_in_plugins(void); + #define MAX_PLUGINS 128 static gpr_once g_basic_init = GPR_ONCE_INIT; @@ -81,6 +84,7 @@ static int g_initializations; static void do_basic_init(void) { gpr_mu_init(&g_init_mu); + grpc_register_built_in_plugins(); /* TODO(ctiller): ideally remove this strict linkage */ grpc_register_plugin(census_grpc_plugin_init, census_grpc_plugin_destroy); g_initializations = 0; @@ -163,6 +167,7 @@ void grpc_init(void) { gpr_time_init(); grpc_mdctx_global_init(); grpc_channel_init_init(); + grpc_lb_policy_registry_init(); grpc_resolver_registry_init(GRPC_DEFAULT_NAME_PREFIX); grpc_register_resolver_type(grpc_dns_resolver_factory_create()); grpc_register_resolver_type(grpc_ipv4_resolver_factory_create()); From 796474c792c3744c78d64a3d8430817782d03042 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 29 Mar 2016 09:43:28 -0700 Subject: [PATCH 30/36] Move proto code under ext/.../grpclb --- BUILD | 12 ++++++------ Makefile | 4 ++-- binding.gyp | 2 +- build.yaml | 4 ++-- config.m4 | 2 +- gRPC.podspec | 6 +++--- grpc.gemspec | 4 ++-- package.json | 4 ++-- package.xml | 4 ++-- src/python/grpcio/grpc_core_dependencies.py | 2 +- tools/doxygen/Doxyfile.core.internal | 4 ++-- tools/run_tests/sources_and_headers.json | 4 ++-- vsprojects/vcxproj/grpc/grpc.vcxproj | 4 ++-- vsprojects/vcxproj/grpc/grpc.vcxproj.filters | 4 ++-- .../vcxproj/grpc_unsecure/grpc_unsecure.vcxproj | 4 ++-- .../grpc_unsecure/grpc_unsecure.vcxproj.filters | 4 ++-- 16 files changed, 34 insertions(+), 34 deletions(-) diff --git a/BUILD b/BUILD index 22cbf3d0afd..1c638909ed4 100644 --- a/BUILD +++ b/BUILD @@ -158,7 +158,7 @@ cc_library( name = "grpc", srcs = [ "src/core/ext/lb_policy/grpclb/load_balancer_api.h", - "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", "src/core/ext/transport/chttp2/transport/alpn.h", "src/core/ext/transport/chttp2/transport/bin_encoder.h", "src/core/ext/transport/chttp2/transport/chttp2_transport.h", @@ -297,7 +297,7 @@ cc_library( "third_party/nanopb/pb_decode.h", "third_party/nanopb/pb_encode.h", "src/core/ext/lb_policy/grpclb/load_balancer_api.c", - "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", "src/core/ext/lb_policy/pick_first/pick_first.c", "src/core/ext/lb_policy/round_robin/round_robin.c", "src/core/ext/transport/chttp2/client/insecure/channel_create.c", @@ -532,7 +532,7 @@ cc_library( name = "grpc_unsecure", srcs = [ "src/core/ext/lb_policy/grpclb/load_balancer_api.h", - "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", "src/core/ext/transport/chttp2/transport/alpn.h", "src/core/ext/transport/chttp2/transport/bin_encoder.h", "src/core/ext/transport/chttp2/transport/chttp2_transport.h", @@ -657,7 +657,7 @@ cc_library( "third_party/nanopb/pb_decode.h", "third_party/nanopb/pb_encode.h", "src/core/ext/lb_policy/grpclb/load_balancer_api.c", - "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", "src/core/ext/lb_policy/pick_first/pick_first.c", "src/core/ext/lb_policy/round_robin/round_robin.c", "src/core/ext/transport/chttp2/client/insecure/channel_create.c", @@ -1359,7 +1359,7 @@ objc_library( name = "grpc_objc", srcs = [ "src/core/ext/lb_policy/grpclb/load_balancer_api.c", - "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", "src/core/ext/lb_policy/pick_first/pick_first.c", "src/core/ext/lb_policy/round_robin/round_robin.c", "src/core/ext/transport/chttp2/client/insecure/channel_create.c", @@ -1539,7 +1539,7 @@ objc_library( "include/grpc/impl/codegen/status.h", "include/grpc/status.h", "src/core/ext/lb_policy/grpclb/load_balancer_api.h", - "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", "src/core/ext/transport/chttp2/transport/alpn.h", "src/core/ext/transport/chttp2/transport/bin_encoder.h", "src/core/ext/transport/chttp2/transport/chttp2_transport.h", diff --git a/Makefile b/Makefile index 7b7200b6aee..502e128060e 100644 --- a/Makefile +++ b/Makefile @@ -2421,7 +2421,7 @@ endif LIBGRPC_SRC = \ src/core/ext/lb_policy/grpclb/load_balancer_api.c \ - src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c \ + src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h \ src/core/ext/lb_policy/pick_first/pick_first.c \ src/core/ext/lb_policy/round_robin/round_robin.c \ src/core/ext/transport/chttp2/client/insecure/channel_create.c \ @@ -2783,7 +2783,7 @@ endif LIBGRPC_UNSECURE_SRC = \ src/core/ext/lb_policy/grpclb/load_balancer_api.c \ - src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c \ + src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h \ src/core/ext/lb_policy/pick_first/pick_first.c \ src/core/ext/lb_policy/round_robin/round_robin.c \ src/core/ext/transport/chttp2/client/insecure/channel_create.c \ diff --git a/binding.gyp b/binding.gyp index bfae59e50ce..b97ab023d1e 100644 --- a/binding.gyp +++ b/binding.gyp @@ -559,7 +559,7 @@ ], 'sources': [ 'src/core/ext/lb_policy/grpclb/load_balancer_api.c', - 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c', + 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h', 'src/core/ext/lb_policy/pick_first/pick_first.c', 'src/core/ext/lb_policy/round_robin/round_robin.c', 'src/core/ext/transport/chttp2/client/insecure/channel_create.c', diff --git a/build.yaml b/build.yaml index de4deeb9289..0ada42fa96c 100644 --- a/build.yaml +++ b/build.yaml @@ -247,7 +247,6 @@ filegroups: - include/grpc/grpc.h - include/grpc/status.h headers: - - src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h - src/core/lib/census/grpc_filter.h - src/core/lib/census/grpc_plugin.h - src/core/lib/channel/channel_args.h @@ -344,7 +343,6 @@ filegroups: - src/core/lib/transport/transport.h - src/core/lib/transport/transport_impl.h src: - - src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c - src/core/lib/census/grpc_context.c - src/core/lib/census/grpc_filter.c - src/core/lib/census/grpc_plugin.c @@ -463,8 +461,10 @@ filegroups: - name: grpc_lb_policy_grpclb headers: - src/core/ext/lb_policy/grpclb/load_balancer_api.h + - src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c src: - src/core/ext/lb_policy/grpclb/load_balancer_api.c + - src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h uses: - grpc_base - name: grpc_lb_policy_pick_first diff --git a/config.m4 b/config.m4 index 1b414a1142b..6bf0f4d8a71 100644 --- a/config.m4 +++ b/config.m4 @@ -81,7 +81,7 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/support/tmpfile_win32.c \ src/core/lib/support/wrap_memcpy.c \ src/core/ext/lb_policy/grpclb/load_balancer_api.c \ - src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c \ + src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h \ src/core/ext/lb_policy/pick_first/pick_first.c \ src/core/ext/lb_policy/round_robin/round_robin.c \ src/core/ext/transport/chttp2/client/insecure/channel_create.c \ diff --git a/gRPC.podspec b/gRPC.podspec index d94905ce2a6..cacaa027fb2 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -162,7 +162,7 @@ Pod::Spec.new do |s| 'src/core/lib/support/tmpfile_win32.c', 'src/core/lib/support/wrap_memcpy.c', 'src/core/ext/lb_policy/grpclb/load_balancer_api.h', - 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h', + 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c', 'src/core/ext/transport/chttp2/transport/alpn.h', 'src/core/ext/transport/chttp2/transport/bin_encoder.h', 'src/core/ext/transport/chttp2/transport/chttp2_transport.h', @@ -314,7 +314,7 @@ Pod::Spec.new do |s| 'include/grpc/impl/codegen/status.h', 'include/grpc/status.h', 'src/core/ext/lb_policy/grpclb/load_balancer_api.c', - 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c', + 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h', 'src/core/ext/lb_policy/pick_first/pick_first.c', 'src/core/ext/lb_policy/round_robin/round_robin.c', 'src/core/ext/transport/chttp2/client/insecure/channel_create.c', @@ -492,7 +492,7 @@ Pod::Spec.new do |s| 'src/core/lib/support/time_precise.h', 'src/core/lib/support/tmpfile.h', 'src/core/ext/lb_policy/grpclb/load_balancer_api.h', - 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h', + 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c', 'src/core/ext/transport/chttp2/transport/alpn.h', 'src/core/ext/transport/chttp2/transport/bin_encoder.h', 'src/core/ext/transport/chttp2/transport/chttp2_transport.h', diff --git a/grpc.gemspec b/grpc.gemspec index e96bedb5875..59361b29778 100755 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -158,7 +158,7 @@ Gem::Specification.new do |s| s.files += %w( include/grpc/impl/codegen/status.h ) s.files += %w( include/grpc/status.h ) s.files += %w( src/core/ext/lb_policy/grpclb/load_balancer_api.h ) - s.files += %w( src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h ) + s.files += %w( src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c ) s.files += %w( src/core/ext/transport/chttp2/transport/alpn.h ) s.files += %w( src/core/ext/transport/chttp2/transport/bin_encoder.h ) s.files += %w( src/core/ext/transport/chttp2/transport/chttp2_transport.h ) @@ -297,7 +297,7 @@ Gem::Specification.new do |s| s.files += %w( third_party/nanopb/pb_decode.h ) s.files += %w( third_party/nanopb/pb_encode.h ) s.files += %w( src/core/ext/lb_policy/grpclb/load_balancer_api.c ) - s.files += %w( src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c ) + s.files += %w( src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h ) s.files += %w( src/core/ext/lb_policy/pick_first/pick_first.c ) s.files += %w( src/core/ext/lb_policy/round_robin/round_robin.c ) s.files += %w( src/core/ext/transport/chttp2/client/insecure/channel_create.c ) diff --git a/package.json b/package.json index cbcfc19ee3c..37e94a17613 100644 --- a/package.json +++ b/package.json @@ -101,7 +101,7 @@ "include/grpc/impl/codegen/status.h", "include/grpc/status.h", "src/core/ext/lb_policy/grpclb/load_balancer_api.h", - "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", "src/core/ext/transport/chttp2/transport/alpn.h", "src/core/ext/transport/chttp2/transport/bin_encoder.h", "src/core/ext/transport/chttp2/transport/chttp2_transport.h", @@ -240,7 +240,7 @@ "third_party/nanopb/pb_decode.h", "third_party/nanopb/pb_encode.h", "src/core/ext/lb_policy/grpclb/load_balancer_api.c", - "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", "src/core/ext/lb_policy/pick_first/pick_first.c", "src/core/ext/lb_policy/round_robin/round_robin.c", "src/core/ext/transport/chttp2/client/insecure/channel_create.c", diff --git a/package.xml b/package.xml index 1caf850c561..6d9356bc09f 100644 --- a/package.xml +++ b/package.xml @@ -162,7 +162,7 @@ - + @@ -301,7 +301,7 @@ - + diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 3cd8f62221f..237a05130b5 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -75,7 +75,7 @@ CORE_SOURCE_FILES = [ 'src/core/lib/support/tmpfile_win32.c', 'src/core/lib/support/wrap_memcpy.c', 'src/core/ext/lb_policy/grpclb/load_balancer_api.c', - 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c', + 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h', 'src/core/ext/lb_policy/pick_first/pick_first.c', 'src/core/ext/lb_policy/round_robin/round_robin.c', 'src/core/ext/transport/chttp2/client/insecure/channel_create.c', diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index b94447c5550..f3405fe5465 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -774,7 +774,7 @@ include/grpc/impl/codegen/propagation_bits.h \ include/grpc/impl/codegen/status.h \ include/grpc/status.h \ src/core/ext/lb_policy/grpclb/load_balancer_api.h \ -src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h \ +src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c \ src/core/ext/transport/chttp2/transport/alpn.h \ src/core/ext/transport/chttp2/transport/bin_encoder.h \ src/core/ext/transport/chttp2/transport/chttp2_transport.h \ @@ -913,7 +913,7 @@ third_party/nanopb/pb_common.h \ third_party/nanopb/pb_decode.h \ third_party/nanopb/pb_encode.h \ src/core/ext/lb_policy/grpclb/load_balancer_api.c \ -src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c \ +src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h \ src/core/ext/lb_policy/pick_first/pick_first.c \ src/core/ext/lb_policy/round_robin/round_robin.c \ src/core/ext/transport/chttp2/client/insecure/channel_create.c \ diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index 9fbf7ba2a7a..5cbf890bea4 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -3925,7 +3925,7 @@ "include/grpc/impl/codegen/status.h", "include/grpc/status.h", "src/core/ext/lb_policy/grpclb/load_balancer_api.h", - "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", "src/core/ext/transport/chttp2/transport/alpn.h", "src/core/ext/transport/chttp2/transport/bin_encoder.h", "src/core/ext/transport/chttp2/transport/chttp2_transport.h", @@ -4550,7 +4550,7 @@ "include/grpc/impl/codegen/status.h", "include/grpc/status.h", "src/core/ext/lb_policy/grpclb/load_balancer_api.h", - "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", "src/core/ext/transport/chttp2/transport/alpn.h", "src/core/ext/transport/chttp2/transport/bin_encoder.h", "src/core/ext/transport/chttp2/transport/chttp2_transport.h", diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj b/vsprojects/vcxproj/grpc/grpc.vcxproj index 93d5a9b02fa..18b92fb359b 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj @@ -283,7 +283,7 @@ - + @@ -425,7 +425,7 @@ - + diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters index 3e5032db0e1..31a852b692e 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters @@ -4,7 +4,7 @@ src\core\ext\lb_policy\grpclb - + src\core\ext\lb_policy\grpclb\proto\grpc\lb\v0 @@ -542,7 +542,7 @@ src\core\ext\lb_policy\grpclb - + src\core\ext\lb_policy\grpclb\proto\grpc\lb\v0 diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj index 98a6bee1704..981d0a27147 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj @@ -273,7 +273,7 @@ - + @@ -401,7 +401,7 @@ - + diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters index 81c8a874fc9..cebb073c59b 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters @@ -4,7 +4,7 @@ src\core\ext\lb_policy\grpclb - + src\core\ext\lb_policy\grpclb\proto\grpc\lb\v0 @@ -479,7 +479,7 @@ src\core\ext\lb_policy\grpclb - + src\core\ext\lb_policy\grpclb\proto\grpc\lb\v0 From 943cdf99e9fa08f17b7f11c87492b865a1e4741e Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 29 Mar 2016 13:27:56 -0700 Subject: [PATCH 31/36] Swap header/src into the right order --- BUILD | 12 ++++++------ Makefile | 4 ++-- binding.gyp | 2 +- build.yaml | 4 ++-- config.m4 | 2 +- gRPC.podspec | 6 +++--- grpc.gemspec | 4 ++-- package.json | 4 ++-- package.xml | 4 ++-- src/python/grpcio/grpc_core_dependencies.py | 2 +- tools/doxygen/Doxyfile.core.internal | 4 ++-- tools/run_tests/sources_and_headers.json | 4 ++-- vsprojects/vcxproj/grpc/grpc.vcxproj | 4 ++-- vsprojects/vcxproj/grpc/grpc.vcxproj.filters | 4 ++-- .../vcxproj/grpc_unsecure/grpc_unsecure.vcxproj | 4 ++-- .../grpc_unsecure/grpc_unsecure.vcxproj.filters | 4 ++-- 16 files changed, 34 insertions(+), 34 deletions(-) diff --git a/BUILD b/BUILD index 1c638909ed4..22cbf3d0afd 100644 --- a/BUILD +++ b/BUILD @@ -158,7 +158,7 @@ cc_library( name = "grpc", srcs = [ "src/core/ext/lb_policy/grpclb/load_balancer_api.h", - "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", "src/core/ext/transport/chttp2/transport/alpn.h", "src/core/ext/transport/chttp2/transport/bin_encoder.h", "src/core/ext/transport/chttp2/transport/chttp2_transport.h", @@ -297,7 +297,7 @@ cc_library( "third_party/nanopb/pb_decode.h", "third_party/nanopb/pb_encode.h", "src/core/ext/lb_policy/grpclb/load_balancer_api.c", - "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", "src/core/ext/lb_policy/pick_first/pick_first.c", "src/core/ext/lb_policy/round_robin/round_robin.c", "src/core/ext/transport/chttp2/client/insecure/channel_create.c", @@ -532,7 +532,7 @@ cc_library( name = "grpc_unsecure", srcs = [ "src/core/ext/lb_policy/grpclb/load_balancer_api.h", - "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", "src/core/ext/transport/chttp2/transport/alpn.h", "src/core/ext/transport/chttp2/transport/bin_encoder.h", "src/core/ext/transport/chttp2/transport/chttp2_transport.h", @@ -657,7 +657,7 @@ cc_library( "third_party/nanopb/pb_decode.h", "third_party/nanopb/pb_encode.h", "src/core/ext/lb_policy/grpclb/load_balancer_api.c", - "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", "src/core/ext/lb_policy/pick_first/pick_first.c", "src/core/ext/lb_policy/round_robin/round_robin.c", "src/core/ext/transport/chttp2/client/insecure/channel_create.c", @@ -1359,7 +1359,7 @@ objc_library( name = "grpc_objc", srcs = [ "src/core/ext/lb_policy/grpclb/load_balancer_api.c", - "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", "src/core/ext/lb_policy/pick_first/pick_first.c", "src/core/ext/lb_policy/round_robin/round_robin.c", "src/core/ext/transport/chttp2/client/insecure/channel_create.c", @@ -1539,7 +1539,7 @@ objc_library( "include/grpc/impl/codegen/status.h", "include/grpc/status.h", "src/core/ext/lb_policy/grpclb/load_balancer_api.h", - "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", "src/core/ext/transport/chttp2/transport/alpn.h", "src/core/ext/transport/chttp2/transport/bin_encoder.h", "src/core/ext/transport/chttp2/transport/chttp2_transport.h", diff --git a/Makefile b/Makefile index 4b07c4eeaf2..e446e309783 100644 --- a/Makefile +++ b/Makefile @@ -2435,7 +2435,7 @@ endif LIBGRPC_SRC = \ src/core/ext/lb_policy/grpclb/load_balancer_api.c \ - src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h \ + src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c \ src/core/ext/lb_policy/pick_first/pick_first.c \ src/core/ext/lb_policy/round_robin/round_robin.c \ src/core/ext/transport/chttp2/client/insecure/channel_create.c \ @@ -2797,7 +2797,7 @@ endif LIBGRPC_UNSECURE_SRC = \ src/core/ext/lb_policy/grpclb/load_balancer_api.c \ - src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h \ + src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c \ src/core/ext/lb_policy/pick_first/pick_first.c \ src/core/ext/lb_policy/round_robin/round_robin.c \ src/core/ext/transport/chttp2/client/insecure/channel_create.c \ diff --git a/binding.gyp b/binding.gyp index b97ab023d1e..bfae59e50ce 100644 --- a/binding.gyp +++ b/binding.gyp @@ -559,7 +559,7 @@ ], 'sources': [ 'src/core/ext/lb_policy/grpclb/load_balancer_api.c', - 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h', + 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c', 'src/core/ext/lb_policy/pick_first/pick_first.c', 'src/core/ext/lb_policy/round_robin/round_robin.c', 'src/core/ext/transport/chttp2/client/insecure/channel_create.c', diff --git a/build.yaml b/build.yaml index f5dc786c26c..9a829f20802 100644 --- a/build.yaml +++ b/build.yaml @@ -461,10 +461,10 @@ filegroups: - name: grpc_lb_policy_grpclb headers: - src/core/ext/lb_policy/grpclb/load_balancer_api.h - - src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c + - src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h src: - src/core/ext/lb_policy/grpclb/load_balancer_api.c - - src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h + - src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c uses: - grpc_base - name: grpc_lb_policy_pick_first diff --git a/config.m4 b/config.m4 index 6bf0f4d8a71..1b414a1142b 100644 --- a/config.m4 +++ b/config.m4 @@ -81,7 +81,7 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/support/tmpfile_win32.c \ src/core/lib/support/wrap_memcpy.c \ src/core/ext/lb_policy/grpclb/load_balancer_api.c \ - src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h \ + src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c \ src/core/ext/lb_policy/pick_first/pick_first.c \ src/core/ext/lb_policy/round_robin/round_robin.c \ src/core/ext/transport/chttp2/client/insecure/channel_create.c \ diff --git a/gRPC.podspec b/gRPC.podspec index cacaa027fb2..d94905ce2a6 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -162,7 +162,7 @@ Pod::Spec.new do |s| 'src/core/lib/support/tmpfile_win32.c', 'src/core/lib/support/wrap_memcpy.c', 'src/core/ext/lb_policy/grpclb/load_balancer_api.h', - 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c', + 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h', 'src/core/ext/transport/chttp2/transport/alpn.h', 'src/core/ext/transport/chttp2/transport/bin_encoder.h', 'src/core/ext/transport/chttp2/transport/chttp2_transport.h', @@ -314,7 +314,7 @@ Pod::Spec.new do |s| 'include/grpc/impl/codegen/status.h', 'include/grpc/status.h', 'src/core/ext/lb_policy/grpclb/load_balancer_api.c', - 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h', + 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c', 'src/core/ext/lb_policy/pick_first/pick_first.c', 'src/core/ext/lb_policy/round_robin/round_robin.c', 'src/core/ext/transport/chttp2/client/insecure/channel_create.c', @@ -492,7 +492,7 @@ Pod::Spec.new do |s| 'src/core/lib/support/time_precise.h', 'src/core/lib/support/tmpfile.h', 'src/core/ext/lb_policy/grpclb/load_balancer_api.h', - 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c', + 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h', 'src/core/ext/transport/chttp2/transport/alpn.h', 'src/core/ext/transport/chttp2/transport/bin_encoder.h', 'src/core/ext/transport/chttp2/transport/chttp2_transport.h', diff --git a/grpc.gemspec b/grpc.gemspec index 59361b29778..e96bedb5875 100755 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -158,7 +158,7 @@ Gem::Specification.new do |s| s.files += %w( include/grpc/impl/codegen/status.h ) s.files += %w( include/grpc/status.h ) s.files += %w( src/core/ext/lb_policy/grpclb/load_balancer_api.h ) - s.files += %w( src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c ) + s.files += %w( src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h ) s.files += %w( src/core/ext/transport/chttp2/transport/alpn.h ) s.files += %w( src/core/ext/transport/chttp2/transport/bin_encoder.h ) s.files += %w( src/core/ext/transport/chttp2/transport/chttp2_transport.h ) @@ -297,7 +297,7 @@ Gem::Specification.new do |s| s.files += %w( third_party/nanopb/pb_decode.h ) s.files += %w( third_party/nanopb/pb_encode.h ) s.files += %w( src/core/ext/lb_policy/grpclb/load_balancer_api.c ) - s.files += %w( src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h ) + s.files += %w( src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c ) s.files += %w( src/core/ext/lb_policy/pick_first/pick_first.c ) s.files += %w( src/core/ext/lb_policy/round_robin/round_robin.c ) s.files += %w( src/core/ext/transport/chttp2/client/insecure/channel_create.c ) diff --git a/package.json b/package.json index 37e94a17613..cbcfc19ee3c 100644 --- a/package.json +++ b/package.json @@ -101,7 +101,7 @@ "include/grpc/impl/codegen/status.h", "include/grpc/status.h", "src/core/ext/lb_policy/grpclb/load_balancer_api.h", - "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", "src/core/ext/transport/chttp2/transport/alpn.h", "src/core/ext/transport/chttp2/transport/bin_encoder.h", "src/core/ext/transport/chttp2/transport/chttp2_transport.h", @@ -240,7 +240,7 @@ "third_party/nanopb/pb_decode.h", "third_party/nanopb/pb_encode.h", "src/core/ext/lb_policy/grpclb/load_balancer_api.c", - "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", "src/core/ext/lb_policy/pick_first/pick_first.c", "src/core/ext/lb_policy/round_robin/round_robin.c", "src/core/ext/transport/chttp2/client/insecure/channel_create.c", diff --git a/package.xml b/package.xml index 6d9356bc09f..1caf850c561 100644 --- a/package.xml +++ b/package.xml @@ -162,7 +162,7 @@ - + @@ -301,7 +301,7 @@ - + diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 237a05130b5..3cd8f62221f 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -75,7 +75,7 @@ CORE_SOURCE_FILES = [ 'src/core/lib/support/tmpfile_win32.c', 'src/core/lib/support/wrap_memcpy.c', 'src/core/ext/lb_policy/grpclb/load_balancer_api.c', - 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h', + 'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c', 'src/core/ext/lb_policy/pick_first/pick_first.c', 'src/core/ext/lb_policy/round_robin/round_robin.c', 'src/core/ext/transport/chttp2/client/insecure/channel_create.c', diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index f3405fe5465..b94447c5550 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -774,7 +774,7 @@ include/grpc/impl/codegen/propagation_bits.h \ include/grpc/impl/codegen/status.h \ include/grpc/status.h \ src/core/ext/lb_policy/grpclb/load_balancer_api.h \ -src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c \ +src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h \ src/core/ext/transport/chttp2/transport/alpn.h \ src/core/ext/transport/chttp2/transport/bin_encoder.h \ src/core/ext/transport/chttp2/transport/chttp2_transport.h \ @@ -913,7 +913,7 @@ third_party/nanopb/pb_common.h \ third_party/nanopb/pb_decode.h \ third_party/nanopb/pb_encode.h \ src/core/ext/lb_policy/grpclb/load_balancer_api.c \ -src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h \ +src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c \ src/core/ext/lb_policy/pick_first/pick_first.c \ src/core/ext/lb_policy/round_robin/round_robin.c \ src/core/ext/transport/chttp2/client/insecure/channel_create.c \ diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index e3e22769219..6084a16aa1f 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -3989,7 +3989,7 @@ "include/grpc/impl/codegen/status.h", "include/grpc/status.h", "src/core/ext/lb_policy/grpclb/load_balancer_api.h", - "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", "src/core/ext/transport/chttp2/transport/alpn.h", "src/core/ext/transport/chttp2/transport/bin_encoder.h", "src/core/ext/transport/chttp2/transport/chttp2_transport.h", @@ -4614,7 +4614,7 @@ "include/grpc/impl/codegen/status.h", "include/grpc/status.h", "src/core/ext/lb_policy/grpclb/load_balancer_api.h", - "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c", + "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h", "src/core/ext/transport/chttp2/transport/alpn.h", "src/core/ext/transport/chttp2/transport/bin_encoder.h", "src/core/ext/transport/chttp2/transport/chttp2_transport.h", diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj b/vsprojects/vcxproj/grpc/grpc.vcxproj index 18b92fb359b..93d5a9b02fa 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj @@ -283,7 +283,7 @@ - + @@ -425,7 +425,7 @@ - + diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters index 31a852b692e..3e5032db0e1 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters @@ -4,7 +4,7 @@ src\core\ext\lb_policy\grpclb - + src\core\ext\lb_policy\grpclb\proto\grpc\lb\v0 @@ -542,7 +542,7 @@ src\core\ext\lb_policy\grpclb - + src\core\ext\lb_policy\grpclb\proto\grpc\lb\v0 diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj index 981d0a27147..98a6bee1704 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj @@ -273,7 +273,7 @@ - + @@ -401,7 +401,7 @@ - + diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters index cebb073c59b..81c8a874fc9 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters @@ -4,7 +4,7 @@ src\core\ext\lb_policy\grpclb - + src\core\ext\lb_policy\grpclb\proto\grpc\lb\v0 @@ -479,7 +479,7 @@ src\core\ext\lb_policy\grpclb - + src\core\ext\lb_policy\grpclb\proto\grpc\lb\v0 From 447bab1553d6b872e9cd447919f1b3a1e21c9ad6 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Tue, 29 Mar 2016 13:53:22 -0700 Subject: [PATCH 32/36] clang-format --- src/core/ext/lb_policy/grpclb/load_balancer_api.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/ext/lb_policy/grpclb/load_balancer_api.h b/src/core/ext/lb_policy/grpclb/load_balancer_api.h index b39b4635d34..d329a2ffe82 100644 --- a/src/core/ext/lb_policy/grpclb/load_balancer_api.h +++ b/src/core/ext/lb_policy/grpclb/load_balancer_api.h @@ -36,8 +36,8 @@ #include -#include "src/core/lib/client_config/lb_policy_factory.h" #include "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h" +#include "src/core/lib/client_config/lb_policy_factory.h" #ifdef __cplusplus extern "C" { From 2cff306779b11b2891b954dc41b72b025f88b386 Mon Sep 17 00:00:00 2001 From: Masood Malekghassemi Date: Tue, 29 Mar 2016 17:16:45 -0700 Subject: [PATCH 33/36] Add missing dependencies --- PYTHON-MANIFEST.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PYTHON-MANIFEST.in b/PYTHON-MANIFEST.in index 25aba87c187..534f4c1251a 100644 --- a/PYTHON-MANIFEST.in +++ b/PYTHON-MANIFEST.in @@ -2,8 +2,10 @@ recursive-include src/python/grpcio/grpc *.c *.h *.py *.pyx *.pxd *.pxi *.python recursive-exclude src/python/grpcio/grpc/_cython *.so *.pyd graft src/python/grpcio/tests graft src/core +graft src/boringssl graft include/grpc graft third_party/boringssl +graft third_party/nanopb graft third_party/zlib include src/python/grpcio/commands.py include src/python/grpcio/grpc_version.py From 6449049f5df15d34e1b5b9d5ad18f807abe3c8b1 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 30 Mar 2016 09:21:08 -0700 Subject: [PATCH 34/36] Fix merge error --- src/core/ext/transport/chttp2/transport/chttp2_transport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c index 04253339530..b835e74c56c 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c @@ -870,7 +870,7 @@ static void perform_stream_op_locked( if (stream_global->write_closed) { grpc_chttp2_complete_closure_step( exec_ctx, stream_global, &stream_global->send_message_finished, 0); - } else if (stream_global->id != 0) { + } else { stream_global->send_message = op->send_message; if (stream_global->id != 0) { grpc_chttp2_become_writable(transport_global, stream_global); From ff084614e030819e2f8a515d5b3d236f11851c20 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Wed, 30 Mar 2016 22:08:23 +0200 Subject: [PATCH 35/36] Flagging the 0.13.1 release. --- Makefile | 2 +- build.yaml | 2 +- package.json | 2 +- src/core/surface/version.c | 2 +- src/csharp/Grpc.Core/VersionInfo.cs | 2 +- src/csharp/build_packages.bat | 2 +- src/python/grpcio/grpc_version.py | 2 +- src/ruby/lib/grpc/version.rb | 2 +- tools/doxygen/Doxyfile.c++ | 2 +- tools/doxygen/Doxyfile.c++.internal | 2 +- tools/doxygen/Doxyfile.core | 2 +- tools/doxygen/Doxyfile.core.internal | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 371a06b8acd..6f8f772184d 100644 --- a/Makefile +++ b/Makefile @@ -367,7 +367,7 @@ E = @echo Q = @ endif -VERSION = 0.13.1-pre1 +VERSION = 0.13.1 CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) diff --git a/build.yaml b/build.yaml index eaaa62238b1..02f740f5c0c 100644 --- a/build.yaml +++ b/build.yaml @@ -7,7 +7,7 @@ settings: '#3': Use "-preN" suffixes to identify pre-release versions '#4': Per-language overrides are possible with (eg) ruby_version tag here '#5': See the expand_version.py for all the quirks here - version: 0.13.1-pre1 + version: 0.13.1 filegroups: - name: census public_headers: diff --git a/package.json b/package.json index 2df2a7fbe30..49aa6c24ec3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "grpc", - "version": "0.13.1-pre1", + "version": "0.13.1", "author": "Google Inc.", "description": "gRPC Library for Node", "homepage": "http://www.grpc.io/", diff --git a/src/core/surface/version.c b/src/core/surface/version.c index 19f0983c0f4..a5da20a3ed8 100644 --- a/src/core/surface/version.c +++ b/src/core/surface/version.c @@ -36,4 +36,4 @@ #include -const char *grpc_version_string(void) { return "0.13.1-pre1"; } +const char *grpc_version_string(void) { return "0.13.1"; } diff --git a/src/csharp/Grpc.Core/VersionInfo.cs b/src/csharp/Grpc.Core/VersionInfo.cs index 04741ae8352..e610d982f9c 100644 --- a/src/csharp/Grpc.Core/VersionInfo.cs +++ b/src/csharp/Grpc.Core/VersionInfo.cs @@ -46,6 +46,6 @@ namespace Grpc.Core /// /// Current version of gRPC C# /// - public const string CurrentVersion = "0.13.1-pre1"; + public const string CurrentVersion = "0.13.1"; } } diff --git a/src/csharp/build_packages.bat b/src/csharp/build_packages.bat index ea9f0a3712b..ed9d66921dc 100644 --- a/src/csharp/build_packages.bat +++ b/src/csharp/build_packages.bat @@ -1,7 +1,7 @@ @rem Builds gRPC NuGet packages @rem Current package versions -set VERSION=0.13.1-pre1 +set VERSION=0.13.1 set PROTOBUF_VERSION=3.0.0-beta2 @rem Packages that depend on prerelease packages (like Google.Protobuf) need to have prerelease suffix as well. diff --git a/src/python/grpcio/grpc_version.py b/src/python/grpcio/grpc_version.py index db23de2fedd..4a7256381de 100644 --- a/src/python/grpcio/grpc_version.py +++ b/src/python/grpcio/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!! -VERSION='0.13.1rc1' +VERSION='0.13.1' diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb index 42c94f06c82..930a80bebfe 100644 --- a/src/ruby/lib/grpc/version.rb +++ b/src/ruby/lib/grpc/version.rb @@ -29,5 +29,5 @@ # GRPC contains the General RPC module. module GRPC - VERSION = '0.13.1.pre1' + VERSION = '0.13.1' end diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 8256faf422d..c2be9765d33 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 0.13.1-pre1 +PROJECT_NUMBER = 0.13.1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 9533fbc7662..c40508c2e6d 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 0.13.1-pre1 +PROJECT_NUMBER = 0.13.1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.core b/tools/doxygen/Doxyfile.core index 89f93b9310d..cbe80b1ad12 100644 --- a/tools/doxygen/Doxyfile.core +++ b/tools/doxygen/Doxyfile.core @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC Core" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 0.13.1-pre1 +PROJECT_NUMBER = 0.13.1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index c94ae87fcee..2a1436de354 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC Core" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 0.13.1-pre1 +PROJECT_NUMBER = 0.13.1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a From dc5cd551498e3e3279cfaca26d369d6bb848bfe1 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Thu, 31 Mar 2016 02:00:48 +0200 Subject: [PATCH 36/36] The release-0_13 branch is now 0.13.2-pre1. --- Makefile | 2 +- build.yaml | 2 +- package.json | 2 +- src/core/surface/version.c | 2 +- src/csharp/Grpc.Core/VersionInfo.cs | 4 ++-- src/csharp/build_packages.bat | 2 +- src/python/grpcio/grpc_version.py | 2 +- src/ruby/lib/grpc/version.rb | 2 +- tools/doxygen/Doxyfile.c++ | 2 +- tools/doxygen/Doxyfile.c++.internal | 2 +- tools/doxygen/Doxyfile.core | 2 +- tools/doxygen/Doxyfile.core.internal | 2 +- 12 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 6f8f772184d..af3f8bd009f 100644 --- a/Makefile +++ b/Makefile @@ -367,7 +367,7 @@ E = @echo Q = @ endif -VERSION = 0.13.1 +VERSION = 0.13.2-pre1 CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) diff --git a/build.yaml b/build.yaml index 02f740f5c0c..65ea97973ce 100644 --- a/build.yaml +++ b/build.yaml @@ -7,7 +7,7 @@ settings: '#3': Use "-preN" suffixes to identify pre-release versions '#4': Per-language overrides are possible with (eg) ruby_version tag here '#5': See the expand_version.py for all the quirks here - version: 0.13.1 + version: 0.13.2-pre1 filegroups: - name: census public_headers: diff --git a/package.json b/package.json index 49aa6c24ec3..0965b6b8f82 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "grpc", - "version": "0.13.1", + "version": "0.13.2-pre1", "author": "Google Inc.", "description": "gRPC Library for Node", "homepage": "http://www.grpc.io/", diff --git a/src/core/surface/version.c b/src/core/surface/version.c index a5da20a3ed8..dc40261fd03 100644 --- a/src/core/surface/version.c +++ b/src/core/surface/version.c @@ -36,4 +36,4 @@ #include -const char *grpc_version_string(void) { return "0.13.1"; } +const char *grpc_version_string(void) { return "0.13.2-pre1"; } diff --git a/src/csharp/Grpc.Core/VersionInfo.cs b/src/csharp/Grpc.Core/VersionInfo.cs index e610d982f9c..adbfc4c11b1 100644 --- a/src/csharp/Grpc.Core/VersionInfo.cs +++ b/src/csharp/Grpc.Core/VersionInfo.cs @@ -41,11 +41,11 @@ namespace Grpc.Core /// /// Current version of gRPC C# assemblies /// - public const string CurrentAssemblyVersion = "0.13.1.0"; + public const string CurrentAssemblyVersion = "0.13.2.0"; /// /// Current version of gRPC C# /// - public const string CurrentVersion = "0.13.1"; + public const string CurrentVersion = "0.13.2-pre1"; } } diff --git a/src/csharp/build_packages.bat b/src/csharp/build_packages.bat index ed9d66921dc..680bd4d43d7 100644 --- a/src/csharp/build_packages.bat +++ b/src/csharp/build_packages.bat @@ -1,7 +1,7 @@ @rem Builds gRPC NuGet packages @rem Current package versions -set VERSION=0.13.1 +set VERSION=0.13.2-pre1 set PROTOBUF_VERSION=3.0.0-beta2 @rem Packages that depend on prerelease packages (like Google.Protobuf) need to have prerelease suffix as well. diff --git a/src/python/grpcio/grpc_version.py b/src/python/grpcio/grpc_version.py index 4a7256381de..10772f9c56d 100644 --- a/src/python/grpcio/grpc_version.py +++ b/src/python/grpcio/grpc_version.py @@ -29,4 +29,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!! -VERSION='0.13.1' +VERSION='0.13.2rc1' diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb index 930a80bebfe..8553f37d897 100644 --- a/src/ruby/lib/grpc/version.rb +++ b/src/ruby/lib/grpc/version.rb @@ -29,5 +29,5 @@ # GRPC contains the General RPC module. module GRPC - VERSION = '0.13.1' + VERSION = '0.13.2.pre1' end diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index c2be9765d33..6c6769a64f3 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 0.13.1 +PROJECT_NUMBER = 0.13.2-pre1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index c40508c2e6d..5b25cc9b7cf 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 0.13.1 +PROJECT_NUMBER = 0.13.2-pre1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.core b/tools/doxygen/Doxyfile.core index cbe80b1ad12..7f63eeb1f8e 100644 --- a/tools/doxygen/Doxyfile.core +++ b/tools/doxygen/Doxyfile.core @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC Core" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 0.13.1 +PROJECT_NUMBER = 0.13.2-pre1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 2a1436de354..a72c5c54d8a 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC Core" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 0.13.1 +PROJECT_NUMBER = 0.13.2-pre1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a