Skip to content

Commit

Permalink
Proto API for LB request/responses
Browse files Browse the repository at this point in the history
  • Loading branch information
dgquintas committed Nov 4, 2015
1 parent 241a5ad commit 4943374
Show file tree
Hide file tree
Showing 28 changed files with 4,300 additions and 1 deletion.
33 changes: 33 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ cc_library(
"src/core/channel/noop_filter.h",
"src/core/client_config/client_config.h",
"src/core/client_config/connector.h",
"src/core/client_config/lb_policies/load_balancer.pb.h",
"src/core/client_config/lb_policies/load_balancer_api.h",
"src/core/client_config/lb_policies/nanopb/pb.h",
"src/core/client_config/lb_policies/nanopb/pb_common.h",
"src/core/client_config/lb_policies/nanopb/pb_decode.h",
"src/core/client_config/lb_policies/nanopb/pb_encode.h",
"src/core/client_config/lb_policies/pick_first.h",
"src/core/client_config/lb_policies/round_robin.h",
"src/core/client_config/lb_policy.h",
Expand Down Expand Up @@ -298,6 +304,11 @@ cc_library(
"src/core/channel/noop_filter.c",
"src/core/client_config/client_config.c",
"src/core/client_config/connector.c",
"src/core/client_config/lb_policies/load_balancer.pb.c",
"src/core/client_config/lb_policies/load_balancer_api.c",
"src/core/client_config/lb_policies/nanopb/pb_common.c",
"src/core/client_config/lb_policies/nanopb/pb_decode.c",
"src/core/client_config/lb_policies/nanopb/pb_encode.c",
"src/core/client_config/lb_policies/pick_first.c",
"src/core/client_config/lb_policies/round_robin.c",
"src/core/client_config/lb_policy.c",
Expand Down Expand Up @@ -450,6 +461,12 @@ cc_library(
"src/core/channel/noop_filter.h",
"src/core/client_config/client_config.h",
"src/core/client_config/connector.h",
"src/core/client_config/lb_policies/load_balancer.pb.h",
"src/core/client_config/lb_policies/load_balancer_api.h",
"src/core/client_config/lb_policies/nanopb/pb.h",
"src/core/client_config/lb_policies/nanopb/pb_common.h",
"src/core/client_config/lb_policies/nanopb/pb_decode.h",
"src/core/client_config/lb_policies/nanopb/pb_encode.h",
"src/core/client_config/lb_policies/pick_first.h",
"src/core/client_config/lb_policies/round_robin.h",
"src/core/client_config/lb_policy.h",
Expand Down Expand Up @@ -566,6 +583,11 @@ cc_library(
"src/core/channel/noop_filter.c",
"src/core/client_config/client_config.c",
"src/core/client_config/connector.c",
"src/core/client_config/lb_policies/load_balancer.pb.c",
"src/core/client_config/lb_policies/load_balancer_api.c",
"src/core/client_config/lb_policies/nanopb/pb_common.c",
"src/core/client_config/lb_policies/nanopb/pb_decode.c",
"src/core/client_config/lb_policies/nanopb/pb_encode.c",
"src/core/client_config/lb_policies/pick_first.c",
"src/core/client_config/lb_policies/round_robin.c",
"src/core/client_config/lb_policy.c",
Expand Down Expand Up @@ -1094,6 +1116,11 @@ objc_library(
"src/core/channel/noop_filter.c",
"src/core/client_config/client_config.c",
"src/core/client_config/connector.c",
"src/core/client_config/lb_policies/load_balancer.pb.c",
"src/core/client_config/lb_policies/load_balancer_api.c",
"src/core/client_config/lb_policies/nanopb/pb_common.c",
"src/core/client_config/lb_policies/nanopb/pb_decode.c",
"src/core/client_config/lb_policies/nanopb/pb_encode.c",
"src/core/client_config/lb_policies/pick_first.c",
"src/core/client_config/lb_policies/round_robin.c",
"src/core/client_config/lb_policy.c",
Expand Down Expand Up @@ -1243,6 +1270,12 @@ objc_library(
"src/core/channel/noop_filter.h",
"src/core/client_config/client_config.h",
"src/core/client_config/connector.h",
"src/core/client_config/lb_policies/load_balancer.pb.h",
"src/core/client_config/lb_policies/load_balancer_api.h",
"src/core/client_config/lb_policies/nanopb/pb.h",
"src/core/client_config/lb_policies/nanopb/pb_common.h",
"src/core/client_config/lb_policies/nanopb/pb_decode.h",
"src/core/client_config/lb_policies/nanopb/pb_encode.h",
"src/core/client_config/lb_policies/pick_first.h",
"src/core/client_config/lb_policies/round_robin.h",
"src/core/client_config/lb_policy.h",
Expand Down
73 changes: 72 additions & 1 deletion Makefile

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@
'src/core/channel/noop_filter.c',
'src/core/client_config/client_config.c',
'src/core/client_config/connector.c',
'src/core/client_config/lb_policies/load_balancer.pb.c',
'src/core/client_config/lb_policies/load_balancer_api.c',
'src/core/client_config/lb_policies/nanopb/pb_common.c',
'src/core/client_config/lb_policies/nanopb/pb_decode.c',
'src/core/client_config/lb_policies/nanopb/pb_encode.c',
'src/core/client_config/lb_policies/pick_first.c',
'src/core/client_config/lb_policies/round_robin.c',
'src/core/client_config/lb_policy.c',
Expand Down
21 changes: 21 additions & 0 deletions build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ filegroups:
- src/core/channel/noop_filter.h
- src/core/client_config/client_config.h
- src/core/client_config/connector.h
- src/core/client_config/lb_policies/load_balancer.pb.h
- src/core/client_config/lb_policies/load_balancer_api.h
- src/core/client_config/lb_policies/nanopb/pb.h
- src/core/client_config/lb_policies/nanopb/pb_common.h
- src/core/client_config/lb_policies/nanopb/pb_decode.h
- src/core/client_config/lb_policies/nanopb/pb_encode.h
- src/core/client_config/lb_policies/pick_first.h
- src/core/client_config/lb_policies/round_robin.h
- src/core/client_config/lb_policy.h
Expand Down Expand Up @@ -231,6 +237,11 @@ filegroups:
- src/core/channel/noop_filter.c
- src/core/client_config/client_config.c
- src/core/client_config/connector.c
- src/core/client_config/lb_policies/load_balancer.pb.c
- src/core/client_config/lb_policies/load_balancer_api.c
- src/core/client_config/lb_policies/nanopb/pb_common.c
- src/core/client_config/lb_policies/nanopb/pb_decode.c
- src/core/client_config/lb_policies/nanopb/pb_encode.c
- src/core/client_config/lb_policies/pick_first.c
- src/core/client_config/lb_policies/round_robin.c
- src/core/client_config/lb_policy.c
Expand Down Expand Up @@ -1839,6 +1850,16 @@ targets:
secure: false
vs_config_type: Application
vs_project_guid: '{069E9D05-B78B-4751-9252-D21EBAE7DE8E}'
- name: grpclb_api_test
build: test
language: c++
src:
- src/core/client_config/lb_policies/protos/load_balancer.proto
- test/cpp/grpclb/grpclb_api_test.cc
deps:
- grpc++
- grpc
- gpr
- name: interop_client
build: test
run: false
Expand Down
17 changes: 17 additions & 0 deletions gRPC.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,12 @@ Pod::Spec.new do |s|
'src/core/channel/noop_filter.h',
'src/core/client_config/client_config.h',
'src/core/client_config/connector.h',
'src/core/client_config/lb_policies/load_balancer.pb.h',
'src/core/client_config/lb_policies/load_balancer_api.h',
'src/core/client_config/lb_policies/nanopb/pb.h',
'src/core/client_config/lb_policies/nanopb/pb_common.h',
'src/core/client_config/lb_policies/nanopb/pb_decode.h',
'src/core/client_config/lb_policies/nanopb/pb_encode.h',
'src/core/client_config/lb_policies/pick_first.h',
'src/core/client_config/lb_policies/round_robin.h',
'src/core/client_config/lb_policy.h',
Expand Down Expand Up @@ -309,6 +315,11 @@ Pod::Spec.new do |s|
'src/core/channel/noop_filter.c',
'src/core/client_config/client_config.c',
'src/core/client_config/connector.c',
'src/core/client_config/lb_policies/load_balancer.pb.c',
'src/core/client_config/lb_policies/load_balancer_api.c',
'src/core/client_config/lb_policies/nanopb/pb_common.c',
'src/core/client_config/lb_policies/nanopb/pb_decode.c',
'src/core/client_config/lb_policies/nanopb/pb_encode.c',
'src/core/client_config/lb_policies/pick_first.c',
'src/core/client_config/lb_policies/round_robin.c',
'src/core/client_config/lb_policy.c',
Expand Down Expand Up @@ -460,6 +471,12 @@ Pod::Spec.new do |s|
'src/core/channel/noop_filter.h',
'src/core/client_config/client_config.h',
'src/core/client_config/connector.h',
'src/core/client_config/lb_policies/load_balancer.pb.h',
'src/core/client_config/lb_policies/load_balancer_api.h',
'src/core/client_config/lb_policies/nanopb/pb.h',
'src/core/client_config/lb_policies/nanopb/pb_common.h',
'src/core/client_config/lb_policies/nanopb/pb_decode.h',
'src/core/client_config/lb_policies/nanopb/pb_encode.h',
'src/core/client_config/lb_policies/pick_first.h',
'src/core/client_config/lb_policies/round_robin.h',
'src/core/client_config/lb_policy.h',
Expand Down
87 changes: 87 additions & 0 deletions src/core/client_config/lb_policies/load_balancer.pb.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.3.5-dev at Wed Oct 21 14:38:11 2015. */

#include "load_balancer.pb.h"

#if PB_PROTO_HEADER_VERSION != 30
#error Regenerate this file with the current version of nanopb generator.
#endif



const pb_field_t grpc_lb_v0_Duration_fields[3] = {
PB_FIELD( 1, INT64 , OPTIONAL, STATIC , FIRST, grpc_lb_v0_Duration, seconds, seconds, 0),
PB_FIELD( 2, INT32 , OPTIONAL, STATIC , OTHER, grpc_lb_v0_Duration, nanos, seconds, 0),
PB_LAST_FIELD
};

const pb_field_t grpc_lb_v0_LoadBalanceRequest_fields[3] = {
PB_FIELD( 1, MESSAGE , OPTIONAL, STATIC , FIRST, grpc_lb_v0_LoadBalanceRequest, initial_request, initial_request, &grpc_lb_v0_InitialLoadBalanceRequest_fields),
PB_FIELD( 2, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_lb_v0_LoadBalanceRequest, client_stats, initial_request, &grpc_lb_v0_ClientStats_fields),
PB_LAST_FIELD
};

const pb_field_t grpc_lb_v0_InitialLoadBalanceRequest_fields[2] = {
PB_FIELD( 1, STRING , OPTIONAL, STATIC , FIRST, grpc_lb_v0_InitialLoadBalanceRequest, name, name, 0),
PB_LAST_FIELD
};

const pb_field_t grpc_lb_v0_ClientStats_fields[4] = {
PB_FIELD( 1, INT64 , OPTIONAL, STATIC , FIRST, grpc_lb_v0_ClientStats, total_requests, total_requests, 0),
PB_FIELD( 2, INT64 , OPTIONAL, STATIC , OTHER, grpc_lb_v0_ClientStats, client_rpc_errors, total_requests, 0),
PB_FIELD( 3, INT64 , OPTIONAL, STATIC , OTHER, grpc_lb_v0_ClientStats, dropped_requests, client_rpc_errors, 0),
PB_LAST_FIELD
};

const pb_field_t grpc_lb_v0_LoadBalanceResponse_fields[3] = {
PB_FIELD( 1, MESSAGE , OPTIONAL, STATIC , FIRST, grpc_lb_v0_LoadBalanceResponse, initial_response, initial_response, &grpc_lb_v0_InitialLoadBalanceResponse_fields),
PB_FIELD( 2, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_lb_v0_LoadBalanceResponse, server_list, initial_response, &grpc_lb_v0_ServerList_fields),
PB_LAST_FIELD
};

const pb_field_t grpc_lb_v0_InitialLoadBalanceResponse_fields[4] = {
PB_FIELD( 1, STRING , OPTIONAL, STATIC , FIRST, grpc_lb_v0_InitialLoadBalanceResponse, client_config, client_config, 0),
PB_FIELD( 2, STRING , OPTIONAL, STATIC , OTHER, grpc_lb_v0_InitialLoadBalanceResponse, load_balancer_delegate, client_config, 0),
PB_FIELD( 3, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_lb_v0_InitialLoadBalanceResponse, client_stats_report_interval, load_balancer_delegate, &grpc_lb_v0_Duration_fields),
PB_LAST_FIELD
};

const pb_field_t grpc_lb_v0_ServerList_fields[3] = {
PB_FIELD( 1, MESSAGE , REPEATED, CALLBACK, FIRST, grpc_lb_v0_ServerList, servers, servers, &grpc_lb_v0_Server_fields),
PB_FIELD( 3, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_lb_v0_ServerList, expiration_interval, servers, &grpc_lb_v0_Duration_fields),
PB_LAST_FIELD
};

const pb_field_t grpc_lb_v0_Server_fields[5] = {
PB_FIELD( 1, STRING , OPTIONAL, STATIC , FIRST, grpc_lb_v0_Server, ip_address, ip_address, 0),
PB_FIELD( 2, INT32 , OPTIONAL, STATIC , OTHER, grpc_lb_v0_Server, port, ip_address, 0),
PB_FIELD( 3, BYTES , OPTIONAL, STATIC , OTHER, grpc_lb_v0_Server, load_balance_token, port, 0),
PB_FIELD( 4, BOOL , OPTIONAL, STATIC , OTHER, grpc_lb_v0_Server, drop_request, load_balance_token, 0),
PB_LAST_FIELD
};


/* Check that field information fits in pb_field_t */
#if !defined(PB_FIELD_32BIT)
/* If you get an error here, it means that you need to define PB_FIELD_32BIT
* compile-time option. You can do that in pb.h or on compiler command line.
*
* The reason you need to do this is that some of your messages contain tag
* numbers or field sizes that are larger than what can fit in 8 or 16 bit
* field descriptors.
*/
PB_STATIC_ASSERT((pb_membersize(grpc_lb_v0_LoadBalanceRequest, initial_request) < 65536 && pb_membersize(grpc_lb_v0_LoadBalanceRequest, client_stats) < 65536 && pb_membersize(grpc_lb_v0_LoadBalanceResponse, initial_response) < 65536 && pb_membersize(grpc_lb_v0_LoadBalanceResponse, server_list) < 65536 && pb_membersize(grpc_lb_v0_InitialLoadBalanceResponse, client_stats_report_interval) < 65536 && pb_membersize(grpc_lb_v0_ServerList, servers) < 65536 && pb_membersize(grpc_lb_v0_ServerList, expiration_interval) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_grpc_lb_v0_Duration_grpc_lb_v0_LoadBalanceRequest_grpc_lb_v0_InitialLoadBalanceRequest_grpc_lb_v0_ClientStats_grpc_lb_v0_LoadBalanceResponse_grpc_lb_v0_InitialLoadBalanceResponse_grpc_lb_v0_ServerList_grpc_lb_v0_Server)
#endif

#if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT)
/* If you get an error here, it means that you need to define PB_FIELD_16BIT
* compile-time option. You can do that in pb.h or on compiler command line.
*
* The reason you need to do this is that some of your messages contain tag
* numbers or field sizes that are larger than what can fit in the default
* 8 bit descriptors.
*/
PB_STATIC_ASSERT((pb_membersize(grpc_lb_v0_LoadBalanceRequest, initial_request) < 256 && pb_membersize(grpc_lb_v0_LoadBalanceRequest, client_stats) < 256 && pb_membersize(grpc_lb_v0_LoadBalanceResponse, initial_response) < 256 && pb_membersize(grpc_lb_v0_LoadBalanceResponse, server_list) < 256 && pb_membersize(grpc_lb_v0_InitialLoadBalanceResponse, client_stats_report_interval) < 256 && pb_membersize(grpc_lb_v0_ServerList, servers) < 256 && pb_membersize(grpc_lb_v0_ServerList, expiration_interval) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_grpc_lb_v0_Duration_grpc_lb_v0_LoadBalanceRequest_grpc_lb_v0_InitialLoadBalanceRequest_grpc_lb_v0_ClientStats_grpc_lb_v0_LoadBalanceResponse_grpc_lb_v0_InitialLoadBalanceResponse_grpc_lb_v0_ServerList_grpc_lb_v0_Server)
#endif


Loading

0 comments on commit 4943374

Please sign in to comment.