forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
percent.proto
51 lines (41 loc) · 1.48 KB
/
percent.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
syntax = "proto3";
package envoy.type;
import "udpa/annotations/status.proto";
import "validate/validate.proto";
option java_package = "io.envoyproxy.envoy.type";
option java_outer_classname = "PercentProto";
option java_multiple_files = true;
option (udpa.annotations.file_status).package_version_status = FROZEN;
// [#protodoc-title: Percent]
// Identifies a percentage, in the range [0.0, 100.0].
message Percent {
double value = 1 [(validate.rules).double = {lte: 100.0 gte: 0.0}];
}
// A fractional percentage is used in cases in which for performance reasons performing floating
// point to integer conversions during randomness calculations is undesirable. The message includes
// both a numerator and denominator that together determine the final fractional value.
//
// * **Example**: 1/100 = 1%.
// * **Example**: 3/10000 = 0.03%.
message FractionalPercent {
// Fraction percentages support several fixed denominator values.
enum DenominatorType {
// 100.
//
// **Example**: 1/100 = 1%.
HUNDRED = 0;
// 10,000.
//
// **Example**: 1/10000 = 0.01%.
TEN_THOUSAND = 1;
// 1,000,000.
//
// **Example**: 1/1000000 = 0.0001%.
MILLION = 2;
}
// Specifies the numerator. Defaults to 0.
uint32 numerator = 1;
// Specifies the denominator. If the denominator specified is less than the numerator, the final
// fractional percentage is capped at 1 (100%).
DenominatorType denominator = 2 [(validate.rules).enum = {defined_only: true}];
}