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 <stdint.h>
25 
26 #include <vector>
27 
28 #include "upb/upb.h"
29 
30 #include <grpc/slice.h>
31 
34 
35 #define GRPC_GRPCLB_SERVICE_NAME_MAX_LENGTH 128
36 #define GRPC_GRPCLB_SERVER_IP_ADDRESS_MAX_SIZE 16
37 #define GRPC_GRPCLB_SERVER_LOAD_BALANCE_TOKEN_MAX_SIZE 50
38 
39 namespace grpc_core {
40 
41 // Contains server information. When the drop field is not true, use the other
42 // fields.
43 struct GrpcLbServer {
48  bool drop;
49 
50  bool operator==(const GrpcLbServer& other) const;
51 };
52 
56  std::vector<GrpcLbServer> serverlist;
57 };
58 
59 // Creates a serialized grpclb request.
60 grpc_slice GrpcLbRequestCreate(const char* lb_service_name, upb_Arena* arena);
61 
62 // Creates a serialized grpclb load report request.
68  upb_Arena* arena);
69 
70 // Deserialize a grpclb response.
71 bool GrpcLbResponseParse(const grpc_slice& serialized_response,
73 
74 } // namespace grpc_core
75 
76 #endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_LOAD_BALANCER_API_H \
77  */
_gevent_test_main.result
result
Definition: _gevent_test_main.py:96
grpc_core::GrpcLbResponse::SERVERLIST
@ SERVERLIST
Definition: load_balancer_api.h:54
grpc_core::GrpcLbResponse::serverlist
std::vector< GrpcLbServer > serverlist
Definition: load_balancer_api.h:56
slice.h
grpc_core
Definition: call_metric_recorder.h:31
num_calls_started
size_t num_calls_started
Definition: grpclb_end2end_test.cc:157
grpc_core::GrpcLbResponse
Definition: load_balancer_api.h:53
grpc_core::GrpcLbLoadReportRequestCreate
grpc_slice GrpcLbLoadReportRequestCreate(int64_t num_calls_started, int64_t num_calls_finished, int64_t num_calls_finished_with_client_failed_to_send, int64_t num_calls_finished_known_received, const GrpcLbClientStats::DroppedCallCounts *drop_token_counts, upb_Arena *arena)
Definition: load_balancer_api.cc:84
grpc_core::GrpcLbResponse::client_stats_report_interval
Duration client_stats_report_interval
Definition: load_balancer_api.h:55
num_calls_finished
size_t num_calls_finished
Definition: grpclb_end2end_test.cc:158
arena
grpc_core::ScopedArenaPtr arena
Definition: binder_transport_test.cc:237
grpc_core::GrpcLbServer::operator==
bool operator==(const GrpcLbServer &other) const
Definition: load_balancer_api.cc:39
grpc_core::GrpcLbServer::ip_addr
char ip_addr[GRPC_GRPCLB_SERVER_IP_ADDRESS_MAX_SIZE]
Definition: load_balancer_api.h:45
int64_t
signed __int64 int64_t
Definition: stdint-msvc2008.h:89
upb.h
grpc_core::GrpcLbResponseParse
bool GrpcLbResponseParse(const grpc_slice &serialized_response, upb_Arena *arena, GrpcLbResponse *result)
Definition: load_balancer_api.cc:166
grpc_core::GrpcLbServer::drop
bool drop
Definition: load_balancer_api.h:48
grpc_core::GrpcLbResponse::type
enum grpc_core::GrpcLbResponse::@8 type
grpc_core::GrpcLbResponse::FALLBACK
@ FALLBACK
Definition: load_balancer_api.h:54
time.h
grpc_slice
Definition: include/grpc/impl/codegen/slice.h:65
grpc_core::GrpcLbServer::ip_size
int32_t ip_size
Definition: load_balancer_api.h:44
stdint.h
grpclb_client_stats.h
grpc_core::GrpcLbRequestCreate
grpc_slice GrpcLbRequestCreate(const char *lb_service_name, upb_Arena *arena)
Definition: load_balancer_api.cc:62
grpc_core::GrpcLbResponse::INITIAL
@ INITIAL
Definition: load_balancer_api.h:54
GRPC_GRPCLB_SERVER_IP_ADDRESS_MAX_SIZE
#define GRPC_GRPCLB_SERVER_IP_ADDRESS_MAX_SIZE
Definition: load_balancer_api.h:36
num_calls_finished_known_received
size_t num_calls_finished_known_received
Definition: grpclb_end2end_test.cc:160
GRPC_GRPCLB_SERVER_LOAD_BALANCE_TOKEN_MAX_SIZE
#define GRPC_GRPCLB_SERVER_LOAD_BALANCE_TOKEN_MAX_SIZE
Definition: load_balancer_api.h:37
grpc_core::GrpcLbServer::port
int32_t port
Definition: load_balancer_api.h:46
drop_token_counts
std::map< std::string, size_t > drop_token_counts
Definition: grpclb_end2end_test.cc:161
grpc_core::GrpcLbServer::load_balance_token
char load_balance_token[GRPC_GRPCLB_SERVER_LOAD_BALANCE_TOKEN_MAX_SIZE]
Definition: load_balancer_api.h:47
grpc_core::GrpcLbServer
Definition: load_balancer_api.h:43
absl::InlinedVector
Definition: abseil-cpp/absl/container/inlined_vector.h:69
num_calls_finished_with_client_failed_to_send
size_t num_calls_finished_with_client_failed_to_send
Definition: grpclb_end2end_test.cc:159
grpc_core::Duration
Definition: src/core/lib/gprpp/time.h:122
int32_t
signed int int32_t
Definition: stdint-msvc2008.h:77
upb_Arena
Definition: upb_internal.h:36
port_platform.h


grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:00:29