protoc 1.0.0 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,104 +0,0 @@
1
- // Protocol Buffers - Google's data interchange format
2
- // Copyright 2008 Google Inc. All rights reserved.
3
- // https://developers.google.com/protocol-buffers/
4
- //
5
- // Redistribution and use in source and binary forms, with or without
6
- // modification, are permitted provided that the following conditions are
7
- // met:
8
- //
9
- // * Redistributions of source code must retain the above copyright
10
- // notice, this list of conditions and the following disclaimer.
11
- // * Redistributions in binary form must reproduce the above
12
- // copyright notice, this list of conditions and the following disclaimer
13
- // in the documentation and/or other materials provided with the
14
- // distribution.
15
- // * Neither the name of Google Inc. nor the names of its
16
- // contributors may be used to endorse or promote products derived from
17
- // this software without specific prior written permission.
18
- //
19
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
- // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
- // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
- // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
- // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
- // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
- // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
- // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
- // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
- // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
-
31
- syntax = "proto3";
32
-
33
- package google.protobuf;
34
-
35
- option csharp_namespace = "Google.Protobuf.WellKnownTypes";
36
- option cc_enable_arenas = true;
37
- option go_package = "github.com/golang/protobuf/ptypes/duration";
38
- option java_package = "com.google.protobuf";
39
- option java_outer_classname = "DurationProto";
40
- option java_multiple_files = true;
41
- option objc_class_prefix = "GPB";
42
-
43
- // A Duration represents a signed, fixed-length span of time represented
44
- // as a count of seconds and fractions of seconds at nanosecond
45
- // resolution. It is independent of any calendar and concepts like "day"
46
- // or "month". It is related to Timestamp in that the difference between
47
- // two Timestamp values is a Duration and it can be added or subtracted
48
- // from a Timestamp. Range is approximately +-10,000 years.
49
- //
50
- // Example 1: Compute Duration from two Timestamps in pseudo code.
51
- //
52
- // Timestamp start = ...;
53
- // Timestamp end = ...;
54
- // Duration duration = ...;
55
- //
56
- // duration.seconds = end.seconds - start.seconds;
57
- // duration.nanos = end.nanos - start.nanos;
58
- //
59
- // if (duration.seconds < 0 && duration.nanos > 0) {
60
- // duration.seconds += 1;
61
- // duration.nanos -= 1000000000;
62
- // } else if (durations.seconds > 0 && duration.nanos < 0) {
63
- // duration.seconds -= 1;
64
- // duration.nanos += 1000000000;
65
- // }
66
- //
67
- // Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
68
- //
69
- // Timestamp start = ...;
70
- // Duration duration = ...;
71
- // Timestamp end = ...;
72
- //
73
- // end.seconds = start.seconds + duration.seconds;
74
- // end.nanos = start.nanos + duration.nanos;
75
- //
76
- // if (end.nanos < 0) {
77
- // end.seconds -= 1;
78
- // end.nanos += 1000000000;
79
- // } else if (end.nanos >= 1000000000) {
80
- // end.seconds += 1;
81
- // end.nanos -= 1000000000;
82
- // }
83
- //
84
- // Example 3: Compute Duration from datetime.timedelta in Python.
85
- //
86
- // td = datetime.timedelta(days=3, minutes=10)
87
- // duration = Duration()
88
- // duration.FromTimedelta(td)
89
- //
90
- //
91
- message Duration {
92
-
93
- // Signed seconds of the span of time. Must be from -315,576,000,000
94
- // to +315,576,000,000 inclusive.
95
- int64 seconds = 1;
96
-
97
- // Signed fractions of a second at nanosecond resolution of the span
98
- // of time. Durations less than one second are represented with a 0
99
- // `seconds` field and a positive or negative `nanos` field. For durations
100
- // of one second or more, a non-zero value for the `nanos` field must be
101
- // of the same sign as the `seconds` field. Must be from -999,999,999
102
- // to +999,999,999 inclusive.
103
- int32 nanos = 2;
104
- }
@@ -1,52 +0,0 @@
1
- // Protocol Buffers - Google's data interchange format
2
- // Copyright 2008 Google Inc. All rights reserved.
3
- // https://developers.google.com/protocol-buffers/
4
- //
5
- // Redistribution and use in source and binary forms, with or without
6
- // modification, are permitted provided that the following conditions are
7
- // met:
8
- //
9
- // * Redistributions of source code must retain the above copyright
10
- // notice, this list of conditions and the following disclaimer.
11
- // * Redistributions in binary form must reproduce the above
12
- // copyright notice, this list of conditions and the following disclaimer
13
- // in the documentation and/or other materials provided with the
14
- // distribution.
15
- // * Neither the name of Google Inc. nor the names of its
16
- // contributors may be used to endorse or promote products derived from
17
- // this software without specific prior written permission.
18
- //
19
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
- // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
- // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
- // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
- // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
- // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
- // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
- // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
- // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
- // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
-
31
- syntax = "proto3";
32
-
33
- package google.protobuf;
34
-
35
- option csharp_namespace = "Google.Protobuf.WellKnownTypes";
36
- option go_package = "github.com/golang/protobuf/ptypes/empty";
37
- option java_package = "com.google.protobuf";
38
- option java_outer_classname = "EmptyProto";
39
- option java_multiple_files = true;
40
- option objc_class_prefix = "GPB";
41
- option cc_enable_arenas = true;
42
-
43
- // A generic empty message that you can re-use to avoid defining duplicated
44
- // empty messages in your APIs. A typical example is to use it as the request
45
- // or the response type of an API method. For instance:
46
- //
47
- // service Foo {
48
- // rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
49
- // }
50
- //
51
- // The JSON representation for `Empty` is empty JSON object `{}`.
52
- message Empty {}
@@ -1,246 +0,0 @@
1
- // Protocol Buffers - Google's data interchange format
2
- // Copyright 2008 Google Inc. All rights reserved.
3
- // https://developers.google.com/protocol-buffers/
4
- //
5
- // Redistribution and use in source and binary forms, with or without
6
- // modification, are permitted provided that the following conditions are
7
- // met:
8
- //
9
- // * Redistributions of source code must retain the above copyright
10
- // notice, this list of conditions and the following disclaimer.
11
- // * Redistributions in binary form must reproduce the above
12
- // copyright notice, this list of conditions and the following disclaimer
13
- // in the documentation and/or other materials provided with the
14
- // distribution.
15
- // * Neither the name of Google Inc. nor the names of its
16
- // contributors may be used to endorse or promote products derived from
17
- // this software without specific prior written permission.
18
- //
19
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
- // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
- // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
- // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
- // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
- // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
- // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
- // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
- // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
- // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
-
31
- syntax = "proto3";
32
-
33
- package google.protobuf;
34
-
35
- option csharp_namespace = "Google.Protobuf.WellKnownTypes";
36
- option java_package = "com.google.protobuf";
37
- option java_outer_classname = "FieldMaskProto";
38
- option java_multiple_files = true;
39
- option objc_class_prefix = "GPB";
40
- option go_package = "google.golang.org/genproto/protobuf/field_mask;field_mask";
41
-
42
- // `FieldMask` represents a set of symbolic field paths, for example:
43
- //
44
- // paths: "f.a"
45
- // paths: "f.b.d"
46
- //
47
- // Here `f` represents a field in some root message, `a` and `b`
48
- // fields in the message found in `f`, and `d` a field found in the
49
- // message in `f.b`.
50
- //
51
- // Field masks are used to specify a subset of fields that should be
52
- // returned by a get operation or modified by an update operation.
53
- // Field masks also have a custom JSON encoding (see below).
54
- //
55
- // # Field Masks in Projections
56
- //
57
- // When used in the context of a projection, a response message or
58
- // sub-message is filtered by the API to only contain those fields as
59
- // specified in the mask. For example, if the mask in the previous
60
- // example is applied to a response message as follows:
61
- //
62
- // f {
63
- // a : 22
64
- // b {
65
- // d : 1
66
- // x : 2
67
- // }
68
- // y : 13
69
- // }
70
- // z: 8
71
- //
72
- // The result will not contain specific values for fields x,y and z
73
- // (their value will be set to the default, and omitted in proto text
74
- // output):
75
- //
76
- //
77
- // f {
78
- // a : 22
79
- // b {
80
- // d : 1
81
- // }
82
- // }
83
- //
84
- // A repeated field is not allowed except at the last position of a
85
- // paths string.
86
- //
87
- // If a FieldMask object is not present in a get operation, the
88
- // operation applies to all fields (as if a FieldMask of all fields
89
- // had been specified).
90
- //
91
- // Note that a field mask does not necessarily apply to the
92
- // top-level response message. In case of a REST get operation, the
93
- // field mask applies directly to the response, but in case of a REST
94
- // list operation, the mask instead applies to each individual message
95
- // in the returned resource list. In case of a REST custom method,
96
- // other definitions may be used. Where the mask applies will be
97
- // clearly documented together with its declaration in the API. In
98
- // any case, the effect on the returned resource/resources is required
99
- // behavior for APIs.
100
- //
101
- // # Field Masks in Update Operations
102
- //
103
- // A field mask in update operations specifies which fields of the
104
- // targeted resource are going to be updated. The API is required
105
- // to only change the values of the fields as specified in the mask
106
- // and leave the others untouched. If a resource is passed in to
107
- // describe the updated values, the API ignores the values of all
108
- // fields not covered by the mask.
109
- //
110
- // If a repeated field is specified for an update operation, the existing
111
- // repeated values in the target resource will be overwritten by the new values.
112
- // Note that a repeated field is only allowed in the last position of a `paths`
113
- // string.
114
- //
115
- // If a sub-message is specified in the last position of the field mask for an
116
- // update operation, then the existing sub-message in the target resource is
117
- // overwritten. Given the target message:
118
- //
119
- // f {
120
- // b {
121
- // d : 1
122
- // x : 2
123
- // }
124
- // c : 1
125
- // }
126
- //
127
- // And an update message:
128
- //
129
- // f {
130
- // b {
131
- // d : 10
132
- // }
133
- // }
134
- //
135
- // then if the field mask is:
136
- //
137
- // paths: "f.b"
138
- //
139
- // then the result will be:
140
- //
141
- // f {
142
- // b {
143
- // d : 10
144
- // }
145
- // c : 1
146
- // }
147
- //
148
- // However, if the update mask was:
149
- //
150
- // paths: "f.b.d"
151
- //
152
- // then the result would be:
153
- //
154
- // f {
155
- // b {
156
- // d : 10
157
- // x : 2
158
- // }
159
- // c : 1
160
- // }
161
- //
162
- // In order to reset a field's value to the default, the field must
163
- // be in the mask and set to the default value in the provided resource.
164
- // Hence, in order to reset all fields of a resource, provide a default
165
- // instance of the resource and set all fields in the mask, or do
166
- // not provide a mask as described below.
167
- //
168
- // If a field mask is not present on update, the operation applies to
169
- // all fields (as if a field mask of all fields has been specified).
170
- // Note that in the presence of schema evolution, this may mean that
171
- // fields the client does not know and has therefore not filled into
172
- // the request will be reset to their default. If this is unwanted
173
- // behavior, a specific service may require a client to always specify
174
- // a field mask, producing an error if not.
175
- //
176
- // As with get operations, the location of the resource which
177
- // describes the updated values in the request message depends on the
178
- // operation kind. In any case, the effect of the field mask is
179
- // required to be honored by the API.
180
- //
181
- // ## Considerations for HTTP REST
182
- //
183
- // The HTTP kind of an update operation which uses a field mask must
184
- // be set to PATCH instead of PUT in order to satisfy HTTP semantics
185
- // (PUT must only be used for full updates).
186
- //
187
- // # JSON Encoding of Field Masks
188
- //
189
- // In JSON, a field mask is encoded as a single string where paths are
190
- // separated by a comma. Fields name in each path are converted
191
- // to/from lower-camel naming conventions.
192
- //
193
- // As an example, consider the following message declarations:
194
- //
195
- // message Profile {
196
- // User user = 1;
197
- // Photo photo = 2;
198
- // }
199
- // message User {
200
- // string display_name = 1;
201
- // string address = 2;
202
- // }
203
- //
204
- // In proto a field mask for `Profile` may look as such:
205
- //
206
- // mask {
207
- // paths: "user.display_name"
208
- // paths: "photo"
209
- // }
210
- //
211
- // In JSON, the same mask is represented as below:
212
- //
213
- // {
214
- // mask: "user.displayName,photo"
215
- // }
216
- //
217
- // # Field Masks and Oneof Fields
218
- //
219
- // Field masks treat fields in oneofs just as regular fields. Consider the
220
- // following message:
221
- //
222
- // message SampleMessage {
223
- // oneof test_oneof {
224
- // string name = 4;
225
- // SubMessage sub_message = 9;
226
- // }
227
- // }
228
- //
229
- // The field mask can be:
230
- //
231
- // mask {
232
- // paths: "name"
233
- // }
234
- //
235
- // Or:
236
- //
237
- // mask {
238
- // paths: "sub_message"
239
- // }
240
- //
241
- // Note that oneof type names ("test_oneof" in this case) cannot be used in
242
- // paths.
243
- message FieldMask {
244
- // The set of field mask paths.
245
- repeated string paths = 1;
246
- }
@@ -1,48 +0,0 @@
1
- // Protocol Buffers - Google's data interchange format
2
- // Copyright 2008 Google Inc. All rights reserved.
3
- // https://developers.google.com/protocol-buffers/
4
- //
5
- // Redistribution and use in source and binary forms, with or without
6
- // modification, are permitted provided that the following conditions are
7
- // met:
8
- //
9
- // * Redistributions of source code must retain the above copyright
10
- // notice, this list of conditions and the following disclaimer.
11
- // * Redistributions in binary form must reproduce the above
12
- // copyright notice, this list of conditions and the following disclaimer
13
- // in the documentation and/or other materials provided with the
14
- // distribution.
15
- // * Neither the name of Google Inc. nor the names of its
16
- // contributors may be used to endorse or promote products derived from
17
- // this software without specific prior written permission.
18
- //
19
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
- // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
- // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
- // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
- // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
- // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
- // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
- // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
- // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
- // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
-
31
- syntax = "proto3";
32
-
33
- package google.protobuf;
34
-
35
- option csharp_namespace = "Google.Protobuf.WellKnownTypes";
36
- option java_package = "com.google.protobuf";
37
- option java_outer_classname = "SourceContextProto";
38
- option java_multiple_files = true;
39
- option objc_class_prefix = "GPB";
40
- option go_package = "google.golang.org/genproto/protobuf/source_context;source_context";
41
-
42
- // `SourceContext` represents information about the source of a
43
- // protobuf element, like the file in which it is defined.
44
- message SourceContext {
45
- // The path-qualified name of the .proto file that contained the associated
46
- // protobuf element. For example: `"google/protobuf/source_context.proto"`.
47
- string file_name = 1;
48
- }
@@ -1,96 +0,0 @@
1
- // Protocol Buffers - Google's data interchange format
2
- // Copyright 2008 Google Inc. All rights reserved.
3
- // https://developers.google.com/protocol-buffers/
4
- //
5
- // Redistribution and use in source and binary forms, with or without
6
- // modification, are permitted provided that the following conditions are
7
- // met:
8
- //
9
- // * Redistributions of source code must retain the above copyright
10
- // notice, this list of conditions and the following disclaimer.
11
- // * Redistributions in binary form must reproduce the above
12
- // copyright notice, this list of conditions and the following disclaimer
13
- // in the documentation and/or other materials provided with the
14
- // distribution.
15
- // * Neither the name of Google Inc. nor the names of its
16
- // contributors may be used to endorse or promote products derived from
17
- // this software without specific prior written permission.
18
- //
19
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
- // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
- // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
- // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
- // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
- // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
- // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
- // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
- // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
- // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
-
31
- syntax = "proto3";
32
-
33
- package google.protobuf;
34
-
35
- option csharp_namespace = "Google.Protobuf.WellKnownTypes";
36
- option cc_enable_arenas = true;
37
- option go_package = "github.com/golang/protobuf/ptypes/struct;structpb";
38
- option java_package = "com.google.protobuf";
39
- option java_outer_classname = "StructProto";
40
- option java_multiple_files = true;
41
- option objc_class_prefix = "GPB";
42
-
43
-
44
- // `Struct` represents a structured data value, consisting of fields
45
- // which map to dynamically typed values. In some languages, `Struct`
46
- // might be supported by a native representation. For example, in
47
- // scripting languages like JS a struct is represented as an
48
- // object. The details of that representation are described together
49
- // with the proto support for the language.
50
- //
51
- // The JSON representation for `Struct` is JSON object.
52
- message Struct {
53
- // Unordered map of dynamically typed values.
54
- map<string, Value> fields = 1;
55
- }
56
-
57
- // `Value` represents a dynamically typed value which can be either
58
- // null, a number, a string, a boolean, a recursive struct value, or a
59
- // list of values. A producer of value is expected to set one of that
60
- // variants, absence of any variant indicates an error.
61
- //
62
- // The JSON representation for `Value` is JSON value.
63
- message Value {
64
- // The kind of value.
65
- oneof kind {
66
- // Represents a null value.
67
- NullValue null_value = 1;
68
- // Represents a double value.
69
- double number_value = 2;
70
- // Represents a string value.
71
- string string_value = 3;
72
- // Represents a boolean value.
73
- bool bool_value = 4;
74
- // Represents a structured value.
75
- Struct struct_value = 5;
76
- // Represents a repeated `Value`.
77
- ListValue list_value = 6;
78
- }
79
- }
80
-
81
- // `NullValue` is a singleton enumeration to represent the null value for the
82
- // `Value` type union.
83
- //
84
- // The JSON representation for `NullValue` is JSON `null`.
85
- enum NullValue {
86
- // Null value.
87
- NULL_VALUE = 0;
88
- }
89
-
90
- // `ListValue` is a wrapper around a repeated field of values.
91
- //
92
- // The JSON representation for `ListValue` is JSON array.
93
- message ListValue {
94
- // Repeated field of dynamically typed values.
95
- repeated Value values = 1;
96
- }
@@ -1,108 +0,0 @@
1
- // Protocol Buffers - Google's data interchange format
2
- // Copyright 2008 Google Inc. All rights reserved.
3
- // https://developers.google.com/protocol-buffers/
4
- //
5
- // Redistribution and use in source and binary forms, with or without
6
- // modification, are permitted provided that the following conditions are
7
- // met:
8
- //
9
- // * Redistributions of source code must retain the above copyright
10
- // notice, this list of conditions and the following disclaimer.
11
- // * Redistributions in binary form must reproduce the above
12
- // copyright notice, this list of conditions and the following disclaimer
13
- // in the documentation and/or other materials provided with the
14
- // distribution.
15
- // * Neither the name of Google Inc. nor the names of its
16
- // contributors may be used to endorse or promote products derived from
17
- // this software without specific prior written permission.
18
- //
19
- // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
- // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
- // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
- // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23
- // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
- // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
- // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
- // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
- // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
- // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
- // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
-
31
- syntax = "proto3";
32
-
33
- package google.protobuf;
34
-
35
- option csharp_namespace = "Google.Protobuf.WellKnownTypes";
36
- option cc_enable_arenas = true;
37
- option go_package = "github.com/golang/protobuf/ptypes/timestamp";
38
- option java_package = "com.google.protobuf";
39
- option java_outer_classname = "TimestampProto";
40
- option java_multiple_files = true;
41
- option objc_class_prefix = "GPB";
42
-
43
- // A Timestamp represents a point in time independent of any time zone
44
- // or calendar, represented as seconds and fractions of seconds at
45
- // nanosecond resolution in UTC Epoch time. It is encoded using the
46
- // Proleptic Gregorian Calendar which extends the Gregorian calendar
47
- // backwards to year one. It is encoded assuming all minutes are 60
48
- // seconds long, i.e. leap seconds are "smeared" so that no leap second
49
- // table is needed for interpretation. Range is from
50
- // 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
51
- // By restricting to that range, we ensure that we can convert to
52
- // and from RFC 3339 date strings.
53
- // See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).
54
- //
55
- // Example 1: Compute Timestamp from POSIX `time()`.
56
- //
57
- // Timestamp timestamp;
58
- // timestamp.set_seconds(time(NULL));
59
- // timestamp.set_nanos(0);
60
- //
61
- // Example 2: Compute Timestamp from POSIX `gettimeofday()`.
62
- //
63
- // struct timeval tv;
64
- // gettimeofday(&tv, NULL);
65
- //
66
- // Timestamp timestamp;
67
- // timestamp.set_seconds(tv.tv_sec);
68
- // timestamp.set_nanos(tv.tv_usec * 1000);
69
- //
70
- // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
71
- //
72
- // FILETIME ft;
73
- // GetSystemTimeAsFileTime(&ft);
74
- // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
75
- //
76
- // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
77
- // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
78
- // Timestamp timestamp;
79
- // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
80
- // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
81
- //
82
- // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
83
- //
84
- // long millis = System.currentTimeMillis();
85
- //
86
- // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
87
- // .setNanos((int) ((millis % 1000) * 1000000)).build();
88
- //
89
- //
90
- // Example 5: Compute Timestamp from current time in Python.
91
- //
92
- // timestamp = Timestamp()
93
- // timestamp.GetCurrentTime()
94
- //
95
- //
96
- message Timestamp {
97
-
98
- // Represents seconds of UTC time since Unix epoch
99
- // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
100
- // 9999-12-31T23:59:59Z inclusive.
101
- int64 seconds = 1;
102
-
103
- // Non-negative fractions of a second at nanosecond resolution. Negative
104
- // second values with fractions must still have non-negative nanos values
105
- // that count forward in time. Must be from 0 to 999,999,999
106
- // inclusive.
107
- int32 nanos = 2;
108
- }