1// Copyright 2020 The 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// Local copy of Envoy xDS proto file, used for testing only.
16
17syntax = "proto3";
18
19package envoy.type.v3;
20
21// A fractional percentage is used in cases in which for performance reasons performing floating
22// point to integer conversions during randomness calculations is undesirable. The message includes
23// both a numerator and denominator that together determine the final fractional value.
24//
25// * **Example**: 1/100 = 1%.
26// * **Example**: 3/10000 = 0.03%.
27message FractionalPercent {
28  // Fraction percentages support several fixed denominator values.
29  enum DenominatorType {
30    // 100.
31    //
32    // **Example**: 1/100 = 1%.
33    HUNDRED = 0;
34
35    // 10,000.
36    //
37    // **Example**: 1/10000 = 0.01%.
38    TEN_THOUSAND = 1;
39
40    // 1,000,000.
41    //
42    // **Example**: 1/1000000 = 0.0001%.
43    MILLION = 2;
44  }
45
46  // Specifies the numerator. Defaults to 0.
47  uint32 numerator = 1;
48
49  // Specifies the denominator. If the denominator specified is less than the numerator, the final
50  // fractional percentage is capped at 1 (100%).
51  DenominatorType denominator = 2;
52}
53