OSDN Git Service

new repo
[bytom/vapor.git] / vendor / google.golang.org / grpc / grpclb / grpc_lb_v1 / messages / messages.proto
1 // Copyright 2016 gRPC authors.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 syntax = "proto3";
16
17 package grpc.lb.v1;
18 option go_package = "google.golang.org/grpc/grpclb/grpc_lb_v1/messages";
19
20 message Duration {
21   // Signed seconds of the span of time. Must be from -315,576,000,000
22   // to +315,576,000,000 inclusive.
23   int64 seconds = 1;
24
25   // Signed fractions of a second at nanosecond resolution of the span
26   // of time. Durations less than one second are represented with a 0
27   // `seconds` field and a positive or negative `nanos` field. For durations
28   // of one second or more, a non-zero value for the `nanos` field must be
29   // of the same sign as the `seconds` field. Must be from -999,999,999
30   // to +999,999,999 inclusive.
31   int32 nanos = 2;
32 }
33
34 message Timestamp {
35   // Represents seconds of UTC time since Unix epoch
36   // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
37   // 9999-12-31T23:59:59Z inclusive.
38   int64 seconds = 1;
39
40   // Non-negative fractions of a second at nanosecond resolution. Negative
41   // second values with fractions must still have non-negative nanos values
42   // that count forward in time. Must be from 0 to 999,999,999
43   // inclusive.
44   int32 nanos = 2;
45 }
46
47 message LoadBalanceRequest {
48   oneof load_balance_request_type {
49     // This message should be sent on the first request to the load balancer.
50     InitialLoadBalanceRequest initial_request = 1;
51
52     // The client stats should be periodically reported to the load balancer
53     // based on the duration defined in the InitialLoadBalanceResponse.
54     ClientStats client_stats = 2;
55   }
56 }
57
58 message InitialLoadBalanceRequest {
59   // Name of load balanced service (IE, balancer.service.com)
60   // length should be less than 256 bytes.
61   string name = 1;
62 }
63
64 // Contains client level statistics that are useful to load balancing. Each
65 // count except the timestamp should be reset to zero after reporting the stats.
66 message ClientStats {
67   // The timestamp of generating the report.
68   Timestamp timestamp = 1;
69
70   // The total number of RPCs that started.
71   int64 num_calls_started = 2;
72
73   // The total number of RPCs that finished.
74   int64 num_calls_finished = 3;
75
76   // The total number of RPCs that were dropped by the client because of rate
77   // limiting.
78   int64 num_calls_finished_with_drop_for_rate_limiting = 4;
79
80   // The total number of RPCs that were dropped by the client because of load
81   // balancing.
82   int64 num_calls_finished_with_drop_for_load_balancing = 5;
83
84   // The total number of RPCs that failed to reach a server except dropped RPCs.
85   int64 num_calls_finished_with_client_failed_to_send = 6;
86
87   // The total number of RPCs that finished and are known to have been received
88   // by a server.
89   int64 num_calls_finished_known_received = 7;
90 }
91
92 message LoadBalanceResponse {
93   oneof load_balance_response_type {
94     // This message should be sent on the first response to the client.
95     InitialLoadBalanceResponse initial_response = 1;
96
97     // Contains the list of servers selected by the load balancer. The client
98     // should send requests to these servers in the specified order.
99     ServerList server_list = 2;
100   }
101 }
102
103 message InitialLoadBalanceResponse {
104   // This is an application layer redirect that indicates the client should use
105   // the specified server for load balancing. When this field is non-empty in
106   // the response, the client should open a separate connection to the
107   // load_balancer_delegate and call the BalanceLoad method. Its length should
108   // be less than 64 bytes.
109   string load_balancer_delegate = 1;
110
111   // This interval defines how often the client should send the client stats
112   // to the load balancer. Stats should only be reported when the duration is
113   // positive.
114   Duration client_stats_report_interval = 2;
115 }
116
117 message ServerList {
118   // Contains a list of servers selected by the load balancer. The list will
119   // be updated when server resolutions change or as needed to balance load
120   // across more servers. The client should consume the server list in order
121   // unless instructed otherwise via the client_config.
122   repeated Server servers = 1;
123
124   // Was google.protobuf.Duration expiration_interval.
125   reserved 3;
126 }
127
128 // Contains server information. When none of the [drop_for_*] fields are true,
129 // use the other fields. When drop_for_rate_limiting is true, ignore all other
130 // fields. Use drop_for_load_balancing only when it is true and
131 // drop_for_rate_limiting is false.
132 message Server {
133   // A resolved address for the server, serialized in network-byte-order. It may
134   // either be an IPv4 or IPv6 address.
135   bytes ip_address = 1;
136
137   // A resolved port number for the server.
138   int32 port = 2;
139
140   // An opaque but printable token given to the frontend for each pick. All
141   // frontend requests for that pick must include the token in its initial
142   // metadata. The token is used by the backend to verify the request and to
143   // allow the backend to report load to the gRPC LB system.
144   //
145   // Its length is variable but less than 50 bytes.
146   string load_balance_token = 3;
147
148   // Indicates whether this particular request should be dropped by the client
149   // for rate limiting.
150   bool drop_for_rate_limiting = 4;
151
152   // Indicates whether this particular request should be dropped by the client
153   // for load balancing.
154   bool drop_for_load_balancing = 5;
155 }