mirror of https://github.com/grpc/grpc.git
commit
3163a46f37
53 changed files with 2549 additions and 118 deletions
@ -0,0 +1,163 @@ |
||||
/*
|
||||
* |
||||
* 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. |
||||
* |
||||
*/ |
||||
|
||||
#include "src/core/client_config/lb_policies/load_balancer_api.h" |
||||
#include "third_party/nanopb/pb_decode.h" |
||||
#include "third_party/nanopb/pb_encode.h" |
||||
|
||||
#include <grpc/support/alloc.h> |
||||
|
||||
typedef struct decode_serverlist_arg { |
||||
int first_pass; |
||||
int i; |
||||
size_t num_servers; |
||||
grpc_grpclb_server **servers; |
||||
} decode_serverlist_arg; |
||||
|
||||
/* invoked once for every Server in ServerList */ |
||||
static bool decode_serverlist(pb_istream_t *stream, const pb_field_t *field, |
||||
void **arg) { |
||||
decode_serverlist_arg *dec_arg = *arg; |
||||
if (dec_arg->first_pass != 0) { /* first pass */ |
||||
grpc_grpclb_server server; |
||||
if (!pb_decode(stream, grpc_lb_v0_Server_fields, &server)) { |
||||
return false; |
||||
} |
||||
dec_arg->num_servers++; |
||||
} else { /* second pass */ |
||||
grpc_grpclb_server *server = gpr_malloc(sizeof(grpc_grpclb_server)); |
||||
GPR_ASSERT(dec_arg->num_servers > 0); |
||||
if (dec_arg->i == 0) { /* first iteration of second pass */ |
||||
dec_arg->servers = |
||||
gpr_malloc(sizeof(grpc_grpclb_server *) * dec_arg->num_servers); |
||||
} |
||||
if (!pb_decode(stream, grpc_lb_v0_Server_fields, server)) { |
||||
return false; |
||||
} |
||||
dec_arg->servers[dec_arg->i++] = server; |
||||
} |
||||
|
||||
return true; |
||||
} |
||||
|
||||
grpc_grpclb_request *grpc_grpclb_request_create(const char *lb_service_name) { |
||||
grpc_grpclb_request *req = gpr_malloc(sizeof(grpc_grpclb_request)); |
||||
|
||||
req->has_client_stats = 0; /* TODO(dgq): add support for stats once defined */ |
||||
req->has_initial_request = 1; |
||||
req->initial_request.has_name = 1; |
||||
strncpy(req->initial_request.name, lb_service_name, |
||||
GRPC_GRPCLB_SERVICE_NAME_MAX_LENGTH); |
||||
return req; |
||||
} |
||||
|
||||
gpr_slice grpc_grpclb_request_encode(const grpc_grpclb_request *request) { |
||||
size_t encoded_length; |
||||
pb_ostream_t sizestream; |
||||
pb_ostream_t outputstream; |
||||
gpr_slice slice; |
||||
memset(&sizestream, 0, sizeof(pb_ostream_t)); |
||||
pb_encode(&sizestream, grpc_lb_v0_LoadBalanceRequest_fields, request); |
||||
encoded_length = sizestream.bytes_written; |
||||
|
||||
slice = gpr_slice_malloc(encoded_length); |
||||
outputstream = |
||||
pb_ostream_from_buffer(GPR_SLICE_START_PTR(slice), encoded_length); |
||||
GPR_ASSERT(pb_encode(&outputstream, grpc_lb_v0_LoadBalanceRequest_fields, |
||||
request) != 0); |
||||
return slice; |
||||
} |
||||
|
||||
void grpc_grpclb_request_destroy(grpc_grpclb_request *request) { |
||||
gpr_free(request); |
||||
} |
||||
|
||||
grpc_grpclb_response *grpc_grpclb_response_parse(gpr_slice encoded_response) { |
||||
bool status; |
||||
pb_istream_t stream = |
||||
pb_istream_from_buffer(GPR_SLICE_START_PTR(encoded_response), |
||||
GPR_SLICE_LENGTH(encoded_response)); |
||||
grpc_grpclb_response *res = gpr_malloc(sizeof(grpc_grpclb_response)); |
||||
memset(res, 0, sizeof(*res)); |
||||
status = pb_decode(&stream, grpc_lb_v0_LoadBalanceResponse_fields, res); |
||||
GPR_ASSERT(status == true); |
||||
return res; |
||||
} |
||||
|
||||
grpc_grpclb_serverlist *grpc_grpclb_response_parse_serverlist( |
||||
gpr_slice encoded_response) { |
||||
grpc_grpclb_serverlist *sl = gpr_malloc(sizeof(grpc_grpclb_serverlist)); |
||||
bool status; |
||||
decode_serverlist_arg arg; |
||||
pb_istream_t stream = |
||||
pb_istream_from_buffer(GPR_SLICE_START_PTR(encoded_response), |
||||
GPR_SLICE_LENGTH(encoded_response)); |
||||
pb_istream_t stream_at_start = stream; |
||||
grpc_grpclb_response *res = gpr_malloc(sizeof(grpc_grpclb_response)); |
||||
memset(res, 0, sizeof(*res)); |
||||
memset(&arg, 0, sizeof(decode_serverlist_arg)); |
||||
|
||||
res->server_list.servers.funcs.decode = decode_serverlist; |
||||
res->server_list.servers.arg = &arg; |
||||
arg.first_pass = 1; |
||||
status = pb_decode(&stream, grpc_lb_v0_LoadBalanceResponse_fields, res); |
||||
GPR_ASSERT(status == true); |
||||
GPR_ASSERT(arg.num_servers > 0); |
||||
|
||||
arg.first_pass = 0; |
||||
status = |
||||
pb_decode(&stream_at_start, grpc_lb_v0_LoadBalanceResponse_fields, res); |
||||
GPR_ASSERT(status == true); |
||||
GPR_ASSERT(arg.servers != NULL); |
||||
|
||||
sl->num_servers = arg.num_servers; |
||||
sl->servers = arg.servers; |
||||
if (res->server_list.has_expiration_interval) { |
||||
sl->expiration_interval = res->server_list.expiration_interval; |
||||
} |
||||
grpc_grpclb_response_destroy(res); |
||||
return sl; |
||||
} |
||||
|
||||
void grpc_grpclb_destroy_serverlist(grpc_grpclb_serverlist *serverlist) { |
||||
size_t i; |
||||
for (i = 0; i < serverlist->num_servers; i++) { |
||||
gpr_free(serverlist->servers[i]); |
||||
} |
||||
gpr_free(serverlist->servers); |
||||
gpr_free(serverlist); |
||||
} |
||||
|
||||
void grpc_grpclb_response_destroy(grpc_grpclb_response *response) { |
||||
gpr_free(response); |
||||
} |
@ -0,0 +1,85 @@ |
||||
/*
|
||||
* |
||||
* 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. |
||||
* |
||||
*/ |
||||
|
||||
#ifndef GRPC_INTERNAL_CORE_CLIENT_CONFIG_LB_POLICIES_LOAD_BALANCER_API_H |
||||
#define GRPC_INTERNAL_CORE_CLIENT_CONFIG_LB_POLICIES_LOAD_BALANCER_API_H |
||||
|
||||
#include <grpc/support/slice_buffer.h> |
||||
|
||||
#include "src/core/client_config/lb_policy_factory.h" |
||||
#include "src/core/proto/grpc/lb/v0/load_balancer.pb.h" |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
#define GRPC_GRPCLB_SERVICE_NAME_MAX_LENGTH 128 |
||||
|
||||
typedef grpc_lb_v0_LoadBalanceRequest grpc_grpclb_request; |
||||
typedef grpc_lb_v0_LoadBalanceResponse grpc_grpclb_response; |
||||
typedef grpc_lb_v0_Server grpc_grpclb_server; |
||||
typedef grpc_lb_v0_Duration grpc_grpclb_duration; |
||||
typedef struct grpc_grpclb_serverlist { |
||||
grpc_grpclb_server **servers; |
||||
size_t num_servers; |
||||
grpc_grpclb_duration expiration_interval; |
||||
} grpc_grpclb_serverlist; |
||||
|
||||
/** Create a request for a gRPC LB service under \a lb_service_name */ |
||||
grpc_grpclb_request *grpc_grpclb_request_create(const char *lb_service_name); |
||||
|
||||
/** Protocol Buffers v3-encode \a request */ |
||||
gpr_slice grpc_grpclb_request_encode(const grpc_grpclb_request *request); |
||||
|
||||
/** Destroy \a request */ |
||||
void grpc_grpclb_request_destroy(grpc_grpclb_request *request); |
||||
|
||||
/** Parse (ie, decode) the bytes in \a encoded_response as a \a
|
||||
* grpc_grpclb_response */ |
||||
grpc_grpclb_response *grpc_grpclb_response_parse(gpr_slice encoded_response); |
||||
|
||||
/** Destroy \a serverlist */ |
||||
void grpc_grpclb_destroy_serverlist(grpc_grpclb_serverlist *serverlist); |
||||
|
||||
/** Parse the list of servers from an encoded \a grpc_grpclb_response */ |
||||
grpc_grpclb_serverlist *grpc_grpclb_response_parse_serverlist( |
||||
gpr_slice encoded_response); |
||||
|
||||
/** Destroy \a response */ |
||||
void grpc_grpclb_response_destroy(grpc_grpclb_response *response); |
||||
|
||||
#ifdef __cplusplus |
||||
} |
||||
#endif |
||||
|
||||
#endif /* GRPC_INTERNAL_CORE_CLIENT_CONFIG_LB_POLICIES_LOAD_BALANCER_API_H */ |
@ -0,0 +1,119 @@ |
||||
/*
|
||||
* |
||||
* 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. |
||||
* |
||||
*/ |
||||
/* Automatically generated nanopb constant definitions */ |
||||
/* Generated by nanopb-0.3.5-dev */ |
||||
|
||||
#include "src/core/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. |
||||
#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 |
||||
|
||||
|
@ -0,0 +1,182 @@ |
||||
/*
|
||||
* |
||||
* 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. |
||||
* |
||||
*/ |
||||
/* Automatically generated nanopb header */ |
||||
/* Generated by nanopb-0.3.5-dev */ |
||||
|
||||
#ifndef PB_LOAD_BALANCER_PB_H_INCLUDED |
||||
#define PB_LOAD_BALANCER_PB_H_INCLUDED |
||||
#include "third_party/nanopb/pb.h" |
||||
#if PB_PROTO_HEADER_VERSION != 30 |
||||
#error Regenerate this file with the current version of nanopb generator. |
||||
#endif |
||||
|
||||
#ifdef __cplusplus |
||||
extern "C" { |
||||
#endif |
||||
|
||||
/* Struct definitions */ |
||||
typedef struct _grpc_lb_v0_ClientStats { |
||||
bool has_total_requests; |
||||
int64_t total_requests; |
||||
bool has_client_rpc_errors; |
||||
int64_t client_rpc_errors; |
||||
bool has_dropped_requests; |
||||
int64_t dropped_requests; |
||||
} grpc_lb_v0_ClientStats; |
||||
|
||||
typedef struct _grpc_lb_v0_Duration { |
||||
bool has_seconds; |
||||
int64_t seconds; |
||||
bool has_nanos; |
||||
int32_t nanos; |
||||
} grpc_lb_v0_Duration; |
||||
|
||||
typedef struct _grpc_lb_v0_InitialLoadBalanceRequest { |
||||
bool has_name; |
||||
char name[128]; |
||||
} grpc_lb_v0_InitialLoadBalanceRequest; |
||||
|
||||
typedef PB_BYTES_ARRAY_T(64) grpc_lb_v0_Server_load_balance_token_t; |
||||
typedef struct _grpc_lb_v0_Server { |
||||
bool has_ip_address; |
||||
char ip_address[46]; |
||||
bool has_port; |
||||
int32_t port; |
||||
bool has_load_balance_token; |
||||
grpc_lb_v0_Server_load_balance_token_t load_balance_token; |
||||
bool has_drop_request; |
||||
bool drop_request; |
||||
} grpc_lb_v0_Server; |
||||
|
||||
typedef struct _grpc_lb_v0_InitialLoadBalanceResponse { |
||||
bool has_client_config; |
||||
char client_config[64]; |
||||
bool has_load_balancer_delegate; |
||||
char load_balancer_delegate[64]; |
||||
bool has_client_stats_report_interval; |
||||
grpc_lb_v0_Duration client_stats_report_interval; |
||||
} grpc_lb_v0_InitialLoadBalanceResponse; |
||||
|
||||
typedef struct _grpc_lb_v0_LoadBalanceRequest { |
||||
bool has_initial_request; |
||||
grpc_lb_v0_InitialLoadBalanceRequest initial_request; |
||||
bool has_client_stats; |
||||
grpc_lb_v0_ClientStats client_stats; |
||||
} grpc_lb_v0_LoadBalanceRequest; |
||||
|
||||
typedef struct _grpc_lb_v0_ServerList { |
||||
pb_callback_t servers; |
||||
bool has_expiration_interval; |
||||
grpc_lb_v0_Duration expiration_interval; |
||||
} grpc_lb_v0_ServerList; |
||||
|
||||
typedef struct _grpc_lb_v0_LoadBalanceResponse { |
||||
bool has_initial_response; |
||||
grpc_lb_v0_InitialLoadBalanceResponse initial_response; |
||||
bool has_server_list; |
||||
grpc_lb_v0_ServerList server_list; |
||||
} grpc_lb_v0_LoadBalanceResponse; |
||||
|
||||
/* Default values for struct fields */ |
||||
|
||||
/* Initializer values for message structs */ |
||||
#define grpc_lb_v0_Duration_init_default {false, 0, false, 0} |
||||
#define grpc_lb_v0_LoadBalanceRequest_init_default {false, grpc_lb_v0_InitialLoadBalanceRequest_init_default, false, grpc_lb_v0_ClientStats_init_default} |
||||
#define grpc_lb_v0_InitialLoadBalanceRequest_init_default {false, ""} |
||||
#define grpc_lb_v0_ClientStats_init_default {false, 0, false, 0, false, 0} |
||||
#define grpc_lb_v0_LoadBalanceResponse_init_default {false, grpc_lb_v0_InitialLoadBalanceResponse_init_default, false, grpc_lb_v0_ServerList_init_default} |
||||
#define grpc_lb_v0_InitialLoadBalanceResponse_init_default {false, "", false, "", false, grpc_lb_v0_Duration_init_default} |
||||
#define grpc_lb_v0_ServerList_init_default {{{NULL}, NULL}, false, grpc_lb_v0_Duration_init_default} |
||||
#define grpc_lb_v0_Server_init_default {false, "", false, 0, false, {0, {0}}, false, 0} |
||||
#define grpc_lb_v0_Duration_init_zero {false, 0, false, 0} |
||||
#define grpc_lb_v0_LoadBalanceRequest_init_zero {false, grpc_lb_v0_InitialLoadBalanceRequest_init_zero, false, grpc_lb_v0_ClientStats_init_zero} |
||||
#define grpc_lb_v0_InitialLoadBalanceRequest_init_zero {false, ""} |
||||
#define grpc_lb_v0_ClientStats_init_zero {false, 0, false, 0, false, 0} |
||||
#define grpc_lb_v0_LoadBalanceResponse_init_zero {false, grpc_lb_v0_InitialLoadBalanceResponse_init_zero, false, grpc_lb_v0_ServerList_init_zero} |
||||
#define grpc_lb_v0_InitialLoadBalanceResponse_init_zero {false, "", false, "", false, grpc_lb_v0_Duration_init_zero} |
||||
#define grpc_lb_v0_ServerList_init_zero {{{NULL}, NULL}, false, grpc_lb_v0_Duration_init_zero} |
||||
#define grpc_lb_v0_Server_init_zero {false, "", false, 0, false, {0, {0}}, false, 0} |
||||
|
||||
/* Field tags (for use in manual encoding/decoding) */ |
||||
#define grpc_lb_v0_ClientStats_total_requests_tag 1 |
||||
#define grpc_lb_v0_ClientStats_client_rpc_errors_tag 2 |
||||
#define grpc_lb_v0_ClientStats_dropped_requests_tag 3 |
||||
#define grpc_lb_v0_Duration_seconds_tag 1 |
||||
#define grpc_lb_v0_Duration_nanos_tag 2 |
||||
#define grpc_lb_v0_InitialLoadBalanceRequest_name_tag 1 |
||||
#define grpc_lb_v0_Server_ip_address_tag 1 |
||||
#define grpc_lb_v0_Server_port_tag 2 |
||||
#define grpc_lb_v0_Server_load_balance_token_tag 3 |
||||
#define grpc_lb_v0_Server_drop_request_tag 4 |
||||
#define grpc_lb_v0_InitialLoadBalanceResponse_client_config_tag 1 |
||||
#define grpc_lb_v0_InitialLoadBalanceResponse_load_balancer_delegate_tag 2 |
||||
#define grpc_lb_v0_InitialLoadBalanceResponse_client_stats_report_interval_tag 3 |
||||
#define grpc_lb_v0_LoadBalanceRequest_initial_request_tag 1 |
||||
#define grpc_lb_v0_LoadBalanceRequest_client_stats_tag 2 |
||||
#define grpc_lb_v0_ServerList_servers_tag 1 |
||||
#define grpc_lb_v0_ServerList_expiration_interval_tag 3 |
||||
#define grpc_lb_v0_LoadBalanceResponse_initial_response_tag 1 |
||||
#define grpc_lb_v0_LoadBalanceResponse_server_list_tag 2 |
||||
|
||||
/* Struct field encoding specification for nanopb */ |
||||
extern const pb_field_t grpc_lb_v0_Duration_fields[3]; |
||||
extern const pb_field_t grpc_lb_v0_LoadBalanceRequest_fields[3]; |
||||
extern const pb_field_t grpc_lb_v0_InitialLoadBalanceRequest_fields[2]; |
||||
extern const pb_field_t grpc_lb_v0_ClientStats_fields[4]; |
||||
extern const pb_field_t grpc_lb_v0_LoadBalanceResponse_fields[3]; |
||||
extern const pb_field_t grpc_lb_v0_InitialLoadBalanceResponse_fields[4]; |
||||
extern const pb_field_t grpc_lb_v0_ServerList_fields[3]; |
||||
extern const pb_field_t grpc_lb_v0_Server_fields[5]; |
||||
|
||||
/* Maximum encoded size of messages (where known) */ |
||||
#define grpc_lb_v0_Duration_size 22 |
||||
#define grpc_lb_v0_LoadBalanceRequest_size 169 |
||||
#define grpc_lb_v0_InitialLoadBalanceRequest_size 131 |
||||
#define grpc_lb_v0_ClientStats_size 33 |
||||
#define grpc_lb_v0_LoadBalanceResponse_size (165 + grpc_lb_v0_ServerList_size) |
||||
#define grpc_lb_v0_InitialLoadBalanceResponse_size 156 |
||||
#define grpc_lb_v0_Server_size 127 |
||||
|
||||
/* Message IDs (where set with "msgid" option) */ |
||||
#ifdef PB_MSGID |
||||
|
||||
#define LOAD_BALANCER_MESSAGES \ |
||||
|
||||
|
||||
#endif |
||||
|
||||
#ifdef __cplusplus |
||||
} /* extern "C" */ |
||||
#endif |
||||
|
||||
#endif |
@ -0,0 +1,6 @@ |
||||
grpc.lb.v0.InitialLoadBalanceRequest.name max_size:128 |
||||
grpc.lb.v0.InitialLoadBalanceResponse.client_config max_size:64 |
||||
grpc.lb.v0.InitialLoadBalanceResponse.load_balancer_delegate max_size:64 |
||||
grpc.lb.v0.Server.ip_address max_size:46 |
||||
grpc.lb.v0.Server.load_balance_token max_size:64 |
||||
load_balancer.proto no_unions:true |
@ -0,0 +1,144 @@ |
||||
// 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. |
||||
|
||||
syntax = "proto3"; |
||||
|
||||
package grpc.lb.v0; |
||||
|
||||
message Duration { |
||||
|
||||
// Signed seconds of the span of time. Must be from -315,576,000,000 |
||||
// to +315,576,000,000 inclusive. |
||||
int64 seconds = 1; |
||||
|
||||
// Signed fractions of a second at nanosecond resolution of the span |
||||
// of time. Durations less than one second are represented with a 0 |
||||
// `seconds` field and a positive or negative `nanos` field. For durations |
||||
// of one second or more, a non-zero value for the `nanos` field must be |
||||
// of the same sign as the `seconds` field. Must be from -999,999,999 |
||||
// to +999,999,999 inclusive. |
||||
int32 nanos = 2; |
||||
} |
||||
|
||||
service LoadBalancer { |
||||
// Bidirectional rpc to get a list of servers. |
||||
rpc BalanceLoad(stream LoadBalanceRequest) |
||||
returns (stream LoadBalanceResponse); |
||||
} |
||||
|
||||
message LoadBalanceRequest { |
||||
oneof load_balance_request_type { |
||||
// This message should be sent on the first request to the load balancer. |
||||
InitialLoadBalanceRequest initial_request = 1; |
||||
|
||||
// The client stats should be periodically reported to the load balancer |
||||
// based on the duration defined in the InitialLoadBalanceResponse. |
||||
ClientStats client_stats = 2; |
||||
} |
||||
} |
||||
|
||||
message InitialLoadBalanceRequest { |
||||
// Name of load balanced service (IE, service.grpc.gslb.google.com) |
||||
string name = 1; |
||||
} |
||||
|
||||
// Contains client level statistics that are useful to load balancing. Each |
||||
// count should be reset to zero after reporting the stats. |
||||
message ClientStats { |
||||
// The total number of requests sent by the client since the last report. |
||||
int64 total_requests = 1; |
||||
|
||||
// The number of client rpc errors since the last report. |
||||
int64 client_rpc_errors = 2; |
||||
|
||||
// The number of dropped requests since the last report. |
||||
int64 dropped_requests = 3; |
||||
} |
||||
|
||||
message LoadBalanceResponse { |
||||
oneof load_balance_response_type { |
||||
// This message should be sent on the first response to the client. |
||||
InitialLoadBalanceResponse initial_response = 1; |
||||
|
||||
// Contains the list of servers selected by the load balancer. The client |
||||
// should send requests to these servers in the specified order. |
||||
ServerList server_list = 2; |
||||
} |
||||
} |
||||
|
||||
message InitialLoadBalanceResponse { |
||||
oneof initial_response_type { |
||||
// Contains gRPC config options like RPC deadline or flow control. |
||||
// TODO(yetianx): Change to ClientConfig after it is defined. |
||||
string client_config = 1; |
||||
|
||||
// This is an application layer redirect that indicates the client should |
||||
// use the specified server for load balancing. When this field is set in |
||||
// the response, the client should open a separate connection to the |
||||
// load_balancer_delegate and call the BalanceLoad method. |
||||
string load_balancer_delegate = 2; |
||||
} |
||||
|
||||
// This interval defines how often the client should send the client stats |
||||
// to the load balancer. Stats should only be reported when the duration is |
||||
// positive. |
||||
Duration client_stats_report_interval = 3; |
||||
} |
||||
|
||||
message ServerList { |
||||
// Contains a list of servers selected by the load balancer. The list will |
||||
// be updated when server resolutions change or as needed to balance load |
||||
// across more servers. The client should consume the server list in order |
||||
// unless instructed otherwise via the client_config. |
||||
repeated Server servers = 1; |
||||
|
||||
// Indicates the amount of time that the client should consider this server |
||||
// list as valid. It may be considered stale after waiting this interval of |
||||
// time after receiving the list. If the interval is not positive, the |
||||
// client can assume the list is valid until the next list is received. |
||||
Duration expiration_interval = 3; |
||||
} |
||||
|
||||
message Server { |
||||
// A resolved address and port for the server. The IP address string may |
||||
// either be an IPv4 or IPv6 address. |
||||
string ip_address = 1; |
||||
int32 port = 2; |
||||
|
||||
// An opaque token that is passed from the client to the server in metadata. |
||||
// The server may expect this token to indicate that the request from the |
||||
// client was load balanced. |
||||
// TODO(yetianx): Not used right now, and will be used after implementing |
||||
// load report. |
||||
bytes load_balance_token = 3; |
||||
|
||||
// Indicates whether this particular request should be dropped by the client |
||||
// when this server is chosen from the list. |
||||
bool drop_request = 4; |
||||
} |
@ -1,22 +1,52 @@ |
||||
# gRPC Summer of Code Project Ideas |
||||
|
||||
C Core: |
||||
Hello students! |
||||
|
||||
1. Port gRPC to one of (Free, Net, Open) BSD platforms and create packages for them. Add kqueue support in the process. |
||||
2. Fix gRPC C-core's URI parser. The current parser does not qualify as a standard parser according to [RFC3986]( https://tools.ietf.org/html/rfc3986). Write test suites to verify this and make changes necessary to make the URI parser compliant. |
||||
3. HPACK compression efficiency evaluation - Figure out how to benchmark gRPC's compression efficiency (both in terms of bytes on the wire and cpu cycles). Implement benchmarks. Potentially extend this to other standalone implementations -- Java and Go. |
||||
We want gRPC to be the universal remote procedure call protocol for all |
||||
computing platforms and paradigms, so while these are our ideas of what we |
||||
think would make good projects for the summer, we're eager to hear your ideas |
||||
and proposals as well. |
||||
[Try us out](https://github.com/grpc/grpc/blob/master/CONTRIBUTING.md) and get |
||||
to know the gRPC code and team! |
||||
|
||||
**Required skills for all projects:** git version control, collaborative |
||||
software development on github.com, and software development in at least one |
||||
of gRPC's ten languages on at least one of Linux, Mac OS X, and Windows. |
||||
|
||||
------------------------------------- |
||||
|
||||
gRPC C Core: |
||||
|
||||
1. Port gRPC to one of the major BSD platforms ([FreeBSD](https://freebsd.org), [NetBSD](https://netbsd.org), and [OpenBSD](https://openbsd.org)) and create packages for them. Add [kqueue](https://www.freebsd.org/cgi/man.cgi?query=kqueue) support in the process. |
||||
* **Required skills:** C programming language, BSD operating system. |
||||
* **Likely mentors:** [Craig Tiller](https://github.com/ctiller), [Nicolas Noble](https://github.com/nicolasnoble). |
||||
1. Fix gRPC C-core's URI parser. The current parser does not qualify as a standard parser according to [RFC3986]( https://tools.ietf.org/html/rfc3986). Write test suites to verify this and make changes necessary to make the URI parser compliant. |
||||
* **Required skills:** C programming language, HTTP standard compliance. |
||||
* **Likely mentors:** [Craig Tiller](https://github.com/ctiller). |
||||
1. HPACK compression efficiency evaluation - Figure out how to benchmark gRPC's compression efficiency (both in terms of bytes on the wire and cpu cycles). Implement benchmarks. Potentially extend this to other full-stack gRPC implementations (Java and Go). |
||||
* **Required skills:** C programming language, software performance benchmarking, potentially Java and Go. |
||||
* **Likely mentors:** [Craig Tiller](https://github.com/ctiller). |
||||
|
||||
|
||||
gRPC Python: |
||||
|
||||
1. Evaluate the port of gRPC's Python implementation to PyPy. Investigate the state of [Cython support](http://docs.cython.org/src/userguide/pypy.html) to do this or potentially explore cffi |
||||
2. Develop and test Python 3.5 Support for gRPC. Make necessary changes to port gRPC and package it for supported platforms. |
||||
1. Port gRPC Python to [PyPy](http://pypy.org). Investigate the state of [Cython support](http://docs.cython.org/src/userguide/pypy.html) to do this or potentially explore [cffi](https://cffi.readthedocs.org/en/latest/). |
||||
* **Required skills:** Python programming language, PyPy Python interpreter. |
||||
* **Likely mentors:** [Nathaniel Manista](https://github.com/nathanielmanistaatgoogle), [Masood Malekghassemi](https://github.com/soltanmm). |
||||
1. Develop and test Python 3.5 Support for gRPC. Make necessary changes to port gRPC and package it for supported platforms. |
||||
* **Required skills:** Python programming language, PyPy Python interpreter. |
||||
* **Likely mentors:** [Nathaniel Manista](https://github.com/nathanielmanistaatgoogle), [Masood Malekghassemi](https://github.com/soltanmm). |
||||
|
||||
gRPC Ruby/Java: |
||||
|
||||
1. jRuby support for gRPC. Develop a jRuby wrapper for gRPC based on grpc-java and ensure that it is API compatible with the existing Ruby implementation and passes all tests. |
||||
1. [jRuby](http://jruby.org) support for gRPC. Develop a jRuby wrapper for gRPC based on grpc-java and ensure that it is API compatible with the existing Ruby implementation and passes all tests. |
||||
* **Required skills:** Java programming language, Ruby programming language. |
||||
* **Likely mentors:** [Michael Lumish](https://github.com/murgatroid99), [Eric Anderson](https://github.com/ejona86). |
||||
|
||||
|
||||
Other: |
||||
gRPC Wire Protocol: |
||||
|
||||
1. Develop a Wireshark plugin for the gRPC protocol. Provide documentation and tutorials for this plugin. Bonus: consider set-up and use with the mobile clients. |
||||
1. Develop a [Wireshark](https://wireshark.org) plugin for the gRPC protocol. Provide documentation and tutorials for this plugin. |
||||
* **Bonus:** consider set-up and use with mobile clients. |
||||
* **Required skills:** Wireshark software. |
||||
* **Likely mentors:** [Nicolas Noble](https://github.com/nicolasnoble). |
||||
|
@ -0,0 +1,133 @@ |
||||
/*
|
||||
* |
||||
* 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. |
||||
* |
||||
*/ |
||||
|
||||
#include <gtest/gtest.h> |
||||
#include <string> |
||||
|
||||
#include "src/core/client_config/lb_policies/load_balancer_api.h" |
||||
#include "src/proto/grpc/lb/v0/load_balancer.pb.h" // C++ version |
||||
|
||||
namespace grpc { |
||||
namespace { |
||||
|
||||
using grpc::lb::v0::LoadBalanceRequest; |
||||
using grpc::lb::v0::LoadBalanceResponse; |
||||
|
||||
class GrpclbTest : public ::testing::Test {}; |
||||
|
||||
TEST_F(GrpclbTest, CreateRequest) { |
||||
const std::string service_name = "AServiceName"; |
||||
LoadBalanceRequest request; |
||||
grpc_grpclb_request* c_req = grpc_grpclb_request_create(service_name.c_str()); |
||||
gpr_slice slice = grpc_grpclb_request_encode(c_req); |
||||
const int num_bytes_written = GPR_SLICE_LENGTH(slice); |
||||
EXPECT_GT(num_bytes_written, 0); |
||||
request.ParseFromArray(GPR_SLICE_START_PTR(slice), num_bytes_written); |
||||
EXPECT_EQ(request.initial_request().name(), service_name); |
||||
gpr_slice_unref(slice); |
||||
grpc_grpclb_request_destroy(c_req); |
||||
} |
||||
|
||||
TEST_F(GrpclbTest, ParseResponse) { |
||||
LoadBalanceResponse response; |
||||
const std::string client_config_str = "I'm a client config"; |
||||
auto* initial_response = response.mutable_initial_response(); |
||||
initial_response->set_client_config(client_config_str); |
||||
auto* client_stats_report_interval = |
||||
initial_response->mutable_client_stats_report_interval(); |
||||
client_stats_report_interval->set_seconds(123); |
||||
client_stats_report_interval->set_nanos(456); |
||||
|
||||
const std::string encoded_response = response.SerializeAsString(); |
||||
gpr_slice encoded_slice = |
||||
gpr_slice_from_copied_string(encoded_response.c_str()); |
||||
grpc_grpclb_response* c_response = grpc_grpclb_response_parse(encoded_slice); |
||||
EXPECT_TRUE(c_response->has_initial_response); |
||||
EXPECT_TRUE(c_response->initial_response.has_client_config); |
||||
EXPECT_FALSE(c_response->initial_response.has_load_balancer_delegate); |
||||
EXPECT_TRUE(strcmp(c_response->initial_response.client_config, |
||||
client_config_str.c_str()) == 0); |
||||
EXPECT_EQ(c_response->initial_response.client_stats_report_interval.seconds, |
||||
123); |
||||
EXPECT_EQ(c_response->initial_response.client_stats_report_interval.nanos, |
||||
456); |
||||
gpr_slice_unref(encoded_slice); |
||||
grpc_grpclb_response_destroy(c_response); |
||||
} |
||||
|
||||
TEST_F(GrpclbTest, ParseResponseServerList) { |
||||
LoadBalanceResponse response; |
||||
auto* serverlist = response.mutable_server_list(); |
||||
auto* server = serverlist->add_servers(); |
||||
server->set_ip_address("127.0.0.1"); |
||||
server->set_port(12345); |
||||
server->set_drop_request(true); |
||||
server = response.mutable_server_list()->add_servers(); |
||||
server->set_ip_address("10.0.0.1"); |
||||
server->set_port(54321); |
||||
server->set_drop_request(false); |
||||
auto* expiration_interval = serverlist->mutable_expiration_interval(); |
||||
expiration_interval->set_seconds(888); |
||||
expiration_interval->set_nanos(999); |
||||
|
||||
const std::string encoded_response = response.SerializeAsString(); |
||||
gpr_slice encoded_slice = |
||||
gpr_slice_from_copied_string(encoded_response.c_str()); |
||||
grpc_grpclb_serverlist* c_serverlist = |
||||
grpc_grpclb_response_parse_serverlist(encoded_slice); |
||||
ASSERT_EQ(c_serverlist->num_servers, 2ul); |
||||
EXPECT_TRUE(c_serverlist->servers[0]->has_ip_address); |
||||
EXPECT_TRUE(strcmp(c_serverlist->servers[0]->ip_address, "127.0.0.1") == 0); |
||||
EXPECT_EQ(c_serverlist->servers[0]->port, 12345); |
||||
EXPECT_TRUE(c_serverlist->servers[0]->drop_request); |
||||
EXPECT_TRUE(c_serverlist->servers[1]->has_ip_address); |
||||
EXPECT_TRUE(strcmp(c_serverlist->servers[1]->ip_address, "10.0.0.1") == 0); |
||||
EXPECT_EQ(c_serverlist->servers[1]->port, 54321); |
||||
EXPECT_FALSE(c_serverlist->servers[1]->drop_request); |
||||
|
||||
EXPECT_TRUE(c_serverlist->expiration_interval.has_seconds); |
||||
EXPECT_EQ(c_serverlist->expiration_interval.seconds, 888); |
||||
EXPECT_TRUE(c_serverlist->expiration_interval.has_nanos); |
||||
EXPECT_EQ(c_serverlist->expiration_interval.nanos, 999); |
||||
|
||||
gpr_slice_unref(encoded_slice); |
||||
grpc_grpclb_destroy_serverlist(c_serverlist); |
||||
} |
||||
|
||||
} // namespace
|
||||
} // namespace grpc
|
||||
|
||||
int main(int argc, char** argv) { |
||||
::testing::InitGoogleTest(&argc, argv); |
||||
return RUN_ALL_TESTS(); |
||||
} |
@ -0,0 +1 @@ |
||||
Subproject commit f8ac463766281625ad710900479130c7fcb4d63b |
@ -0,0 +1,138 @@ |
||||
#!/bin/bash |
||||
|
||||
# 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. |
||||
|
||||
# |
||||
# Example usage: |
||||
# tools/codegen/core/gen_load_balancing_proto.sh \ |
||||
# src/proto/grpc/lb/v0/load_balancer.proto |
||||
|
||||
read -r -d '' COPYRIGHT <<'EOF' |
||||
/* |
||||
* |
||||
* Copyright <YEAR>, 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. |
||||
* |
||||
*/ |
||||
|
||||
EOF |
||||
|
||||
CURRENT_YEAR=$(date +%Y) |
||||
COPYRIGHT_FILE=$(mktemp) |
||||
echo "${COPYRIGHT/<YEAR>/$CURRENT_YEAR}" > $COPYRIGHT_FILE |
||||
|
||||
set -ex |
||||
if [ $# -eq 0 ]; then |
||||
echo "Usage: $0 <load_balancer.proto> [output dir]" |
||||
exit 1 |
||||
fi |
||||
|
||||
readonly GRPC_ROOT=$PWD |
||||
|
||||
OUTPUT_DIR="$GRPC_ROOT/src/core/proto/grpc/lb/v0" |
||||
if [ $# -eq 2 ]; then |
||||
mkdir -p "$2" |
||||
if [ $? != 0 ]; then |
||||
echo "Error creating output directory $2" |
||||
exit 2 |
||||
fi |
||||
OUTPUT_DIR="$2" |
||||
fi |
||||
|
||||
readonly EXPECTED_OPTIONS_FILE_PATH="${1%.*}.options" |
||||
|
||||
if [[ ! -f "$1" ]]; then |
||||
echo "Input proto file '$1' doesn't exist." |
||||
exit 3 |
||||
fi |
||||
if [[ ! -f "${EXPECTED_OPTIONS_FILE_PATH}" ]]; then |
||||
echo "Expected nanopb options file '${EXPECTED_OPTIONS_FILE_PATH}' missing" |
||||
exit 4 |
||||
fi |
||||
|
||||
readonly VENV_DIR=$(mktemp -d) |
||||
readonly VENV_NAME="nanopb-$(date '+%Y%m%d_%H%M%S_%N')" |
||||
pushd $VENV_DIR |
||||
virtualenv $VENV_NAME |
||||
. $VENV_NAME/bin/activate |
||||
popd |
||||
|
||||
# this should be the same version as the submodule we compile against |
||||
# ideally we'd update this as a template to ensure that |
||||
pip install protobuf==3.0.0b2 |
||||
|
||||
pushd "$(dirname $1)" > /dev/null |
||||
|
||||
protoc \ |
||||
--plugin=protoc-gen-nanopb="$GRPC_ROOT/third_party/nanopb/generator/protoc-gen-nanopb" \ |
||||
--nanopb_out='-T -L#include\ \"third_party/nanopb/pb.h\"'":$OUTPUT_DIR" \ |
||||
"$(basename $1)" |
||||
|
||||
readonly PROTO_BASENAME=$(basename $1 .proto) |
||||
sed -i "s:$PROTO_BASENAME.pb.h:src/core/proto/grpc/lb/v0/$PROTO_BASENAME.pb.h:g" \ |
||||
"$OUTPUT_DIR/$PROTO_BASENAME.pb.c" |
||||
|
||||
# prepend copyright |
||||
TMPFILE=$(mktemp) |
||||
cat $COPYRIGHT_FILE "$OUTPUT_DIR/$PROTO_BASENAME.pb.c" > $TMPFILE |
||||
mv -v $TMPFILE "$OUTPUT_DIR/$PROTO_BASENAME.pb.c" |
||||
cat $COPYRIGHT_FILE "$OUTPUT_DIR/$PROTO_BASENAME.pb.h" > $TMPFILE |
||||
mv -v $TMPFILE "$OUTPUT_DIR/$PROTO_BASENAME.pb.h" |
||||
|
||||
deactivate |
||||
rm -rf $VENV_DIR |
||||
|
||||
popd > /dev/null |
@ -0,0 +1,68 @@ |
||||
#!/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 |
||||
|
||||
apt-get install -y autoconf automake libtool curl python-virtualenv |
||||
|
||||
readonly NANOPB_TMP_OUTPUT="$(mktemp -d)" |
||||
|
||||
# install protoc version 3 |
||||
pushd third_party/protobuf |
||||
./autogen.sh |
||||
./configure |
||||
make |
||||
make install |
||||
ldconfig |
||||
popd |
||||
|
||||
if [ ! -x "/usr/local/bin/protoc" ]; then |
||||
echo "Error: protoc not found in path" |
||||
exit 1 |
||||
fi |
||||
readonly PROTOC_PATH='/usr/local/bin' |
||||
# stack up and change to nanopb's proto generator directory |
||||
pushd third_party/nanopb/generator/proto |
||||
PATH="$PROTOC_PATH:$PATH" make |
||||
|
||||
# back to the root directory |
||||
popd |
||||
|
||||
|
||||
# nanopb-compile the proto to a temp location |
||||
PATH="$PROTOC_PATH:$PATH" ./tools/codegen/core/gen_load_balancing_proto.sh \ |
||||
src/proto/grpc/lb/v0/load_balancer.proto \ |
||||
$NANOPB_TMP_OUTPUT |
||||
|
||||
# compare outputs to checked compiled code |
||||
if ! diff -r $NANOPB_TMP_OUTPUT src/core/proto/grpc/lb/v0; then |
||||
echo "Outputs differ: $NANOPB_TMP_OUTPUT vs src/core/proto/grpc/lb/v0" |
||||
exit 2 |
||||
fi |
@ -0,0 +1,63 @@ |
||||
# 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. |
||||
|
||||
# Docker file for building protoc and gRPC protoc plugin artifacts. |
||||
# forked from https://github.com/google/protobuf/blob/master/protoc-artifacts/Dockerfile |
||||
|
||||
FROM centos:6.6 |
||||
|
||||
RUN yum install -y git \ |
||||
tar \ |
||||
wget \ |
||||
make \ |
||||
autoconf \ |
||||
curl-devel \ |
||||
unzip \ |
||||
automake \ |
||||
libtool \ |
||||
glibc-static.i686 \ |
||||
glibc-devel \ |
||||
glibc-devel.i686 |
||||
|
||||
# Install GCC 4.7 to support -static-libstdc++ |
||||
RUN wget http://people.centos.org/tru/devtools-1.1/devtools-1.1.repo -P /etc/yum.repos.d |
||||
RUN bash -c 'echo "enabled=1" >> /etc/yum.repos.d/devtools-1.1.repo' |
||||
RUN bash -c "sed -e 's/\$basearch/i386/g' /etc/yum.repos.d/devtools-1.1.repo > /etc/yum.repos.d/devtools-i386-1.1.repo" |
||||
RUN sed -e 's/testing-/testing-i386-/g' -i /etc/yum.repos.d/devtools-i386-1.1.repo |
||||
|
||||
# We'll get and "Rpmdb checksum is invalid: dCDPT(pkg checksums)" error caused by |
||||
# docker issue when using overlay storage driver, but all the stuff we need |
||||
# will be installed, so for now we just ignore the error. |
||||
# https://github.com/docker/docker/issues/10180 |
||||
RUN yum install -y devtoolset-1.1 \ |
||||
devtoolset-1.1-libstdc++-devel \ |
||||
devtoolset-1.1-libstdc++-devel.i686 || true |
||||
|
||||
# Start in devtoolset environment that uses GCC 4.7 |
||||
CMD ["scl", "enable", "devtoolset-1.1", "bash"] |
@ -0,0 +1,51 @@ |
||||
@rem Copyright 2016, Google Inc. |
||||
@rem All rights reserved. |
||||
@rem |
||||
@rem Redistribution and use in source and binary forms, with or without |
||||
@rem modification, are permitted provided that the following conditions are |
||||
@rem met: |
||||
@rem |
||||
@rem * Redistributions of source code must retain the above copyright |
||||
@rem notice, this list of conditions and the following disclaimer. |
||||
@rem * Redistributions in binary form must reproduce the above |
||||
@rem copyright notice, this list of conditions and the following disclaimer |
||||
@rem in the documentation and/or other materials provided with the |
||||
@rem distribution. |
||||
@rem * Neither the name of Google Inc. nor the names of its |
||||
@rem contributors may be used to endorse or promote products derived from |
||||
@rem this software without specific prior written permission. |
||||
@rem |
||||
@rem THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
@rem "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
@rem LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
@rem A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
@rem OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
@rem SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
@rem LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
@rem DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
@rem THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
@rem (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
@rem OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
|
||||
mkdir artifacts |
||||
|
||||
setlocal |
||||
cd third_party/protobuf |
||||
|
||||
powershell -Command "Invoke-WebRequest https://googlemock.googlecode.com/files/gmock-1.7.0.zip -OutFile gmock.zip" |
||||
powershell -Command "Add-Type -Assembly 'System.IO.Compression.FileSystem'; [System.IO.Compression.ZipFile]::ExtractToDirectory('gmock.zip', '.');" |
||||
rename gmock-1.7.0 gmock |
||||
|
||||
cd cmake |
||||
cmake -G "%generator%" || goto :error |
||||
endlocal |
||||
|
||||
call vsprojects/build_plugins.bat || goto :error |
||||
|
||||
xcopy /Y third_party\protobuf\cmake\Release\protoc.exe artifacts\ || goto :error |
||||
xcopy /Y vsprojects\Release\*_plugin.exe artifacts\ || xcopy /Y vsprojects\x64\Release\*_plugin.exe artifacts\ || goto :error |
||||
|
||||
goto :EOF |
||||
|
||||
:error |
||||
exit /b 1 |
@ -0,0 +1,41 @@ |
||||
#!/bin/bash |
||||
# 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. |
||||
|
||||
# Use devtoolset environment that has GCC 4.7 before set -ex |
||||
source scl_source enable devtoolset-1.1 |
||||
|
||||
set -ex |
||||
|
||||
cd $(dirname $0)/../.. |
||||
|
||||
make plugins |
||||
|
||||
mkdir -p artifacts |
||||
cp bins/opt/protobuf/protoc bins/opt/*_plugin artifacts/ |
@ -0,0 +1,97 @@ |
||||
#!/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. |
||||
|
||||
import sys |
||||
import yaml |
||||
import os |
||||
import re |
||||
import subprocess |
||||
|
||||
errors = 0 |
||||
|
||||
os.chdir(os.path.join(os.path.dirname(sys.argv[0]), '../../..')) |
||||
|
||||
# hack import paths to pick up extra code |
||||
sys.path.insert(0, os.path.abspath('tools/buildgen/plugins')) |
||||
from expand_version import Version |
||||
|
||||
try: |
||||
branch_name = subprocess.check_output( |
||||
'git rev-parse --abbrev-ref HEAD', |
||||
shell=True) |
||||
except: |
||||
print 'WARNING: not a git repository' |
||||
branch_name = None |
||||
|
||||
if branch_name is not None: |
||||
m = re.match(r'^release-([0-9]+)_([0-9]+)$', branch_name) |
||||
if m: |
||||
print 'RELEASE branch' |
||||
# version number should align with the branched version |
||||
check_version = lambda version: ( |
||||
version.major == int(m.group(1)) and |
||||
version.minor == int(m.group(2))) |
||||
warning = 'Version key "%%s" value "%%s" should have a major version %s and minor version %s' % (m.group(1), m.group(2)) |
||||
elif re.match(r'^debian/.*$', branch_name): |
||||
# no additional version checks for debian branches |
||||
check_version = lambda version: True |
||||
else: |
||||
# all other branches should have a -dev tag |
||||
check_version = lambda version: version.tag == 'dev' |
||||
warning = 'Version key "%s" value "%s" should have a -dev tag' |
||||
else: |
||||
check_version = lambda version: True |
||||
|
||||
with open('build.yaml', 'r') as f: |
||||
build_yaml = yaml.load(f.read()) |
||||
|
||||
settings = build_yaml['settings'] |
||||
|
||||
top_version = Version(settings['version']) |
||||
if not check_version(top_version): |
||||
errors += 1 |
||||
print warning % ('version', top_version) |
||||
|
||||
for tag, value in settings.iteritems(): |
||||
if re.match(r'^[a-z]+_version$', tag): |
||||
value = Version(value) |
||||
if value.major != top_version.major: |
||||
errors += 1 |
||||
print 'major version mismatch on %s: %d vs %d' % (tag, value.major, top_version.major) |
||||
if value.minor != top_version.minor: |
||||
errors += 1 |
||||
print 'minor version mismatch on %s: %d vs %d' % (tag, value.minor, top_version.minor) |
||||
if not check_version(value): |
||||
errors += 1 |
||||
print warning % (tag, value) |
||||
|
||||
sys.exit(errors) |
||||
|
@ -1,9 +1,11 @@ |
||||
# a set of tests that are run in parallel for sanity tests |
||||
- script: tools/run_tests/sanity/check_cache_mk.sh |
||||
- script: tools/run_tests/sanity/check_sources_and_headers.py |
||||
- script: tools/run_tests/sanity/check_submodules.sh |
||||
- script: tools/run_tests/sanity/check_cache_mk.sh |
||||
- script: tools/run_tests/sanity/check_version.py |
||||
- script: tools/buildgen/generate_projects.sh -j 3 |
||||
cpu_cost: 3 |
||||
- script: tools/distrib/check_copyright.py |
||||
- script: tools/distrib/clang_format_code.sh |
||||
- script: tools/distrib/check_trailing_newlines.sh |
||||
- script: tools/distrib/check_nanopb_output.sh |
||||
|
@ -1 +1 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ImportGroup Label="PropertySheets" /> <PropertyGroup Label="UserMacros" /> <PropertyGroup /> <ItemDefinitionGroup> <Link> <AdditionalDependencies>libprotoc.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalLibraryDirectories>$(SolutionDir)\..\third_party\protobuf\cmake\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> </Link> </ItemDefinitionGroup> <ItemGroup /> </Project> |
||||
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ImportGroup Label="PropertySheets" /> <PropertyGroup Label="UserMacros" /> <PropertyGroup /> <ItemDefinitionGroup> <ClCompile> <DisableSpecificWarnings>4244;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings> </ClCompile> <Link> <AdditionalDependencies>libprotoc.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalLibraryDirectories>$(SolutionDir)\..\third_party\protobuf\cmake\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> </Link> </ItemDefinitionGroup> <ItemGroup /> </Project> |
@ -0,0 +1,209 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.props" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\1.0.204.1.props')" /> |
||||
<ItemGroup Label="ProjectConfigurations"> |
||||
<ProjectConfiguration Include="Debug|Win32"> |
||||
<Configuration>Debug</Configuration> |
||||
<Platform>Win32</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Debug|x64"> |
||||
<Configuration>Debug</Configuration> |
||||
<Platform>x64</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Release|Win32"> |
||||
<Configuration>Release</Configuration> |
||||
<Platform>Win32</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Release|x64"> |
||||
<Configuration>Release</Configuration> |
||||
<Platform>x64</Platform> |
||||
</ProjectConfiguration> |
||||
</ItemGroup> |
||||
<PropertyGroup Label="Globals"> |
||||
<ProjectGuid>{990AF023-17D7-8DBF-EB6E-14C7C016C77E}</ProjectGuid> |
||||
<IgnoreWarnIntDirInTempDetected>true</IgnoreWarnIntDirInTempDetected> |
||||
<IntDir>$(SolutionDir)IntDir\$(MSBuildProjectName)\</IntDir> |
||||
</PropertyGroup> |
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |
||||
<PropertyGroup Condition="'$(VisualStudioVersion)' == '10.0'" Label="Configuration"> |
||||
<PlatformToolset>v100</PlatformToolset> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(VisualStudioVersion)' == '11.0'" Label="Configuration"> |
||||
<PlatformToolset>v110</PlatformToolset> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(VisualStudioVersion)' == '12.0'" Label="Configuration"> |
||||
<PlatformToolset>v120</PlatformToolset> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(VisualStudioVersion)' == '14.0'" Label="Configuration"> |
||||
<PlatformToolset>v140</PlatformToolset> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration"> |
||||
<ConfigurationType>Application</ConfigurationType> |
||||
<UseDebugLibraries>true</UseDebugLibraries> |
||||
<CharacterSet>Unicode</CharacterSet> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration"> |
||||
<ConfigurationType>Application</ConfigurationType> |
||||
<UseDebugLibraries>false</UseDebugLibraries> |
||||
<WholeProgramOptimization>true</WholeProgramOptimization> |
||||
<CharacterSet>Unicode</CharacterSet> |
||||
</PropertyGroup> |
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
||||
<ImportGroup Label="ExtensionSettings"> |
||||
</ImportGroup> |
||||
<ImportGroup Label="PropertySheets"> |
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\cpptest.props" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\global.props" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\openssl.props" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\protobuf.props" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\winsock.props" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\zlib.props" /> |
||||
</ImportGroup> |
||||
<PropertyGroup Label="UserMacros" /> |
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'"> |
||||
<TargetName>grpclb_api_test</TargetName> |
||||
<Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib> |
||||
<Configuration-grpc_dependencies_zlib>Debug</Configuration-grpc_dependencies_zlib> |
||||
<Linkage-grpc_dependencies_openssl>static</Linkage-grpc_dependencies_openssl> |
||||
<Configuration-grpc_dependencies_openssl>Debug</Configuration-grpc_dependencies_openssl> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'"> |
||||
<TargetName>grpclb_api_test</TargetName> |
||||
<Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib> |
||||
<Configuration-grpc_dependencies_zlib>Release</Configuration-grpc_dependencies_zlib> |
||||
<Linkage-grpc_dependencies_openssl>static</Linkage-grpc_dependencies_openssl> |
||||
<Configuration-grpc_dependencies_openssl>Release</Configuration-grpc_dependencies_openssl> |
||||
</PropertyGroup> |
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||
<ClCompile> |
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<Optimization>Disabled</Optimization> |
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
<SDLCheck>true</SDLCheck> |
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> |
||||
<TreatWarningAsError>true</TreatWarningAsError> |
||||
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> |
||||
<MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Console</SubSystem> |
||||
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> |
||||
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
||||
<ClCompile> |
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<Optimization>Disabled</Optimization> |
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
<SDLCheck>true</SDLCheck> |
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> |
||||
<TreatWarningAsError>true</TreatWarningAsError> |
||||
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> |
||||
<MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Console</SubSystem> |
||||
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> |
||||
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||
<ClCompile> |
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<Optimization>MaxSpeed</Optimization> |
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||
<SDLCheck>true</SDLCheck> |
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> |
||||
<TreatWarningAsError>true</TreatWarningAsError> |
||||
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> |
||||
<MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Console</SubSystem> |
||||
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> |
||||
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> |
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||
<OptimizeReferences>true</OptimizeReferences> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
||||
<ClCompile> |
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<Optimization>MaxSpeed</Optimization> |
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||
<SDLCheck>true</SDLCheck> |
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> |
||||
<TreatWarningAsError>true</TreatWarningAsError> |
||||
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> |
||||
<MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Console</SubSystem> |
||||
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> |
||||
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> |
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||
<OptimizeReferences>true</OptimizeReferences> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
|
||||
<ItemGroup> |
||||
<ClCompile Include="$(SolutionDir)\..\src\proto\grpc\lb\v0\load_balancer.pb.cc"> |
||||
</ClCompile> |
||||
<ClInclude Include="$(SolutionDir)\..\src\proto\grpc\lb\v0\load_balancer.pb.h"> |
||||
</ClInclude> |
||||
<ClCompile Include="$(SolutionDir)\..\src\proto\grpc\lb\v0\load_balancer.grpc.pb.cc"> |
||||
</ClCompile> |
||||
<ClInclude Include="$(SolutionDir)\..\src\proto\grpc\lb\v0\load_balancer.grpc.pb.h"> |
||||
</ClInclude> |
||||
<ClCompile Include="$(SolutionDir)\..\test\cpp\grpclb\grpclb_api_test.cc"> |
||||
</ClCompile> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc++_test_util\grpc++_test_util.vcxproj"> |
||||
<Project>{0BE77741-552A-929B-A497-4EF7ECE17A64}</Project> |
||||
</ProjectReference> |
||||
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc_test_util\grpc_test_util.vcxproj"> |
||||
<Project>{17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}</Project> |
||||
</ProjectReference> |
||||
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc++\grpc++.vcxproj"> |
||||
<Project>{C187A093-A0FE-489D-A40A-6E33DE0F9FEB}</Project> |
||||
</ProjectReference> |
||||
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc\grpc.vcxproj"> |
||||
<Project>{29D16885-7228-4C31-81ED-5F9187C7F2A9}</Project> |
||||
</ProjectReference> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<None Include="packages.config" /> |
||||
</ItemGroup> |
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
||||
<ImportGroup Label="ExtensionTargets"> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies.zlib.redist.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies\grpc.dependencies.zlib.targets')" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies.zlib.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies\grpc.dependencies.zlib.targets')" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies.openssl.redist.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies\grpc.dependencies.openssl.targets')" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies\grpc.dependencies.openssl.targets')" /> |
||||
</ImportGroup> |
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> |
||||
<PropertyGroup> |
||||
<ErrorText>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}.</ErrorText> |
||||
</PropertyGroup> |
||||
<Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies.zlib.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies.zlib.redist.targets')" /> |
||||
<Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies.zlib.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies.zlib.targets')" /> |
||||
<Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies.openssl.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies.openssl.redist.targets')" /> |
||||
<Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.props')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.props')" /> |
||||
<Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.targets')" /> |
||||
</Target> |
||||
</Project> |
||||
|
@ -0,0 +1,39 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<ItemGroup> |
||||
<ClCompile Include="$(SolutionDir)\..\src\proto\grpc\lb\v0\load_balancer.proto"> |
||||
<Filter>src\proto\grpc\lb\v0</Filter> |
||||
</ClCompile> |
||||
<ClCompile Include="$(SolutionDir)\..\test\cpp\grpclb\grpclb_api_test.cc"> |
||||
<Filter>test\cpp\grpclb</Filter> |
||||
</ClCompile> |
||||
</ItemGroup> |
||||
|
||||
<ItemGroup> |
||||
<Filter Include="src"> |
||||
<UniqueIdentifier>{a31d21fb-c6ab-75ce-43dc-7d6f506765e6}</UniqueIdentifier> |
||||
</Filter> |
||||
<Filter Include="src\proto"> |
||||
<UniqueIdentifier>{10d49c90-8503-9b10-6678-eed983bc25d9}</UniqueIdentifier> |
||||
</Filter> |
||||
<Filter Include="src\proto\grpc"> |
||||
<UniqueIdentifier>{8b6be783-e071-44cc-2096-f1c476012556}</UniqueIdentifier> |
||||
</Filter> |
||||
<Filter Include="src\proto\grpc\lb"> |
||||
<UniqueIdentifier>{2981699e-c196-c599-bc17-c177770f89ee}</UniqueIdentifier> |
||||
</Filter> |
||||
<Filter Include="src\proto\grpc\lb\v0"> |
||||
<UniqueIdentifier>{3d04774a-1c2f-e100-435e-08af5d539250}</UniqueIdentifier> |
||||
</Filter> |
||||
<Filter Include="test"> |
||||
<UniqueIdentifier>{64736e1d-eb77-664f-34ab-6cf41263d3d8}</UniqueIdentifier> |
||||
</Filter> |
||||
<Filter Include="test\cpp"> |
||||
<UniqueIdentifier>{c86e9cb1-bed4-3697-40f2-9ecff6297fa5}</UniqueIdentifier> |
||||
</Filter> |
||||
<Filter Include="test\cpp\grpclb"> |
||||
<UniqueIdentifier>{6b5ba83a-6cf2-5a7b-0ab8-62de31882705}</UniqueIdentifier> |
||||
</Filter> |
||||
</ItemGroup> |
||||
</Project> |
||||
|
Loading…
Reference in new issue