GRPC Core  9.0.0
load_balancer_api.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2016 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 #ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_LOAD_BALANCER_API_H
20 #define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_LOAD_BALANCER_API_H
21 
23 
24 #include <grpc/slice_buffer.h>
25 
29 
30 #define GRPC_GRPCLB_SERVICE_NAME_MAX_LENGTH 128
31 #define GRPC_GRPCLB_SERVER_IP_ADDRESS_MAX_SIZE 16
32 #define GRPC_GRPCLB_SERVER_LOAD_BALANCE_TOKEN_MAX_SIZE 50
33 
34 namespace grpc_core {
35 
41 
42 typedef struct {
43  int32_t size;
46 
47 // Contains server information. When the drop field is not true, use the other
48 // fields.
49 typedef struct {
51  int32_t port;
53  bool drop;
55 
56 typedef struct {
58  size_t num_servers;
60 
65 grpc_grpclb_request* grpc_grpclb_request_create(const char* lb_service_name,
66  upb_arena* arena);
68  grpc_core::GrpcLbClientStats* client_stats, upb_arena* arena);
69 
72  upb_arena* arena);
73 
77  const grpc_slice& encoded_grpc_grpclb_response, upb_arena* arena);
78 
81  const grpc_slice& encoded_grpc_grpclb_response);
82 
86  const grpc_grpclb_serverlist* sl);
87 
89  const grpc_grpclb_serverlist* rhs);
90 
92  const grpc_grpclb_server* rhs);
93 
96 
98  const grpc_grpclb_duration* duration_pb);
99 
100 } // namespace grpc_core
101 
102 #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_LOAD_BALANCER_API_H \
103  */
grpc_lb_v1_LoadBalanceResponse grpc_grpclb_response
Definition: load_balancer_api.h:37
int64_t grpc_millis
Definition: exec_ctx.h:35
grpc_grpclb_serverlist * grpc_grpclb_serverlist_copy(const grpc_grpclb_serverlist *server_list)
Return a copy of sl.
Definition: load_balancer_api.cc:182
struct grpc_lb_v1_LoadBalanceRequest grpc_lb_v1_LoadBalanceRequest
Definition: load_balancer.upb.h:31
grpc_lb_v1_LoadBalanceRequest grpc_grpclb_request
Definition: load_balancer_api.h:36
size_t num_servers
Definition: load_balancer_api.h:58
grpc_millis grpc_grpclb_duration_to_millis(const grpc_grpclb_duration *duration_pb)
Definition: load_balancer_api.cc:219
A grpc_slice s, if initialized, represents the byte range s.bytes[0..s.length-1]. ...
Definition: slice.h:60
struct grpc_lb_v1_InitialLoadBalanceResponse grpc_lb_v1_InitialLoadBalanceResponse
Definition: load_balancer.upb.h:36
struct grpc_lb_v1_LoadBalanceResponse grpc_lb_v1_LoadBalanceResponse
Definition: load_balancer.upb.h:35
Definition: load_balancer_api.h:42
grpc_grpclb_serverlist * grpc_grpclb_response_parse_serverlist(const grpc_slice &encoded_grpc_grpclb_response)
Parse the list of servers from an encoded grpc_grpclb_response.
Definition: load_balancer_api.cc:116
grpc_grpclb_server_ip_address ip_address
Definition: load_balancer_api.h:50
Definition: grpclb_client_stats.h:33
Definition: load_balancer_api.h:49
Round Robin Policy.
Definition: backend_metric.cc:24
struct google_protobuf_Timestamp google_protobuf_Timestamp
Definition: timestamp.upb.h:24
grpc_grpclb_request * grpc_grpclb_request_create(const char *lb_service_name, upb_arena *arena)
Create a request for a gRPC LB service under lb_service_name.
Definition: load_balancer_api.cc:31
Definition: load_balancer_api.h:56
grpc_grpclb_request * grpc_grpclb_load_report_request_create(GrpcLbClientStats *client_stats, upb_arena *arena)
Definition: load_balancer_api.cc:53
int32_t port
Definition: load_balancer_api.h:51
const grpc_grpclb_initial_response * grpc_grpclb_initial_response_parse(const grpc_slice &encoded_grpc_grpclb_response, upb_arena *arena)
Parse (ie, decode) the bytes in encoded_grpc_grpclb_response as a grpc_grpclb_initial_response.
Definition: load_balancer_api.cc:102
bool grpc_grpclb_serverlist_equals(const grpc_grpclb_serverlist *lhs, const grpc_grpclb_serverlist *rhs)
Definition: load_balancer_api.cc:198
#define GRPC_GRPCLB_SERVER_IP_ADDRESS_MAX_SIZE
Definition: load_balancer_api.h:31
google_protobuf_Timestamp grpc_grpclb_timestamp
Definition: load_balancer_api.h:40
bool drop
Definition: load_balancer_api.h:53
bool grpc_grpclb_server_equals(const grpc_grpclb_server *lhs, const grpc_grpclb_server *rhs)
Definition: load_balancer_api.cc:214
void grpc_grpclb_destroy_serverlist(grpc_grpclb_serverlist *serverlist)
Destroy serverlist.
Definition: load_balancer_api.cc:171
grpc_lb_v1_InitialLoadBalanceResponse grpc_grpclb_initial_response
Definition: load_balancer_api.h:38
#define GRPC_GRPCLB_SERVER_LOAD_BALANCE_TOKEN_MAX_SIZE
Definition: load_balancer_api.h:32
int32_t size
Definition: load_balancer_api.h:43
grpc_grpclb_server ** servers
Definition: load_balancer_api.h:57
grpc_slice grpc_grpclb_request_encode(const grpc_grpclb_request *request, upb_arena *arena)
Protocol Buffers v3-encode request.
Definition: load_balancer_api.cc:94
google_protobuf_Duration grpc_grpclb_duration
Definition: load_balancer_api.h:39
struct google_protobuf_Duration google_protobuf_Duration
Definition: duration.upb.h:24