blob: acc9044452287d41e9c1ac3a978d0b12dfb6e32a [file] [log] [blame]
sslobodrd046be82019-01-16 10:02:22 -05001/*
2Copyright The Kubernetes Authors.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17
18// This file was autogenerated by go-to-protobuf. Do not edit it manually!
19
20syntax = 'proto2';
21
22package k8s.io.apimachinery.pkg.api.resource;
23
24// Package-wide variables from generator "generated".
25option go_package = "resource";
26
27// Quantity is a fixed-point representation of a number.
28// It provides convenient marshaling/unmarshaling in JSON and YAML,
29// in addition to String() and Int64() accessors.
30//
31// The serialization format is:
32//
33// <quantity> ::= <signedNumber><suffix>
34// (Note that <suffix> may be empty, from the "" case in <decimalSI>.)
35// <digit> ::= 0 | 1 | ... | 9
36// <digits> ::= <digit> | <digit><digits>
37// <number> ::= <digits> | <digits>.<digits> | <digits>. | .<digits>
38// <sign> ::= "+" | "-"
39// <signedNumber> ::= <number> | <sign><number>
40// <suffix> ::= <binarySI> | <decimalExponent> | <decimalSI>
41// <binarySI> ::= Ki | Mi | Gi | Ti | Pi | Ei
42// (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html)
43// <decimalSI> ::= m | "" | k | M | G | T | P | E
44// (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.)
45// <decimalExponent> ::= "e" <signedNumber> | "E" <signedNumber>
46//
47// No matter which of the three exponent forms is used, no quantity may represent
48// a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal
49// places. Numbers larger or more precise will be capped or rounded up.
50// (E.g.: 0.1m will rounded up to 1m.)
51// This may be extended in the future if we require larger or smaller quantities.
52//
53// When a Quantity is parsed from a string, it will remember the type of suffix
54// it had, and will use the same type again when it is serialized.
55//
56// Before serializing, Quantity will be put in "canonical form".
57// This means that Exponent/suffix will be adjusted up or down (with a
58// corresponding increase or decrease in Mantissa) such that:
59// a. No precision is lost
60// b. No fractional digits will be emitted
61// c. The exponent (or suffix) is as large as possible.
62// The sign will be omitted unless the number is negative.
63//
64// Examples:
65// 1.5 will be serialized as "1500m"
66// 1.5Gi will be serialized as "1536Mi"
67//
68// Note that the quantity will NEVER be internally represented by a
69// floating point number. That is the whole point of this exercise.
70//
71// Non-canonical values will still parse as long as they are well formed,
72// but will be re-emitted in their canonical form. (So always use canonical
73// form, or don't diff.)
74//
75// This format is intended to make it difficult to use these numbers without
76// writing some sort of special handling code in the hopes that that will
77// cause implementors to also use a fixed point implementation.
78//
79// +protobuf=true
80// +protobuf.embed=string
81// +protobuf.options.marshal=false
82// +protobuf.options.(gogoproto.goproto_stringer)=false
83// +k8s:deepcopy-gen=true
84// +k8s:openapi-gen=true
85message Quantity {
86 optional string string = 1;
87}
88