├── .gitignore
├── LICENSE
├── OLD-README.md
├── README.md
├── friends
├── README.md
├── deploy
│ └── friends.yaml
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── io
│ │ └── cloudstate
│ │ └── samples
│ │ └── friends
│ │ ├── FriendsEntity.java
│ │ └── Main.java
│ ├── proto
│ ├── cloudstate
│ │ ├── entity_key.proto
│ │ └── eventing.proto
│ ├── friends.proto
│ └── google
│ │ ├── api
│ │ ├── annotations.proto
│ │ ├── http.proto
│ │ └── httpbody.proto
│ │ └── protobuf
│ │ ├── any.proto
│ │ ├── api.proto
│ │ ├── compiler
│ │ └── plugin.proto
│ │ ├── descriptor.proto
│ │ ├── duration.proto
│ │ ├── empty.proto
│ │ ├── field_mask.proto
│ │ ├── source_context.proto
│ │ ├── struct.proto
│ │ ├── timestamp.proto
│ │ ├── type.proto
│ │ └── wrappers.proto
│ └── resources
│ ├── application.conf
│ ├── log4j2.xml
│ └── simplelogger.properties
└── presence
├── Dockerfile
├── README.md
├── deploy
└── presence.yaml
├── pom.xml
└── src
└── main
├── java
└── io
│ └── cloudstate
│ └── samples
│ └── presence
│ ├── Main.java
│ └── PresenceEntity.java
├── proto
├── cloudstate
│ ├── entity_key.proto
│ └── eventing.proto
├── google
│ ├── api
│ │ ├── annotations.proto
│ │ ├── http.proto
│ │ └── httpbody.proto
│ └── protobuf
│ │ ├── any.proto
│ │ ├── api.proto
│ │ ├── compiler
│ │ └── plugin.proto
│ │ ├── descriptor.proto
│ │ ├── duration.proto
│ │ ├── empty.proto
│ │ ├── field_mask.proto
│ │ ├── source_context.proto
│ │ ├── struct.proto
│ │ ├── timestamp.proto
│ │ ├── type.proto
│ │ └── wrappers.proto
└── presence.proto
└── resources
├── application.conf
├── log4j2.xml
└── simplelogger.properties
/.gitignore:
--------------------------------------------------------------------------------
1 | target
2 | dependency-reduced-pom.xml
3 | .classpath
4 | .factorypath
5 | .project
6 | .settings/
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/OLD-README.md:
--------------------------------------------------------------------------------
1 | # CloudState Chat sample - Java services
2 |
3 | This is part of the Cloudstate chat sample, which uses CloudState to build the friends management and (online) presence tracking features of a chat system.
4 |
5 | These are the only two features, but in future we will add chat room support, push notifications for chat messages, etc.
6 |
7 | The application has three components, a presence stateful function, which uses a vote CRDT to store whether a user is currently online or not, a friends service which uses an ORSet CRDT and a gateway that serves a UI. The gateway is written in Node/express, and is shared with the js-chat sample application, source code can be found at http://github.com/cloudstateio/samples-js-chat.
8 |
9 | The UI is designed to allow connecting as multiple users in one browser window, this is for demonstration purposes, to make it straight forward to see real time interactions, online presence, friends, serverside pushes etc, without needing to open many browser tabs.
10 |
11 | ## Building and running
12 |
13 | In this repository you will find the presence and friends services implemented using Cloudstate Java support. To build the whole application please see the sample-js-chat repository above.
14 |
15 | To build the two services please see the README in the friends and presence directories respectively.
16 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Cloudstate was an open source protocol and reference implementation exploring ideas for _stateful serverless_, and was originally developed by [Lightbend].
2 |
3 | The project is no longer active, since 2021. An open source alternative is [Eigr].
4 |
5 | A continuation of the ideas can be found in Lightbend's platform-as-a-service [Akka Serverless].
6 |
7 | [Lightbend]: https://www.lightbend.com
8 | [Eigr]: https://eigr.io
9 | [Akka Serverless]: https://www.lightbend.com/akka-serverless
10 |
--------------------------------------------------------------------------------
/friends/README.md:
--------------------------------------------------------------------------------
1 | # Cloudstate samples
2 |
3 | ## Friends service - Java implementation
4 |
5 | This is an implementation of the friends service, which is part of Cloudstate Chat sample.
6 |
7 | The user code is written in Java and uses a 100% Java toolchain (no Scala tools needed).
8 |
9 | ### Preparing to build
10 |
11 | Install Maven
12 |
13 | http://maven.apache.org/download.cgi
14 |
15 | ### Build the package and Docker image
16 |
17 | ```
18 | mvn package
19 | mvn io.fabric8:docker-maven-plugin:0.26.1:build
20 | ```
21 |
22 | ### Push the image
23 |
24 | ```
25 | mvn io.fabric8:docker-maven-plugin:0.26.1:push
26 | ```
27 |
28 | ### Basic Testing
29 |
30 | One way to test your service is to run it in a Docker container, and have it connect to the Cloudstate side-car (also known as Cloudstate proxy). The following steps will allow you test the friends service.
31 |
32 | In a terminal run the Cloudstate side-car:
33 |
34 | `docker run -it --rm --network mynetwork --name cloudstate -p 9000:9000 cloudstateio/cloudstate-proxy-dev-mode -Dcloudstate.proxy.user-function-port=8080 -Dcloudstate.proxy.user-function-interface=java-friends`
35 |
36 | Open a second terminal to run the friends user function container (built as above).
37 |
38 | `docker run -it --rm --name java-friends --network mynetwork justinhj/java-friends`
39 |
--------------------------------------------------------------------------------
/friends/deploy/friends.yaml:
--------------------------------------------------------------------------------
1 | # Stateful service descriptor for the friends app
2 | apiVersion: cloudstate.io/v1alpha1
3 | kind: StatefulService
4 | metadata:
5 | name: friends
6 | spec:
7 | containers:
8 | - image: cloudstateio/java-friends:latest
9 | name: friends
10 |
--------------------------------------------------------------------------------
/friends/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 | io.cloudstate
6 | friends
7 | jar
8 | 0.1-SNAPSHOT
9 |
10 |
11 |
12 | bintray-akka-maven
13 | bintray
14 | https://dl.bintray.com/akka/maven
15 |
16 |
17 |
18 |
19 |
20 | bintray-akka-maven
21 | bintray
22 | https://dl.bintray.com/akka/maven
23 |
24 |
25 |
26 |
27 | 1.8
28 | 1.8
29 | 2.6.5
30 | 1.0.0-M1
31 | 2.12
32 | 2.0.10
33 | 1.29.0
34 | UTF-8
35 | cloudstateio/java-friends
36 |
37 |
38 |
39 |
40 |
41 | org.apache.logging.log4j
42 | log4j-api
43 | 2.13.3
44 |
45 |
46 |
47 | org.apache.logging.log4j
48 | log4j-core
49 | 2.13.3
50 |
51 |
52 |
53 | com.google.protobuf
54 | protobuf-java
55 | 3.11.4
56 |
57 |
58 |
59 | com.google.protobuf
60 | protobuf-java-util
61 | 3.11.4
62 |
63 |
64 |
65 | io.cloudstate
66 | cloudstate-java-support
67 | 0.5.1
68 |
69 |
70 |
71 | com.lightbend.akka.grpc
72 | akka-grpc-runtime_${scala.binary.version}
73 | ${akka.grpc.version}
74 |
75 |
76 |
77 | com.typesafe.akka
78 | akka-stream-testkit_${scala.binary.version}
79 | ${akka.version}
80 | test
81 |
82 |
83 |
84 |
85 | io.grpc
86 | grpc-stub
87 | ${grpc.version}
88 |
89 |
90 |
91 | org.mortbay.jetty.alpn
92 | jetty-alpn-agent
93 | ${jetty.alpn.agent.version}
94 | runtime
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 | net.alchim31.maven
103 | scala-maven-plugin
104 | 3.4.1
105 |
106 |
107 |
108 | compile
109 | testCompile
110 |
111 |
112 |
113 |
114 |
115 |
116 | com.lightbend.akka.grpc
117 | akka-grpc-maven-plugin
118 | ${akka.grpc.version}
119 |
120 | Java
121 | false
122 | true
123 |
124 | src/main/proto
125 |
126 |
127 |
128 |
129 |
130 | generate
131 |
132 |
133 |
134 |
135 |
136 |
137 | maven-dependency-plugin
138 | 2.8
139 |
140 |
141 | getClasspathFilenames
142 |
143 |
145 | properties
146 |
147 |
148 |
149 |
150 |
151 |
152 | org.apache.maven.plugins
153 | maven-shade-plugin
154 | 2.1
155 |
156 |
157 | package
158 |
159 | shade
160 |
161 |
162 |
164 |
165 |
166 | reference.conf
167 |
168 |
169 | io.cloudstate.samples.friends.Main
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 | io.fabric8
179 | docker-maven-plugin
180 | 0.26.1
181 |
182 |
183 |
184 |
185 |
186 | build-docker-image
187 | package
188 |
189 | build
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
--------------------------------------------------------------------------------
/friends/src/main/java/io/cloudstate/samples/friends/FriendsEntity.java:
--------------------------------------------------------------------------------
1 | package io.cloudstate.samples.friends;
2 |
3 | import org.apache.logging.log4j.LogManager;
4 | import org.apache.logging.log4j.Logger;
5 | import io.cloudstate.javasupport.crdt.*;
6 | import cloudstate.samples.chat.friends.grpc.*;
7 |
8 | /** Friends service is a CRDT entity that takes care of an OrSet of a users friends. */
9 | @CrdtEntity
10 | public class FriendsEntity {
11 | private static final Logger logger = LogManager.getLogger(FriendsEntity.class);
12 | private final ORSet friends;
13 |
14 | public FriendsEntity(ORSet friends) {
15 | this.friends = friends;
16 | }
17 |
18 | @CommandHandler
19 | public Empty add(FriendRequest req) {
20 | friends.add(req.getFriend());
21 | logger.debug("add friend command: {} added {}/{}", req.getUser(), req.getFriend().getUser(),req.getFriend().getAvatar());
22 | return Empty.getDefaultInstance();
23 | }
24 |
25 | @CommandHandler
26 | public FriendsList getFriends(User user) {
27 | FriendsList.Builder b = FriendsList.newBuilder();
28 | for(Friend f: friends) {
29 | b.addFriends(f);
30 | }
31 | logger.debug("get friends command: ", user.getUser());
32 | return b.build();
33 | }
34 |
35 | @CommandHandler
36 | public Empty remove(FriendRequest req) {
37 | friends.remove(req.getFriend());
38 | logger.debug("remove friend command: {} removed {}/{}", req.getUser(), req.getFriend().getUser(),req.getFriend().getAvatar());
39 | return Empty.getDefaultInstance();
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/friends/src/main/java/io/cloudstate/samples/friends/Main.java:
--------------------------------------------------------------------------------
1 | package io.cloudstate.samples.friends;
2 |
3 | import cloudstate.samples.chat.friends.grpc.*;
4 | import io.cloudstate.javasupport.*;
5 |
6 | public class Main {
7 |
8 | public static void main(String[] args) throws Exception {
9 |
10 | new CloudState()
11 | .registerCrdtEntity(
12 | FriendsEntity.class,
13 | FriendsGrpc.getDescriptor().findServiceByName("Friends"))
14 | .start()
15 | .toCompletableFuture()
16 | .get();
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/friends/src/main/proto/cloudstate/entity_key.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2019 Lightbend Inc.
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 | // Extension for specifying which field in a message is to be considered an
16 | // entity key, for the purposes associating gRPC calls with entities and
17 | // sharding.
18 |
19 | syntax = "proto3";
20 |
21 | import "google/protobuf/descriptor.proto";
22 |
23 | package cloudstate;
24 |
25 | option java_package = "io.cloudstate";
26 | option go_package = "github.com/cloudstateio/go-support/cloudstate/;cloudstate";
27 |
28 | extend google.protobuf.FieldOptions {
29 | bool entity_key = 50002;
30 | }
31 |
--------------------------------------------------------------------------------
/friends/src/main/proto/cloudstate/eventing.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2019 Lightbend Inc.
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 | // Extension for specifying which topics a gRPC endpoint should be connected
16 | // to, in order to facilitate consuming and producing events from a message broker.
17 |
18 | syntax = "proto3";
19 |
20 | import "google/protobuf/descriptor.proto";
21 |
22 | package cloudstate;
23 |
24 | option java_package = "io.cloudstate";
25 | option java_multiple_files = true;
26 | option java_outer_classname = "EventsProto";
27 |
28 | message Eventing {
29 | string in = 1;
30 | string out = 2; // Special value "discard" means do not publish
31 | }
32 |
33 | extend google.protobuf.MethodOptions {
34 | Eventing eventing = 50003;
35 | }
36 |
--------------------------------------------------------------------------------
/friends/src/main/proto/friends.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 |
3 | import "cloudstate/entity_key.proto";
4 |
5 | package cloudstate.samples.chat.friends;
6 |
7 | option java_multiple_files = true;
8 | option java_package = "cloudstate.samples.chat.friends.grpc";
9 | option java_outer_classname = "FriendsGrpc";
10 |
11 | message Friend{
12 | string user = 1;
13 | string avatar = 2;
14 | }
15 |
16 | message FriendRequest {
17 | string user = 1 [(.cloudstate.entity_key) = true];
18 | Friend friend = 2;
19 | }
20 |
21 | message User {
22 | string user = 1 [(.cloudstate.entity_key) = true];
23 | }
24 |
25 | message FriendsList {
26 | repeated Friend friends = 1;
27 | }
28 |
29 | message Empty {
30 | }
31 |
32 | service Friends {
33 | rpc Add(FriendRequest) returns (Empty);
34 | rpc Remove(FriendRequest) returns (Empty);
35 | rpc GetFriends(User) returns (FriendsList);
36 | }
37 |
--------------------------------------------------------------------------------
/friends/src/main/proto/google/api/annotations.proto:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2015, Google Inc.
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 google.api;
18 |
19 | import "google/api/http.proto";
20 | import "google/protobuf/descriptor.proto";
21 |
22 | option csharp_namespace = "Google.Protobuf";
23 | option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
24 | option java_multiple_files = true;
25 | option java_outer_classname = "AnnotationsProto";
26 | option java_package = "com.google.api";
27 | option objc_class_prefix = "GAPI";
28 |
29 | extend google.protobuf.MethodOptions {
30 | // See `HttpRule`.
31 | HttpRule http = 72295728;
32 | }
33 |
--------------------------------------------------------------------------------
/friends/src/main/proto/google/api/http.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2019 Google LLC.
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 |
16 | syntax = "proto3";
17 |
18 | package google.api;
19 |
20 | option csharp_namespace = "Google.Protobuf";
21 | option cc_enable_arenas = true;
22 | option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
23 | option java_multiple_files = true;
24 | option java_outer_classname = "HttpProto";
25 | option java_package = "com.google.api";
26 | option objc_class_prefix = "GAPI";
27 |
28 | // Defines the HTTP configuration for an API service. It contains a list of
29 | // [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method
30 | // to one or more HTTP REST API methods.
31 | message Http {
32 | // A list of HTTP configuration rules that apply to individual API methods.
33 | //
34 | // **NOTE:** All service configuration rules follow "last one wins" order.
35 | repeated HttpRule rules = 1;
36 |
37 | // When set to true, URL path parameters will be fully URI-decoded except in
38 | // cases of single segment matches in reserved expansion, where "%2F" will be
39 | // left encoded.
40 | //
41 | // The default behavior is to not decode RFC 6570 reserved characters in multi
42 | // segment matches.
43 | bool fully_decode_reserved_expansion = 2;
44 | }
45 |
46 | // # gRPC Transcoding
47 | //
48 | // gRPC Transcoding is a feature for mapping between a gRPC method and one or
49 | // more HTTP REST endpoints. It allows developers to build a single API service
50 | // that supports both gRPC APIs and REST APIs. Many systems, including [Google
51 | // APIs](https://github.com/googleapis/googleapis),
52 | // [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC
53 | // Gateway](https://github.com/grpc-ecosystem/grpc-gateway),
54 | // and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature
55 | // and use it for large scale production services.
56 | //
57 | // `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies
58 | // how different portions of the gRPC request message are mapped to the URL
59 | // path, URL query parameters, and HTTP request body. It also controls how the
60 | // gRPC response message is mapped to the HTTP response body. `HttpRule` is
61 | // typically specified as an `google.api.http` annotation on the gRPC method.
62 | //
63 | // Each mapping specifies a URL path template and an HTTP method. The path
64 | // template may refer to one or more fields in the gRPC request message, as long
65 | // as each field is a non-repeated field with a primitive (non-message) type.
66 | // The path template controls how fields of the request message are mapped to
67 | // the URL path.
68 | //
69 | // Example:
70 | //
71 | // service Messaging {
72 | // rpc GetMessage(GetMessageRequest) returns (Message) {
73 | // option (google.api.http) = {
74 | // get: "/v1/{name=messages/*}"
75 | // };
76 | // }
77 | // }
78 | // message GetMessageRequest {
79 | // string name = 1; // Mapped to URL path.
80 | // }
81 | // message Message {
82 | // string text = 1; // The resource content.
83 | // }
84 | //
85 | // This enables an HTTP REST to gRPC mapping as below:
86 | //
87 | // HTTP | gRPC
88 | // -----|-----
89 | // `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")`
90 | //
91 | // Any fields in the request message which are not bound by the path template
92 | // automatically become HTTP query parameters if there is no HTTP request body.
93 | // For example:
94 | //
95 | // service Messaging {
96 | // rpc GetMessage(GetMessageRequest) returns (Message) {
97 | // option (google.api.http) = {
98 | // get:"/v1/messages/{message_id}"
99 | // };
100 | // }
101 | // }
102 | // message GetMessageRequest {
103 | // message SubMessage {
104 | // string subfield = 1;
105 | // }
106 | // string message_id = 1; // Mapped to URL path.
107 | // int64 revision = 2; // Mapped to URL query parameter `revision`.
108 | // SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`.
109 | // }
110 | //
111 | // This enables a HTTP JSON to RPC mapping as below:
112 | //
113 | // HTTP | gRPC
114 | // -----|-----
115 | // `GET /v1/messages/123456?revision=2&sub.subfield=foo` |
116 | // `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield:
117 | // "foo"))`
118 | //
119 | // Note that fields which are mapped to URL query parameters must have a
120 | // primitive type or a repeated primitive type or a non-repeated message type.
121 | // In the case of a repeated type, the parameter can be repeated in the URL
122 | // as `...?param=A¶m=B`. In the case of a message type, each field of the
123 | // message is mapped to a separate parameter, such as
124 | // `...?foo.a=A&foo.b=B&foo.c=C`.
125 | //
126 | // For HTTP methods that allow a request body, the `body` field
127 | // specifies the mapping. Consider a REST update method on the
128 | // message resource collection:
129 | //
130 | // service Messaging {
131 | // rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
132 | // option (google.api.http) = {
133 | // patch: "/v1/messages/{message_id}"
134 | // body: "message"
135 | // };
136 | // }
137 | // }
138 | // message UpdateMessageRequest {
139 | // string message_id = 1; // mapped to the URL
140 | // Message message = 2; // mapped to the body
141 | // }
142 | //
143 | // The following HTTP JSON to RPC mapping is enabled, where the
144 | // representation of the JSON in the request body is determined by
145 | // protos JSON encoding:
146 | //
147 | // HTTP | gRPC
148 | // -----|-----
149 | // `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:
150 | // "123456" message { text: "Hi!" })`
151 | //
152 | // The special name `*` can be used in the body mapping to define that
153 | // every field not bound by the path template should be mapped to the
154 | // request body. This enables the following alternative definition of
155 | // the update method:
156 | //
157 | // service Messaging {
158 | // rpc UpdateMessage(Message) returns (Message) {
159 | // option (google.api.http) = {
160 | // patch: "/v1/messages/{message_id}"
161 | // body: "*"
162 | // };
163 | // }
164 | // }
165 | // message Message {
166 | // string message_id = 1;
167 | // string text = 2;
168 | // }
169 | //
170 | //
171 | // The following HTTP JSON to RPC mapping is enabled:
172 | //
173 | // HTTP | gRPC
174 | // -----|-----
175 | // `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:
176 | // "123456" text: "Hi!")`
177 | //
178 | // Note that when using `*` in the body mapping, it is not possible to
179 | // have HTTP parameters, as all fields not bound by the path end in
180 | // the body. This makes this option more rarely used in practice when
181 | // defining REST APIs. The common usage of `*` is in custom methods
182 | // which don't use the URL at all for transferring data.
183 | //
184 | // It is possible to define multiple HTTP methods for one RPC by using
185 | // the `additional_bindings` option. Example:
186 | //
187 | // service Messaging {
188 | // rpc GetMessage(GetMessageRequest) returns (Message) {
189 | // option (google.api.http) = {
190 | // get: "/v1/messages/{message_id}"
191 | // additional_bindings {
192 | // get: "/v1/users/{user_id}/messages/{message_id}"
193 | // }
194 | // };
195 | // }
196 | // }
197 | // message GetMessageRequest {
198 | // string message_id = 1;
199 | // string user_id = 2;
200 | // }
201 | //
202 | // This enables the following two alternative HTTP JSON to RPC mappings:
203 | //
204 | // HTTP | gRPC
205 | // -----|-----
206 | // `GET /v1/messages/123456` | `GetMessage(message_id: "123456")`
207 | // `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id:
208 | // "123456")`
209 | //
210 | // ## Rules for HTTP mapping
211 | //
212 | // 1. Leaf request fields (recursive expansion nested messages in the request
213 | // message) are classified into three categories:
214 | // - Fields referred by the path template. They are passed via the URL path.
215 | // - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They are passed via the HTTP
216 | // request body.
217 | // - All other fields are passed via the URL query parameters, and the
218 | // parameter name is the field path in the request message. A repeated
219 | // field can be represented as multiple query parameters under the same
220 | // name.
221 | // 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL query parameter, all fields
222 | // are passed via URL path and HTTP request body.
223 | // 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP request body, all
224 | // fields are passed via URL path and URL query parameters.
225 | //
226 | // ### Path template syntax
227 | //
228 | // Template = "/" Segments [ Verb ] ;
229 | // Segments = Segment { "/" Segment } ;
230 | // Segment = "*" | "**" | LITERAL | Variable ;
231 | // Variable = "{" FieldPath [ "=" Segments ] "}" ;
232 | // FieldPath = IDENT { "." IDENT } ;
233 | // Verb = ":" LITERAL ;
234 | //
235 | // The syntax `*` matches a single URL path segment. The syntax `**` matches
236 | // zero or more URL path segments, which must be the last part of the URL path
237 | // except the `Verb`.
238 | //
239 | // The syntax `Variable` matches part of the URL path as specified by its
240 | // template. A variable template must not contain other variables. If a variable
241 | // matches a single path segment, its template may be omitted, e.g. `{var}`
242 | // is equivalent to `{var=*}`.
243 | //
244 | // The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL`
245 | // contains any reserved character, such characters should be percent-encoded
246 | // before the matching.
247 | //
248 | // If a variable contains exactly one path segment, such as `"{var}"` or
249 | // `"{var=*}"`, when such a variable is expanded into a URL path on the client
250 | // side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The
251 | // server side does the reverse decoding. Such variables show up in the
252 | // [Discovery
253 | // Document](https://developers.google.com/discovery/v1/reference/apis) as
254 | // `{var}`.
255 | //
256 | // If a variable contains multiple path segments, such as `"{var=foo/*}"`
257 | // or `"{var=**}"`, when such a variable is expanded into a URL path on the
258 | // client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded.
259 | // The server side does the reverse decoding, except "%2F" and "%2f" are left
260 | // unchanged. Such variables show up in the
261 | // [Discovery
262 | // Document](https://developers.google.com/discovery/v1/reference/apis) as
263 | // `{+var}`.
264 | //
265 | // ## Using gRPC API Service Configuration
266 | //
267 | // gRPC API Service Configuration (service config) is a configuration language
268 | // for configuring a gRPC service to become a user-facing product. The
269 | // service config is simply the YAML representation of the `google.api.Service`
270 | // proto message.
271 | //
272 | // As an alternative to annotating your proto file, you can configure gRPC
273 | // transcoding in your service config YAML files. You do this by specifying a
274 | // `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same
275 | // effect as the proto annotation. This can be particularly useful if you
276 | // have a proto that is reused in multiple services. Note that any transcoding
277 | // specified in the service config will override any matching transcoding
278 | // configuration in the proto.
279 | //
280 | // Example:
281 | //
282 | // http:
283 | // rules:
284 | // # Selects a gRPC method and applies HttpRule to it.
285 | // - selector: example.v1.Messaging.GetMessage
286 | // get: /v1/messages/{message_id}/{sub.subfield}
287 | //
288 | // ## Special notes
289 | //
290 | // When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the
291 | // proto to JSON conversion must follow the [proto3
292 | // specification](https://developers.google.com/protocol-buffers/docs/proto3#json).
293 | //
294 | // While the single segment variable follows the semantics of
295 | // [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String
296 | // Expansion, the multi segment variable **does not** follow RFC 6570 Section
297 | // 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion
298 | // does not expand special characters like `?` and `#`, which would lead
299 | // to invalid URLs. As the result, gRPC Transcoding uses a custom encoding
300 | // for multi segment variables.
301 | //
302 | // The path variables **must not** refer to any repeated or mapped field,
303 | // because client libraries are not capable of handling such variable expansion.
304 | //
305 | // The path variables **must not** capture the leading "/" character. The reason
306 | // is that the most common use case "{var}" does not capture the leading "/"
307 | // character. For consistency, all path variables must share the same behavior.
308 | //
309 | // Repeated message fields must not be mapped to URL query parameters, because
310 | // no client library can support such complicated mapping.
311 | //
312 | // If an API needs to use a JSON array for request or response body, it can map
313 | // the request or response body to a repeated field. However, some gRPC
314 | // Transcoding implementations may not support this feature.
315 | message HttpRule {
316 | // Selects a method to which this rule applies.
317 | //
318 | // Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
319 | string selector = 1;
320 |
321 | // Determines the URL pattern is matched by this rules. This pattern can be
322 | // used with any of the {get|put|post|delete|patch} methods. A custom method
323 | // can be defined using the 'custom' field.
324 | oneof pattern {
325 | // Maps to HTTP GET. Used for listing and getting information about
326 | // resources.
327 | string get = 2;
328 |
329 | // Maps to HTTP PUT. Used for replacing a resource.
330 | string put = 3;
331 |
332 | // Maps to HTTP POST. Used for creating a resource or performing an action.
333 | string post = 4;
334 |
335 | // Maps to HTTP DELETE. Used for deleting a resource.
336 | string delete = 5;
337 |
338 | // Maps to HTTP PATCH. Used for updating a resource.
339 | string patch = 6;
340 |
341 | // The custom pattern is used for specifying an HTTP method that is not
342 | // included in the `pattern` field, such as HEAD, or "*" to leave the
343 | // HTTP method unspecified for this rule. The wild-card rule is useful
344 | // for services that provide content to Web (HTML) clients.
345 | CustomHttpPattern custom = 8;
346 | }
347 |
348 | // The name of the request field whose value is mapped to the HTTP request
349 | // body, or `*` for mapping all request fields not captured by the path
350 | // pattern to the HTTP body, or omitted for not having any HTTP request body.
351 | //
352 | // NOTE: the referred field must be present at the top-level of the request
353 | // message type.
354 | string body = 7;
355 |
356 | // Optional. The name of the response field whose value is mapped to the HTTP
357 | // response body. When omitted, the entire response message will be used
358 | // as the HTTP response body.
359 | //
360 | // NOTE: The referred field must be present at the top-level of the response
361 | // message type.
362 | string response_body = 12;
363 |
364 | // Additional HTTP bindings for the selector. Nested bindings must
365 | // not contain an `additional_bindings` field themselves (that is,
366 | // the nesting may only be one level deep).
367 | repeated HttpRule additional_bindings = 11;
368 | }
369 |
370 | // A custom pattern is used for defining custom HTTP verb.
371 | message CustomHttpPattern {
372 | // The name of this custom HTTP verb.
373 | string kind = 1;
374 |
375 | // The path matched by this custom verb.
376 | string path = 2;
377 | }
378 |
--------------------------------------------------------------------------------
/friends/src/main/proto/google/api/httpbody.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2019 Google LLC.
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 |
16 | syntax = "proto3";
17 |
18 | package google.api;
19 |
20 | import "google/protobuf/any.proto";
21 |
22 | option cc_enable_arenas = true;
23 | option go_package = "google.golang.org/genproto/googleapis/api/httpbody;httpbody";
24 | option java_multiple_files = true;
25 | option java_outer_classname = "HttpBodyProto";
26 | option java_package = "com.google.api";
27 | option objc_class_prefix = "GAPI";
28 |
29 | // Message that represents an arbitrary HTTP body. It should only be used for
30 | // payload formats that can't be represented as JSON, such as raw binary or
31 | // an HTML page.
32 | //
33 | //
34 | // This message can be used both in streaming and non-streaming API methods in
35 | // the request as well as the response.
36 | //
37 | // It can be used as a top-level request field, which is convenient if one
38 | // wants to extract parameters from either the URL or HTTP template into the
39 | // request fields and also want access to the raw HTTP body.
40 | //
41 | // Example:
42 | //
43 | // message GetResourceRequest {
44 | // // A unique request id.
45 | // string request_id = 1;
46 | //
47 | // // The raw HTTP body is bound to this field.
48 | // google.api.HttpBody http_body = 2;
49 | // }
50 | //
51 | // service ResourceService {
52 | // rpc GetResource(GetResourceRequest) returns (google.api.HttpBody);
53 | // rpc UpdateResource(google.api.HttpBody) returns
54 | // (google.protobuf.Empty);
55 | // }
56 | //
57 | // Example with streaming methods:
58 | //
59 | // service CaldavService {
60 | // rpc GetCalendar(stream google.api.HttpBody)
61 | // returns (stream google.api.HttpBody);
62 | // rpc UpdateCalendar(stream google.api.HttpBody)
63 | // returns (stream google.api.HttpBody);
64 | // }
65 | //
66 | // Use of this type only changes how the request and response bodies are
67 | // handled, all other features will continue to work unchanged.
68 | message HttpBody {
69 | // The HTTP Content-Type header value specifying the content type of the body.
70 | string content_type = 1;
71 |
72 | // The HTTP request/response body as raw binary.
73 | bytes data = 2;
74 |
75 | // Application specific response metadata. Must be set in the first response
76 | // for streaming APIs.
77 | repeated google.protobuf.Any extensions = 3;
78 | }
79 |
--------------------------------------------------------------------------------
/friends/src/main/proto/google/protobuf/any.proto:
--------------------------------------------------------------------------------
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/any";
37 | option java_package = "com.google.protobuf";
38 | option java_outer_classname = "AnyProto";
39 | option java_multiple_files = true;
40 | option objc_class_prefix = "GPB";
41 |
42 | // `Any` contains an arbitrary serialized protocol buffer message along with a
43 | // URL that describes the type of the serialized message.
44 | //
45 | // Protobuf library provides support to pack/unpack Any values in the form
46 | // of utility functions or additional generated methods of the Any type.
47 | //
48 | // Example 1: Pack and unpack a message in C++.
49 | //
50 | // Foo foo = ...;
51 | // Any any;
52 | // any.PackFrom(foo);
53 | // ...
54 | // if (any.UnpackTo(&foo)) {
55 | // ...
56 | // }
57 | //
58 | // Example 2: Pack and unpack a message in Java.
59 | //
60 | // Foo foo = ...;
61 | // Any any = Any.pack(foo);
62 | // ...
63 | // if (any.is(Foo.class)) {
64 | // foo = any.unpack(Foo.class);
65 | // }
66 | //
67 | // Example 3: Pack and unpack a message in Python.
68 | //
69 | // foo = Foo(...)
70 | // any = Any()
71 | // any.Pack(foo)
72 | // ...
73 | // if any.Is(Foo.DESCRIPTOR):
74 | // any.Unpack(foo)
75 | // ...
76 | //
77 | // Example 4: Pack and unpack a message in Go
78 | //
79 | // foo := &pb.Foo{...}
80 | // any, err := ptypes.MarshalAny(foo)
81 | // ...
82 | // foo := &pb.Foo{}
83 | // if err := ptypes.UnmarshalAny(any, foo); err != nil {
84 | // ...
85 | // }
86 | //
87 | // The pack methods provided by protobuf library will by default use
88 | // 'type.googleapis.com/full.type.name' as the type URL and the unpack
89 | // methods only use the fully qualified type name after the last '/'
90 | // in the type URL, for example "foo.bar.com/x/y.z" will yield type
91 | // name "y.z".
92 | //
93 | //
94 | // JSON
95 | // ====
96 | // The JSON representation of an `Any` value uses the regular
97 | // representation of the deserialized, embedded message, with an
98 | // additional field `@type` which contains the type URL. Example:
99 | //
100 | // package google.profile;
101 | // message Person {
102 | // string first_name = 1;
103 | // string last_name = 2;
104 | // }
105 | //
106 | // {
107 | // "@type": "type.googleapis.com/google.profile.Person",
108 | // "firstName": ,
109 | // "lastName":
110 | // }
111 | //
112 | // If the embedded message type is well-known and has a custom JSON
113 | // representation, that representation will be embedded adding a field
114 | // `value` which holds the custom JSON in addition to the `@type`
115 | // field. Example (for message [google.protobuf.Duration][]):
116 | //
117 | // {
118 | // "@type": "type.googleapis.com/google.protobuf.Duration",
119 | // "value": "1.212s"
120 | // }
121 | //
122 | message Any {
123 | // A URL/resource name that uniquely identifies the type of the serialized
124 | // protocol buffer message. This string must contain at least
125 | // one "/" character. The last segment of the URL's path must represent
126 | // the fully qualified name of the type (as in
127 | // `path/google.protobuf.Duration`). The name should be in a canonical form
128 | // (e.g., leading "." is not accepted).
129 | //
130 | // In practice, teams usually precompile into the binary all types that they
131 | // expect it to use in the context of Any. However, for URLs which use the
132 | // scheme `http`, `https`, or no scheme, one can optionally set up a type
133 | // server that maps type URLs to message definitions as follows:
134 | //
135 | // * If no scheme is provided, `https` is assumed.
136 | // * An HTTP GET on the URL must yield a [google.protobuf.Type][]
137 | // value in binary format, or produce an error.
138 | // * Applications are allowed to cache lookup results based on the
139 | // URL, or have them precompiled into a binary to avoid any
140 | // lookup. Therefore, binary compatibility needs to be preserved
141 | // on changes to types. (Use versioned type names to manage
142 | // breaking changes.)
143 | //
144 | // Note: this functionality is not currently available in the official
145 | // protobuf release, and it is not used for type URLs beginning with
146 | // type.googleapis.com.
147 | //
148 | // Schemes other than `http`, `https` (or the empty scheme) might be
149 | // used with implementation specific semantics.
150 | //
151 | string type_url = 1;
152 |
153 | // Must be a valid serialized protocol buffer of the above specified type.
154 | bytes value = 2;
155 | }
156 |
--------------------------------------------------------------------------------
/friends/src/main/proto/google/protobuf/api.proto:
--------------------------------------------------------------------------------
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 | import "google/protobuf/source_context.proto";
36 | import "google/protobuf/type.proto";
37 |
38 | option csharp_namespace = "Google.Protobuf.WellKnownTypes";
39 | option java_package = "com.google.protobuf";
40 | option java_outer_classname = "ApiProto";
41 | option java_multiple_files = true;
42 | option objc_class_prefix = "GPB";
43 | option go_package = "google.golang.org/genproto/protobuf/api;api";
44 |
45 | // Api is a light-weight descriptor for an API Interface.
46 | //
47 | // Interfaces are also described as "protocol buffer services" in some contexts,
48 | // such as by the "service" keyword in a .proto file, but they are different
49 | // from API Services, which represent a concrete implementation of an interface
50 | // as opposed to simply a description of methods and bindings. They are also
51 | // sometimes simply referred to as "APIs" in other contexts, such as the name of
52 | // this message itself. See https://cloud.google.com/apis/design/glossary for
53 | // detailed terminology.
54 | message Api {
55 |
56 | // The fully qualified name of this interface, including package name
57 | // followed by the interface's simple name.
58 | string name = 1;
59 |
60 | // The methods of this interface, in unspecified order.
61 | repeated Method methods = 2;
62 |
63 | // Any metadata attached to the interface.
64 | repeated Option options = 3;
65 |
66 | // A version string for this interface. If specified, must have the form
67 | // `major-version.minor-version`, as in `1.10`. If the minor version is
68 | // omitted, it defaults to zero. If the entire version field is empty, the
69 | // major version is derived from the package name, as outlined below. If the
70 | // field is not empty, the version in the package name will be verified to be
71 | // consistent with what is provided here.
72 | //
73 | // The versioning schema uses [semantic
74 | // versioning](http://semver.org) where the major version number
75 | // indicates a breaking change and the minor version an additive,
76 | // non-breaking change. Both version numbers are signals to users
77 | // what to expect from different versions, and should be carefully
78 | // chosen based on the product plan.
79 | //
80 | // The major version is also reflected in the package name of the
81 | // interface, which must end in `v`, as in
82 | // `google.feature.v1`. For major versions 0 and 1, the suffix can
83 | // be omitted. Zero major versions must only be used for
84 | // experimental, non-GA interfaces.
85 | //
86 | //
87 | string version = 4;
88 |
89 | // Source context for the protocol buffer service represented by this
90 | // message.
91 | SourceContext source_context = 5;
92 |
93 | // Included interfaces. See [Mixin][].
94 | repeated Mixin mixins = 6;
95 |
96 | // The source syntax of the service.
97 | Syntax syntax = 7;
98 | }
99 |
100 | // Method represents a method of an API interface.
101 | message Method {
102 |
103 | // The simple name of this method.
104 | string name = 1;
105 |
106 | // A URL of the input message type.
107 | string request_type_url = 2;
108 |
109 | // If true, the request is streamed.
110 | bool request_streaming = 3;
111 |
112 | // The URL of the output message type.
113 | string response_type_url = 4;
114 |
115 | // If true, the response is streamed.
116 | bool response_streaming = 5;
117 |
118 | // Any metadata attached to the method.
119 | repeated Option options = 6;
120 |
121 | // The source syntax of this method.
122 | Syntax syntax = 7;
123 | }
124 |
125 | // Declares an API Interface to be included in this interface. The including
126 | // interface must redeclare all the methods from the included interface, but
127 | // documentation and options are inherited as follows:
128 | //
129 | // - If after comment and whitespace stripping, the documentation
130 | // string of the redeclared method is empty, it will be inherited
131 | // from the original method.
132 | //
133 | // - Each annotation belonging to the service config (http,
134 | // visibility) which is not set in the redeclared method will be
135 | // inherited.
136 | //
137 | // - If an http annotation is inherited, the path pattern will be
138 | // modified as follows. Any version prefix will be replaced by the
139 | // version of the including interface plus the [root][] path if
140 | // specified.
141 | //
142 | // Example of a simple mixin:
143 | //
144 | // package google.acl.v1;
145 | // service AccessControl {
146 | // // Get the underlying ACL object.
147 | // rpc GetAcl(GetAclRequest) returns (Acl) {
148 | // option (google.api.http).get = "/v1/{resource=**}:getAcl";
149 | // }
150 | // }
151 | //
152 | // package google.storage.v2;
153 | // service Storage {
154 | // rpc GetAcl(GetAclRequest) returns (Acl);
155 | //
156 | // // Get a data record.
157 | // rpc GetData(GetDataRequest) returns (Data) {
158 | // option (google.api.http).get = "/v2/{resource=**}";
159 | // }
160 | // }
161 | //
162 | // Example of a mixin configuration:
163 | //
164 | // apis:
165 | // - name: google.storage.v2.Storage
166 | // mixins:
167 | // - name: google.acl.v1.AccessControl
168 | //
169 | // The mixin construct implies that all methods in `AccessControl` are
170 | // also declared with same name and request/response types in
171 | // `Storage`. A documentation generator or annotation processor will
172 | // see the effective `Storage.GetAcl` method after inherting
173 | // documentation and annotations as follows:
174 | //
175 | // service Storage {
176 | // // Get the underlying ACL object.
177 | // rpc GetAcl(GetAclRequest) returns (Acl) {
178 | // option (google.api.http).get = "/v2/{resource=**}:getAcl";
179 | // }
180 | // ...
181 | // }
182 | //
183 | // Note how the version in the path pattern changed from `v1` to `v2`.
184 | //
185 | // If the `root` field in the mixin is specified, it should be a
186 | // relative path under which inherited HTTP paths are placed. Example:
187 | //
188 | // apis:
189 | // - name: google.storage.v2.Storage
190 | // mixins:
191 | // - name: google.acl.v1.AccessControl
192 | // root: acls
193 | //
194 | // This implies the following inherited HTTP annotation:
195 | //
196 | // service Storage {
197 | // // Get the underlying ACL object.
198 | // rpc GetAcl(GetAclRequest) returns (Acl) {
199 | // option (google.api.http).get = "/v2/acls/{resource=**}:getAcl";
200 | // }
201 | // ...
202 | // }
203 | message Mixin {
204 | // The fully qualified name of the interface which is included.
205 | string name = 1;
206 |
207 | // If non-empty specifies a path under which inherited HTTP paths
208 | // are rooted.
209 | string root = 2;
210 | }
211 |
--------------------------------------------------------------------------------
/friends/src/main/proto/google/protobuf/compiler/plugin.proto:
--------------------------------------------------------------------------------
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 | // Author: kenton@google.com (Kenton Varda)
32 | //
33 | // WARNING: The plugin interface is currently EXPERIMENTAL and is subject to
34 | // change.
35 | //
36 | // protoc (aka the Protocol Compiler) can be extended via plugins. A plugin is
37 | // just a program that reads a CodeGeneratorRequest from stdin and writes a
38 | // CodeGeneratorResponse to stdout.
39 | //
40 | // Plugins written using C++ can use google/protobuf/compiler/plugin.h instead
41 | // of dealing with the raw protocol defined here.
42 | //
43 | // A plugin executable needs only to be placed somewhere in the path. The
44 | // plugin should be named "protoc-gen-$NAME", and will then be used when the
45 | // flag "--${NAME}_out" is passed to protoc.
46 |
47 | syntax = "proto2";
48 |
49 | package google.protobuf.compiler;
50 | option java_package = "com.google.protobuf.compiler";
51 | option java_outer_classname = "PluginProtos";
52 |
53 | option go_package = "github.com/golang/protobuf/protoc-gen-go/plugin;plugin_go";
54 |
55 | import "google/protobuf/descriptor.proto";
56 |
57 | // The version number of protocol compiler.
58 | message Version {
59 | optional int32 major = 1;
60 | optional int32 minor = 2;
61 | optional int32 patch = 3;
62 | // A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should
63 | // be empty for mainline stable releases.
64 | optional string suffix = 4;
65 | }
66 |
67 | // An encoded CodeGeneratorRequest is written to the plugin's stdin.
68 | message CodeGeneratorRequest {
69 | // The .proto files that were explicitly listed on the command-line. The
70 | // code generator should generate code only for these files. Each file's
71 | // descriptor will be included in proto_file, below.
72 | repeated string file_to_generate = 1;
73 |
74 | // The generator parameter passed on the command-line.
75 | optional string parameter = 2;
76 |
77 | // FileDescriptorProtos for all files in files_to_generate and everything
78 | // they import. The files will appear in topological order, so each file
79 | // appears before any file that imports it.
80 | //
81 | // protoc guarantees that all proto_files will be written after
82 | // the fields above, even though this is not technically guaranteed by the
83 | // protobuf wire format. This theoretically could allow a plugin to stream
84 | // in the FileDescriptorProtos and handle them one by one rather than read
85 | // the entire set into memory at once. However, as of this writing, this
86 | // is not similarly optimized on protoc's end -- it will store all fields in
87 | // memory at once before sending them to the plugin.
88 | //
89 | // Type names of fields and extensions in the FileDescriptorProto are always
90 | // fully qualified.
91 | repeated FileDescriptorProto proto_file = 15;
92 |
93 | // The version number of protocol compiler.
94 | optional Version compiler_version = 3;
95 |
96 | }
97 |
98 | // The plugin writes an encoded CodeGeneratorResponse to stdout.
99 | message CodeGeneratorResponse {
100 | // Error message. If non-empty, code generation failed. The plugin process
101 | // should exit with status code zero even if it reports an error in this way.
102 | //
103 | // This should be used to indicate errors in .proto files which prevent the
104 | // code generator from generating correct code. Errors which indicate a
105 | // problem in protoc itself -- such as the input CodeGeneratorRequest being
106 | // unparseable -- should be reported by writing a message to stderr and
107 | // exiting with a non-zero status code.
108 | optional string error = 1;
109 |
110 | // Represents a single generated file.
111 | message File {
112 | // The file name, relative to the output directory. The name must not
113 | // contain "." or ".." components and must be relative, not be absolute (so,
114 | // the file cannot lie outside the output directory). "/" must be used as
115 | // the path separator, not "\".
116 | //
117 | // If the name is omitted, the content will be appended to the previous
118 | // file. This allows the generator to break large files into small chunks,
119 | // and allows the generated text to be streamed back to protoc so that large
120 | // files need not reside completely in memory at one time. Note that as of
121 | // this writing protoc does not optimize for this -- it will read the entire
122 | // CodeGeneratorResponse before writing files to disk.
123 | optional string name = 1;
124 |
125 | // If non-empty, indicates that the named file should already exist, and the
126 | // content here is to be inserted into that file at a defined insertion
127 | // point. This feature allows a code generator to extend the output
128 | // produced by another code generator. The original generator may provide
129 | // insertion points by placing special annotations in the file that look
130 | // like:
131 | // @@protoc_insertion_point(NAME)
132 | // The annotation can have arbitrary text before and after it on the line,
133 | // which allows it to be placed in a comment. NAME should be replaced with
134 | // an identifier naming the point -- this is what other generators will use
135 | // as the insertion_point. Code inserted at this point will be placed
136 | // immediately above the line containing the insertion point (thus multiple
137 | // insertions to the same point will come out in the order they were added).
138 | // The double-@ is intended to make it unlikely that the generated code
139 | // could contain things that look like insertion points by accident.
140 | //
141 | // For example, the C++ code generator places the following line in the
142 | // .pb.h files that it generates:
143 | // // @@protoc_insertion_point(namespace_scope)
144 | // This line appears within the scope of the file's package namespace, but
145 | // outside of any particular class. Another plugin can then specify the
146 | // insertion_point "namespace_scope" to generate additional classes or
147 | // other declarations that should be placed in this scope.
148 | //
149 | // Note that if the line containing the insertion point begins with
150 | // whitespace, the same whitespace will be added to every line of the
151 | // inserted text. This is useful for languages like Python, where
152 | // indentation matters. In these languages, the insertion point comment
153 | // should be indented the same amount as any inserted code will need to be
154 | // in order to work correctly in that context.
155 | //
156 | // The code generator that generates the initial file and the one which
157 | // inserts into it must both run as part of a single invocation of protoc.
158 | // Code generators are executed in the order in which they appear on the
159 | // command line.
160 | //
161 | // If |insertion_point| is present, |name| must also be present.
162 | optional string insertion_point = 2;
163 |
164 | // The file contents.
165 | optional string content = 15;
166 | }
167 | repeated File file = 15;
168 | }
169 |
--------------------------------------------------------------------------------
/friends/src/main/proto/google/protobuf/duration.proto:
--------------------------------------------------------------------------------
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 | // # Examples
51 | //
52 | // Example 1: Compute Duration from two Timestamps in pseudo code.
53 | //
54 | // Timestamp start = ...;
55 | // Timestamp end = ...;
56 | // Duration duration = ...;
57 | //
58 | // duration.seconds = end.seconds - start.seconds;
59 | // duration.nanos = end.nanos - start.nanos;
60 | //
61 | // if (duration.seconds < 0 && duration.nanos > 0) {
62 | // duration.seconds += 1;
63 | // duration.nanos -= 1000000000;
64 | // } else if (durations.seconds > 0 && duration.nanos < 0) {
65 | // duration.seconds -= 1;
66 | // duration.nanos += 1000000000;
67 | // }
68 | //
69 | // Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
70 | //
71 | // Timestamp start = ...;
72 | // Duration duration = ...;
73 | // Timestamp end = ...;
74 | //
75 | // end.seconds = start.seconds + duration.seconds;
76 | // end.nanos = start.nanos + duration.nanos;
77 | //
78 | // if (end.nanos < 0) {
79 | // end.seconds -= 1;
80 | // end.nanos += 1000000000;
81 | // } else if (end.nanos >= 1000000000) {
82 | // end.seconds += 1;
83 | // end.nanos -= 1000000000;
84 | // }
85 | //
86 | // Example 3: Compute Duration from datetime.timedelta in Python.
87 | //
88 | // td = datetime.timedelta(days=3, minutes=10)
89 | // duration = Duration()
90 | // duration.FromTimedelta(td)
91 | //
92 | // # JSON Mapping
93 | //
94 | // In JSON format, the Duration type is encoded as a string rather than an
95 | // object, where the string ends in the suffix "s" (indicating seconds) and
96 | // is preceded by the number of seconds, with nanoseconds expressed as
97 | // fractional seconds. For example, 3 seconds with 0 nanoseconds should be
98 | // encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
99 | // be expressed in JSON format as "3.000000001s", and 3 seconds and 1
100 | // microsecond should be expressed in JSON format as "3.000001s".
101 | //
102 | //
103 | message Duration {
104 | // Signed seconds of the span of time. Must be from -315,576,000,000
105 | // to +315,576,000,000 inclusive. Note: these bounds are computed from:
106 | // 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
107 | int64 seconds = 1;
108 |
109 | // Signed fractions of a second at nanosecond resolution of the span
110 | // of time. Durations less than one second are represented with a 0
111 | // `seconds` field and a positive or negative `nanos` field. For durations
112 | // of one second or more, a non-zero value for the `nanos` field must be
113 | // of the same sign as the `seconds` field. Must be from -999,999,999
114 | // to +999,999,999 inclusive.
115 | int32 nanos = 2;
116 | }
117 |
--------------------------------------------------------------------------------
/friends/src/main/proto/google/protobuf/empty.proto:
--------------------------------------------------------------------------------
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 {}
53 |
--------------------------------------------------------------------------------
/friends/src/main/proto/google/protobuf/field_mask.proto:
--------------------------------------------------------------------------------
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 | option cc_enable_arenas = true;
42 |
43 | // `FieldMask` represents a set of symbolic field paths, for example:
44 | //
45 | // paths: "f.a"
46 | // paths: "f.b.d"
47 | //
48 | // Here `f` represents a field in some root message, `a` and `b`
49 | // fields in the message found in `f`, and `d` a field found in the
50 | // message in `f.b`.
51 | //
52 | // Field masks are used to specify a subset of fields that should be
53 | // returned by a get operation or modified by an update operation.
54 | // Field masks also have a custom JSON encoding (see below).
55 | //
56 | // # Field Masks in Projections
57 | //
58 | // When used in the context of a projection, a response message or
59 | // sub-message is filtered by the API to only contain those fields as
60 | // specified in the mask. For example, if the mask in the previous
61 | // example is applied to a response message as follows:
62 | //
63 | // f {
64 | // a : 22
65 | // b {
66 | // d : 1
67 | // x : 2
68 | // }
69 | // y : 13
70 | // }
71 | // z: 8
72 | //
73 | // The result will not contain specific values for fields x,y and z
74 | // (their value will be set to the default, and omitted in proto text
75 | // output):
76 | //
77 | //
78 | // f {
79 | // a : 22
80 | // b {
81 | // d : 1
82 | // }
83 | // }
84 | //
85 | // A repeated field is not allowed except at the last position of a
86 | // paths string.
87 | //
88 | // If a FieldMask object is not present in a get operation, the
89 | // operation applies to all fields (as if a FieldMask of all fields
90 | // had been specified).
91 | //
92 | // Note that a field mask does not necessarily apply to the
93 | // top-level response message. In case of a REST get operation, the
94 | // field mask applies directly to the response, but in case of a REST
95 | // list operation, the mask instead applies to each individual message
96 | // in the returned resource list. In case of a REST custom method,
97 | // other definitions may be used. Where the mask applies will be
98 | // clearly documented together with its declaration in the API. In
99 | // any case, the effect on the returned resource/resources is required
100 | // behavior for APIs.
101 | //
102 | // # Field Masks in Update Operations
103 | //
104 | // A field mask in update operations specifies which fields of the
105 | // targeted resource are going to be updated. The API is required
106 | // to only change the values of the fields as specified in the mask
107 | // and leave the others untouched. If a resource is passed in to
108 | // describe the updated values, the API ignores the values of all
109 | // fields not covered by the mask.
110 | //
111 | // If a repeated field is specified for an update operation, new values will
112 | // be appended to the existing repeated field in the target resource. Note that
113 | // a repeated field is only allowed in the last position of a `paths` string.
114 | //
115 | // If a sub-message is specified in the last position of the field mask for an
116 | // update operation, then new value will be merged into the existing sub-message
117 | // in the target resource.
118 | //
119 | // For example, given the target message:
120 | //
121 | // f {
122 | // b {
123 | // d: 1
124 | // x: 2
125 | // }
126 | // c: [1]
127 | // }
128 | //
129 | // And an update message:
130 | //
131 | // f {
132 | // b {
133 | // d: 10
134 | // }
135 | // c: [2]
136 | // }
137 | //
138 | // then if the field mask is:
139 | //
140 | // paths: ["f.b", "f.c"]
141 | //
142 | // then the result will be:
143 | //
144 | // f {
145 | // b {
146 | // d: 10
147 | // x: 2
148 | // }
149 | // c: [1, 2]
150 | // }
151 | //
152 | // An implementation may provide options to override this default behavior for
153 | // repeated and message fields.
154 | //
155 | // In order to reset a field's value to the default, the field must
156 | // be in the mask and set to the default value in the provided resource.
157 | // Hence, in order to reset all fields of a resource, provide a default
158 | // instance of the resource and set all fields in the mask, or do
159 | // not provide a mask as described below.
160 | //
161 | // If a field mask is not present on update, the operation applies to
162 | // all fields (as if a field mask of all fields has been specified).
163 | // Note that in the presence of schema evolution, this may mean that
164 | // fields the client does not know and has therefore not filled into
165 | // the request will be reset to their default. If this is unwanted
166 | // behavior, a specific service may require a client to always specify
167 | // a field mask, producing an error if not.
168 | //
169 | // As with get operations, the location of the resource which
170 | // describes the updated values in the request message depends on the
171 | // operation kind. In any case, the effect of the field mask is
172 | // required to be honored by the API.
173 | //
174 | // ## Considerations for HTTP REST
175 | //
176 | // The HTTP kind of an update operation which uses a field mask must
177 | // be set to PATCH instead of PUT in order to satisfy HTTP semantics
178 | // (PUT must only be used for full updates).
179 | //
180 | // # JSON Encoding of Field Masks
181 | //
182 | // In JSON, a field mask is encoded as a single string where paths are
183 | // separated by a comma. Fields name in each path are converted
184 | // to/from lower-camel naming conventions.
185 | //
186 | // As an example, consider the following message declarations:
187 | //
188 | // message Profile {
189 | // User user = 1;
190 | // Photo photo = 2;
191 | // }
192 | // message User {
193 | // string display_name = 1;
194 | // string address = 2;
195 | // }
196 | //
197 | // In proto a field mask for `Profile` may look as such:
198 | //
199 | // mask {
200 | // paths: "user.display_name"
201 | // paths: "photo"
202 | // }
203 | //
204 | // In JSON, the same mask is represented as below:
205 | //
206 | // {
207 | // mask: "user.displayName,photo"
208 | // }
209 | //
210 | // # Field Masks and Oneof Fields
211 | //
212 | // Field masks treat fields in oneofs just as regular fields. Consider the
213 | // following message:
214 | //
215 | // message SampleMessage {
216 | // oneof test_oneof {
217 | // string name = 4;
218 | // SubMessage sub_message = 9;
219 | // }
220 | // }
221 | //
222 | // The field mask can be:
223 | //
224 | // mask {
225 | // paths: "name"
226 | // }
227 | //
228 | // Or:
229 | //
230 | // mask {
231 | // paths: "sub_message"
232 | // }
233 | //
234 | // Note that oneof type names ("test_oneof" in this case) cannot be used in
235 | // paths.
236 | //
237 | // ## Field Mask Verification
238 | //
239 | // The implementation of any API method which has a FieldMask type field in the
240 | // request should verify the included field paths, and return an
241 | // `INVALID_ARGUMENT` error if any path is duplicated or unmappable.
242 | message FieldMask {
243 | // The set of field mask paths.
244 | repeated string paths = 1;
245 | }
246 |
--------------------------------------------------------------------------------
/friends/src/main/proto/google/protobuf/source_context.proto:
--------------------------------------------------------------------------------
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 | }
49 |
--------------------------------------------------------------------------------
/friends/src/main/proto/google/protobuf/struct.proto:
--------------------------------------------------------------------------------
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 | // `Struct` represents a structured data value, consisting of fields
44 | // which map to dynamically typed values. In some languages, `Struct`
45 | // might be supported by a native representation. For example, in
46 | // scripting languages like JS a struct is represented as an
47 | // object. The details of that representation are described together
48 | // with the proto support for the language.
49 | //
50 | // The JSON representation for `Struct` is JSON object.
51 | message Struct {
52 | // Unordered map of dynamically typed values.
53 | map fields = 1;
54 | }
55 |
56 | // `Value` represents a dynamically typed value which can be either
57 | // null, a number, a string, a boolean, a recursive struct value, or a
58 | // list of values. A producer of value is expected to set one of that
59 | // variants, absence of any variant indicates an error.
60 | //
61 | // The JSON representation for `Value` is JSON value.
62 | message Value {
63 | // The kind of value.
64 | oneof kind {
65 | // Represents a null value.
66 | NullValue null_value = 1;
67 | // Represents a double value.
68 | double number_value = 2;
69 | // Represents a string value.
70 | string string_value = 3;
71 | // Represents a boolean value.
72 | bool bool_value = 4;
73 | // Represents a structured value.
74 | Struct struct_value = 5;
75 | // Represents a repeated `Value`.
76 | ListValue list_value = 6;
77 | }
78 | }
79 |
80 | // `NullValue` is a singleton enumeration to represent the null value for the
81 | // `Value` type union.
82 | //
83 | // The JSON representation for `NullValue` is JSON `null`.
84 | enum NullValue {
85 | // Null value.
86 | NULL_VALUE = 0;
87 | }
88 |
89 | // `ListValue` is a wrapper around a repeated field of values.
90 | //
91 | // The JSON representation for `ListValue` is JSON array.
92 | message ListValue {
93 | // Repeated field of dynamically typed values.
94 | repeated Value values = 1;
95 | }
96 |
--------------------------------------------------------------------------------
/friends/src/main/proto/google/protobuf/timestamp.proto:
--------------------------------------------------------------------------------
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 or local
44 | // calendar, encoded as a count of seconds and fractions of seconds at
45 | // nanosecond resolution. The count is relative to an epoch at UTC midnight on
46 | // January 1, 1970, in the proleptic Gregorian calendar which extends the
47 | // Gregorian calendar backwards to year one.
48 | //
49 | // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
50 | // second table is needed for interpretation, using a [24-hour linear
51 | // smear](https://developers.google.com/time/smear).
52 | //
53 | // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
54 | // restricting to that range, we ensure that we can convert to and from [RFC
55 | // 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
56 | //
57 | // # Examples
58 | //
59 | // Example 1: Compute Timestamp from POSIX `time()`.
60 | //
61 | // Timestamp timestamp;
62 | // timestamp.set_seconds(time(NULL));
63 | // timestamp.set_nanos(0);
64 | //
65 | // Example 2: Compute Timestamp from POSIX `gettimeofday()`.
66 | //
67 | // struct timeval tv;
68 | // gettimeofday(&tv, NULL);
69 | //
70 | // Timestamp timestamp;
71 | // timestamp.set_seconds(tv.tv_sec);
72 | // timestamp.set_nanos(tv.tv_usec * 1000);
73 | //
74 | // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
75 | //
76 | // FILETIME ft;
77 | // GetSystemTimeAsFileTime(&ft);
78 | // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
79 | //
80 | // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
81 | // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
82 | // Timestamp timestamp;
83 | // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
84 | // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
85 | //
86 | // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
87 | //
88 | // long millis = System.currentTimeMillis();
89 | //
90 | // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
91 | // .setNanos((int) ((millis % 1000) * 1000000)).build();
92 | //
93 | //
94 | // Example 5: Compute Timestamp from current time in Python.
95 | //
96 | // timestamp = Timestamp()
97 | // timestamp.GetCurrentTime()
98 | //
99 | // # JSON Mapping
100 | //
101 | // In JSON format, the Timestamp type is encoded as a string in the
102 | // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
103 | // format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
104 | // where {year} is always expressed using four digits while {month}, {day},
105 | // {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
106 | // seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
107 | // are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
108 | // is required. A proto3 JSON serializer should always use UTC (as indicated by
109 | // "Z") when printing the Timestamp type and a proto3 JSON parser should be
110 | // able to accept both UTC and other timezones (as indicated by an offset).
111 | //
112 | // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
113 | // 01:30 UTC on January 15, 2017.
114 | //
115 | // In JavaScript, one can convert a Date object to this format using the
116 | // standard
117 | // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
118 | // method. In Python, a standard `datetime.datetime` object can be converted
119 | // to this format using
120 | // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
121 | // the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
122 | // the Joda Time's [`ISODateTimeFormat.dateTime()`](
123 | // http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
124 | // ) to obtain a formatter capable of generating timestamps in this format.
125 | //
126 | //
127 | message Timestamp {
128 | // Represents seconds of UTC time since Unix epoch
129 | // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
130 | // 9999-12-31T23:59:59Z inclusive.
131 | int64 seconds = 1;
132 |
133 | // Non-negative fractions of a second at nanosecond resolution. Negative
134 | // second values with fractions must still have non-negative nanos values
135 | // that count forward in time. Must be from 0 to 999,999,999
136 | // inclusive.
137 | int32 nanos = 2;
138 | }
139 |
--------------------------------------------------------------------------------
/friends/src/main/proto/google/protobuf/type.proto:
--------------------------------------------------------------------------------
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 | import "google/protobuf/any.proto";
36 | import "google/protobuf/source_context.proto";
37 |
38 | option csharp_namespace = "Google.Protobuf.WellKnownTypes";
39 | option cc_enable_arenas = true;
40 | option java_package = "com.google.protobuf";
41 | option java_outer_classname = "TypeProto";
42 | option java_multiple_files = true;
43 | option objc_class_prefix = "GPB";
44 | option go_package = "google.golang.org/genproto/protobuf/ptype;ptype";
45 |
46 | // A protocol buffer message type.
47 | message Type {
48 | // The fully qualified message name.
49 | string name = 1;
50 | // The list of fields.
51 | repeated Field fields = 2;
52 | // The list of types appearing in `oneof` definitions in this type.
53 | repeated string oneofs = 3;
54 | // The protocol buffer options.
55 | repeated Option options = 4;
56 | // The source context.
57 | SourceContext source_context = 5;
58 | // The source syntax.
59 | Syntax syntax = 6;
60 | }
61 |
62 | // A single field of a message type.
63 | message Field {
64 | // Basic field types.
65 | enum Kind {
66 | // Field type unknown.
67 | TYPE_UNKNOWN = 0;
68 | // Field type double.
69 | TYPE_DOUBLE = 1;
70 | // Field type float.
71 | TYPE_FLOAT = 2;
72 | // Field type int64.
73 | TYPE_INT64 = 3;
74 | // Field type uint64.
75 | TYPE_UINT64 = 4;
76 | // Field type int32.
77 | TYPE_INT32 = 5;
78 | // Field type fixed64.
79 | TYPE_FIXED64 = 6;
80 | // Field type fixed32.
81 | TYPE_FIXED32 = 7;
82 | // Field type bool.
83 | TYPE_BOOL = 8;
84 | // Field type string.
85 | TYPE_STRING = 9;
86 | // Field type group. Proto2 syntax only, and deprecated.
87 | TYPE_GROUP = 10;
88 | // Field type message.
89 | TYPE_MESSAGE = 11;
90 | // Field type bytes.
91 | TYPE_BYTES = 12;
92 | // Field type uint32.
93 | TYPE_UINT32 = 13;
94 | // Field type enum.
95 | TYPE_ENUM = 14;
96 | // Field type sfixed32.
97 | TYPE_SFIXED32 = 15;
98 | // Field type sfixed64.
99 | TYPE_SFIXED64 = 16;
100 | // Field type sint32.
101 | TYPE_SINT32 = 17;
102 | // Field type sint64.
103 | TYPE_SINT64 = 18;
104 | }
105 |
106 | // Whether a field is optional, required, or repeated.
107 | enum Cardinality {
108 | // For fields with unknown cardinality.
109 | CARDINALITY_UNKNOWN = 0;
110 | // For optional fields.
111 | CARDINALITY_OPTIONAL = 1;
112 | // For required fields. Proto2 syntax only.
113 | CARDINALITY_REQUIRED = 2;
114 | // For repeated fields.
115 | CARDINALITY_REPEATED = 3;
116 | };
117 |
118 | // The field type.
119 | Kind kind = 1;
120 | // The field cardinality.
121 | Cardinality cardinality = 2;
122 | // The field number.
123 | int32 number = 3;
124 | // The field name.
125 | string name = 4;
126 | // The field type URL, without the scheme, for message or enumeration
127 | // types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
128 | string type_url = 6;
129 | // The index of the field type in `Type.oneofs`, for message or enumeration
130 | // types. The first type has index 1; zero means the type is not in the list.
131 | int32 oneof_index = 7;
132 | // Whether to use alternative packed wire representation.
133 | bool packed = 8;
134 | // The protocol buffer options.
135 | repeated Option options = 9;
136 | // The field JSON name.
137 | string json_name = 10;
138 | // The string value of the default value of this field. Proto2 syntax only.
139 | string default_value = 11;
140 | }
141 |
142 | // Enum type definition.
143 | message Enum {
144 | // Enum type name.
145 | string name = 1;
146 | // Enum value definitions.
147 | repeated EnumValue enumvalue = 2;
148 | // Protocol buffer options.
149 | repeated Option options = 3;
150 | // The source context.
151 | SourceContext source_context = 4;
152 | // The source syntax.
153 | Syntax syntax = 5;
154 | }
155 |
156 | // Enum value definition.
157 | message EnumValue {
158 | // Enum value name.
159 | string name = 1;
160 | // Enum value number.
161 | int32 number = 2;
162 | // Protocol buffer options.
163 | repeated Option options = 3;
164 | }
165 |
166 | // A protocol buffer option, which can be attached to a message, field,
167 | // enumeration, etc.
168 | message Option {
169 | // The option's name. For protobuf built-in options (options defined in
170 | // descriptor.proto), this is the short name. For example, `"map_entry"`.
171 | // For custom options, it should be the fully-qualified name. For example,
172 | // `"google.api.http"`.
173 | string name = 1;
174 | // The option's value packed in an Any message. If the value is a primitive,
175 | // the corresponding wrapper type defined in google/protobuf/wrappers.proto
176 | // should be used. If the value is an enum, it should be stored as an int32
177 | // value using the google.protobuf.Int32Value type.
178 | Any value = 2;
179 | }
180 |
181 | // The syntax in which a protocol buffer element is defined.
182 | enum Syntax {
183 | // Syntax `proto2`.
184 | SYNTAX_PROTO2 = 0;
185 | // Syntax `proto3`.
186 | SYNTAX_PROTO3 = 1;
187 | }
188 |
--------------------------------------------------------------------------------
/friends/src/main/proto/google/protobuf/wrappers.proto:
--------------------------------------------------------------------------------
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 | // Wrappers for primitive (non-message) types. These types are useful
32 | // for embedding primitives in the `google.protobuf.Any` type and for places
33 | // where we need to distinguish between the absence of a primitive
34 | // typed field and its default value.
35 | //
36 | // These wrappers have no meaningful use within repeated fields as they lack
37 | // the ability to detect presence on individual elements.
38 | // These wrappers have no meaningful use within a map or a oneof since
39 | // individual entries of a map or fields of a oneof can already detect presence.
40 |
41 | syntax = "proto3";
42 |
43 | package google.protobuf;
44 |
45 | option csharp_namespace = "Google.Protobuf.WellKnownTypes";
46 | option cc_enable_arenas = true;
47 | option go_package = "github.com/golang/protobuf/ptypes/wrappers";
48 | option java_package = "com.google.protobuf";
49 | option java_outer_classname = "WrappersProto";
50 | option java_multiple_files = true;
51 | option objc_class_prefix = "GPB";
52 |
53 | // Wrapper message for `double`.
54 | //
55 | // The JSON representation for `DoubleValue` is JSON number.
56 | message DoubleValue {
57 | // The double value.
58 | double value = 1;
59 | }
60 |
61 | // Wrapper message for `float`.
62 | //
63 | // The JSON representation for `FloatValue` is JSON number.
64 | message FloatValue {
65 | // The float value.
66 | float value = 1;
67 | }
68 |
69 | // Wrapper message for `int64`.
70 | //
71 | // The JSON representation for `Int64Value` is JSON string.
72 | message Int64Value {
73 | // The int64 value.
74 | int64 value = 1;
75 | }
76 |
77 | // Wrapper message for `uint64`.
78 | //
79 | // The JSON representation for `UInt64Value` is JSON string.
80 | message UInt64Value {
81 | // The uint64 value.
82 | uint64 value = 1;
83 | }
84 |
85 | // Wrapper message for `int32`.
86 | //
87 | // The JSON representation for `Int32Value` is JSON number.
88 | message Int32Value {
89 | // The int32 value.
90 | int32 value = 1;
91 | }
92 |
93 | // Wrapper message for `uint32`.
94 | //
95 | // The JSON representation for `UInt32Value` is JSON number.
96 | message UInt32Value {
97 | // The uint32 value.
98 | uint32 value = 1;
99 | }
100 |
101 | // Wrapper message for `bool`.
102 | //
103 | // The JSON representation for `BoolValue` is JSON `true` and `false`.
104 | message BoolValue {
105 | // The bool value.
106 | bool value = 1;
107 | }
108 |
109 | // Wrapper message for `string`.
110 | //
111 | // The JSON representation for `StringValue` is JSON string.
112 | message StringValue {
113 | // The string value.
114 | string value = 1;
115 | }
116 |
117 | // Wrapper message for `bytes`.
118 | //
119 | // The JSON representation for `BytesValue` is JSON string.
120 | message BytesValue {
121 | // The bytes value.
122 | bytes value = 1;
123 | }
124 |
--------------------------------------------------------------------------------
/friends/src/main/resources/application.conf:
--------------------------------------------------------------------------------
1 | cloudstate {
2 | system {
3 | loggers = ["akka.event.slf4j.Slf4jLogger"]
4 | loglevel = "DEBUG"
5 | logging-filter = "akka.event.slf4j.Slf4jLoggingFilter"
6 | }
7 |
8 | }
9 |
--------------------------------------------------------------------------------
/friends/src/main/resources/log4j2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/friends/src/main/resources/simplelogger.properties:
--------------------------------------------------------------------------------
1 | org.slf4j.simpleLogger.logFile=System.out
2 | org.slf4j.simpleLogger.cacheOutputStream=false
3 | org.slf4j.simpleLogger.defaultLogLevel=debug
4 | org.slf4j.simpleLogger.log.io.cloudstate.javasupport=debug
5 | org.slf4j.simpleLogger.log.io.cloudstate=debug
6 | org.slf4j.simpleLogger.log.akka=debug
7 | org.slf4j.simpleLogger.showDateTime=true
8 | org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss.SSS
9 | org.slf4j.simpleLogger.showThreadName=false
10 | org.slf4j.simpleLogger.showLogName=true
11 | org.slf4j.simpleLogger.showShortLogName=false
12 | org.slf4j.simpleLogger.levelInBrackets=false
13 | org.slf4j.simpleLogger.warnLevelString=WARN
14 |
--------------------------------------------------------------------------------
/presence/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM adoptopenjdk/openjdk11:debian
2 |
3 | WORKDIR /opt
4 | COPY ./target/presence-0.1-SNAPSHOT.jar .
5 | EXPOSE 8080
6 | ENV HOST 0.0.0.0
7 | ENV PORT 8080
8 | CMD java -jar presence-0.1-SNAPSHOT.jar
--------------------------------------------------------------------------------
/presence/README.md:
--------------------------------------------------------------------------------
1 | # Cloudstate samples
2 |
3 | ## Chat Presence service - Java implementation
4 |
5 | This is an implementation of the presence service, which is part of Cloudstate Chat sample.
6 |
7 | The user code is written in Java and uses a 100% Java toolchain (no Scala tools needed).
8 |
9 | ### Preparing to build
10 |
11 | Install Maven
12 |
13 | http://maven.apache.org/download.cgi
14 |
15 | ### Build the package and Docker image
16 |
17 | You need to specify your own Docker repository when building images. For example if your Docker hub name is justinhj you would do the following:
18 |
19 | ```
20 | mvn package
21 | mvn -Ddocker.name=justinhj/java-presence io.fabric8:docker-maven-plugin:0.26.1:build
22 | ```
23 |
24 | ### Push the image
25 |
26 | ```
27 | mvn -Ddocker.name=justinhj/java-presence io.fabric8:docker-maven-plugin:0.26.1:push
28 | ```
29 |
30 | ### Basic Testing
31 |
32 | One way to test your service is to run it in a Docker container, and have it connect to the Cloudstate side-car (also known as Cloudstate proxy). The following steps will allow you test the presence service.
33 |
34 | In a terminal run the Cloudstate side-car:
35 |
36 | `docker run -it --rm --network mynetwork --name cloudstate -p 9000:9000 cloudstateio/cloudstate-proxy-dev-mode -Dcloudstate.proxy.user-function-port=8080 -Dcloudstate.proxy.user-function-interface=java-presence`
37 |
38 | Open a second terminal to run the presence user function container (built as above).
39 |
40 | `docker run -it --rm --name java-presence --network mynetwork justinhj/java-presence`
41 |
42 | In a third terminal window simulate a user connecting to the service with grpcurl.
43 |
44 | `grpcurl -plaintext -d '{"name": "Alice"}' localhost:9000 cloudstate.samples.chat.presence.Presence/Connect`
45 |
46 | Repeat as many times as you feel like, watch the user count increase in the debug output of the second terminal.
47 |
48 | Now open a terminal to test the monitor call.
49 |
50 | `grpcurl -plaintext -d '{"name": "Alice"}' localhost:9000 cloudstate.samples.chat.presence.Presence/Monitor`
51 |
--------------------------------------------------------------------------------
/presence/deploy/presence.yaml:
--------------------------------------------------------------------------------
1 | # Stateful service descriptor for the Chat Presence
2 | apiVersion: cloudstate.io/v1alpha1
3 | kind: StatefulService
4 | metadata:
5 | name: presence
6 | spec:
7 | containers:
8 | - image: cloudstate.io/java-presence:latest
9 | name: presence
10 |
--------------------------------------------------------------------------------
/presence/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 | io.cloudstate
6 | presence
7 | jar
8 | 0.1-SNAPSHOT
9 |
10 |
11 |
12 | bintray-akka-maven
13 | bintray
14 | https://dl.bintray.com/akka/maven
15 |
16 |
17 |
18 |
19 |
20 | bintray-akka-maven
21 | bintray
22 | https://dl.bintray.com/akka/maven
23 |
24 |
25 |
26 |
27 | 1.8
28 | 1.8
29 | 2.6.5
30 | 1.0.0-M1
31 | 2.12
32 | 2.0.10
33 | 1.29.0
34 | UTF-8
35 | cloudstateio/java-presence
36 |
37 |
38 |
39 |
40 |
41 | org.apache.logging.log4j
42 | log4j-api
43 | 2.13.3
44 |
45 |
46 |
47 | org.apache.logging.log4j
48 | log4j-core
49 | 2.13.3
50 |
51 |
52 |
53 | com.google.protobuf
54 | protobuf-java
55 | 3.11.4
56 |
57 |
58 |
59 | com.google.protobuf
60 | protobuf-java-util
61 | 3.11.4
62 |
63 |
64 |
65 | io.cloudstate
66 | cloudstate-java-support
67 | 0.5.1
68 |
69 |
70 |
71 | com.lightbend.akka.grpc
72 | akka-grpc-runtime_${scala.binary.version}
73 | ${akka.grpc.version}
74 |
75 |
76 |
77 | com.typesafe.akka
78 | akka-stream-testkit_${scala.binary.version}
79 | ${akka.version}
80 | test
81 |
82 |
83 |
84 |
85 | io.grpc
86 | grpc-stub
87 | ${grpc.version}
88 |
89 |
90 |
91 | org.mortbay.jetty.alpn
92 | jetty-alpn-agent
93 | ${jetty.alpn.agent.version}
94 | runtime
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 | net.alchim31.maven
103 | scala-maven-plugin
104 | 3.4.1
105 |
106 |
107 |
108 | compile
109 | testCompile
110 |
111 |
112 |
113 |
114 |
115 |
116 | com.lightbend.akka.grpc
117 | akka-grpc-maven-plugin
118 | ${akka.grpc.version}
119 |
120 | Java
121 | false
122 | true
123 |
124 | src/main/proto
125 |
126 |
127 |
128 |
129 |
130 | generate
131 |
132 |
133 |
134 |
135 |
136 |
137 | maven-dependency-plugin
138 | 2.8
139 |
140 |
141 | getClasspathFilenames
142 |
143 |
145 | properties
146 |
147 |
148 |
149 |
150 |
151 |
152 | org.apache.maven.plugins
153 | maven-shade-plugin
154 | 2.1
155 |
156 |
157 | package
158 |
159 | shade
160 |
161 |
162 |
164 |
165 |
166 | reference.conf
167 |
168 |
169 | io.cloudstate.samples.presence.Main
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 | io.fabric8
179 | docker-maven-plugin
180 | 0.26.1
181 |
182 |
183 |
184 |
185 |
186 | build-docker-image
187 | package
188 |
189 | build
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
--------------------------------------------------------------------------------
/presence/src/main/java/io/cloudstate/samples/presence/Main.java:
--------------------------------------------------------------------------------
1 | package io.cloudstate.samples.presence;
2 |
3 | import cloudstate.samples.chat.presence.grpc.*;
4 | import io.cloudstate.javasupport.*;
5 |
6 | public class Main {
7 |
8 | public static void main(String[] args) throws Exception {
9 |
10 | System.out.println("Registering with Cloudstate");
11 | new CloudState()
12 | .registerCrdtEntity(
13 | PresenceEntity.class,
14 | PresenceGrpc.getDescriptor().findServiceByName("Presence"))
15 | .start()
16 | .toCompletableFuture()
17 | .get();
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/presence/src/main/java/io/cloudstate/samples/presence/PresenceEntity.java:
--------------------------------------------------------------------------------
1 | package io.cloudstate.samples.presence;
2 |
3 | import java.util.Optional;
4 | import io.cloudstate.javasupport.crdt.*;
5 | import cloudstate.samples.chat.presence.grpc.*;
6 | import org.apache.logging.log4j.LogManager;
7 | import org.apache.logging.log4j.Logger;
8 |
9 | /** Presence service is a CRDT entity that uses Vote to manage user online presence. */
10 | @CrdtEntity
11 | public class PresenceEntity {
12 | private static final Logger logger = LogManager.getLogger(PresenceEntity.class);
13 |
14 | private Vote presence = null;
15 | private int users = 0;
16 |
17 | public PresenceEntity(Vote presence) {
18 | this.presence = presence;
19 | logger.debug("Created entity");
20 | }
21 |
22 | /**
23 | * User presence monitoring call.
24 | *
25 | * This is a streamed call. We add a onStateChange callback, so that whenever the CRDT
26 | * changes, if the online status has changed since the last message we pushed, we push
27 | * it.
28 | */
29 | @CommandHandler OnlineStatus monitor(User user, StreamedCommandContext ctx) {
30 | // Note we store the online status in an array for each call to monitor
31 | // even though it is a single boolean, as this lets us capture the object
32 | // in onChange callback's environment below.
33 | boolean onlineStatus[] = { presence.isAtLeastOne() };
34 |
35 | if(ctx.isStreamed()) {
36 | ctx.onChange(subCtx ->
37 | {
38 | boolean previousOnlineStatus = onlineStatus[0];
39 | boolean newOnlineStatus = presence.isAtLeastOne();
40 | onlineStatus[0] = newOnlineStatus;
41 |
42 | if(newOnlineStatus != previousOnlineStatus) {
43 | logger.debug("monitor: " + user.getName() + " return {" + newOnlineStatus + "}");
44 | return Optional.of(OnlineStatus.newBuilder().setOnline(newOnlineStatus).build());
45 | } else {
46 | logger.debug("monitor: " + user.getName() + " status unchanged");
47 | return Optional.empty();
48 | }
49 | });
50 | }
51 |
52 | logger.debug("monitor: " + user.getName() + " return {" + onlineStatus + "}");
53 | return OnlineStatus.newBuilder().setOnline(onlineStatus[0]).build();
54 | }
55 |
56 | /**
57 | * Connect a user, to make their presence active.
58 | *
59 | * This is a streamed call. As long as a user (id given by the entity id) is connected
60 | * to it, they are considered to be online.
61 | *
62 | * Here we use a Vote CRDT, which if at least one node votes is true, will be true.
63 | * So when the user connects, we invoke the connect() method (which we have defined
64 | * by enriching the CRDT in onStateSet), which will manage our vote accordingly.
65 | *
66 | * When they disconnect, the onStreamCancel callback is invoked, and we disconnect,
67 | * removing our vote if this is the last connection to this CRDT.
68 | */
69 | @CommandHandler
70 | public Empty connect(StreamedCommandContext ctx) {
71 |
72 | if(ctx.isStreamed()) {
73 |
74 | ctx.onChange(s -> {
75 | logger.debug("connect: change!");
76 | return Optional.empty();
77 | });
78 |
79 | ctx.onCancel(a -> {
80 | users -= 1;
81 | if (users == 0) {
82 | presence.vote(false);
83 | }
84 |
85 | logger.debug("connect: cancelled stream. users = {}", users);
86 | });
87 |
88 | users += 1;
89 | if (users ==1) {
90 | presence.vote(true);
91 | }
92 |
93 | logger.debug("users = {}", users);
94 |
95 | }
96 | else {
97 | logger.debug("not streamed");
98 | ctx.fail("Call to connect must be streamed");
99 | }
100 | return Empty.getDefaultInstance();
101 | }
102 |
103 | }
104 |
--------------------------------------------------------------------------------
/presence/src/main/proto/cloudstate/entity_key.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2019 Lightbend Inc.
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 | // Extension for specifying which field in a message is to be considered an
16 | // entity key, for the purposes associating gRPC calls with entities and
17 | // sharding.
18 |
19 | syntax = "proto3";
20 |
21 | import "google/protobuf/descriptor.proto";
22 |
23 | package cloudstate;
24 |
25 | option java_package = "io.cloudstate";
26 | option go_package = "github.com/cloudstateio/go-support/cloudstate/;cloudstate";
27 |
28 | extend google.protobuf.FieldOptions {
29 | bool entity_key = 50002;
30 | }
31 |
--------------------------------------------------------------------------------
/presence/src/main/proto/cloudstate/eventing.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2019 Lightbend Inc.
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 | // Extension for specifying which topics a gRPC endpoint should be connected
16 | // to, in order to facilitate consuming and producing events from a message broker.
17 |
18 | syntax = "proto3";
19 |
20 | import "google/protobuf/descriptor.proto";
21 |
22 | package cloudstate;
23 |
24 | option java_package = "io.cloudstate";
25 | option java_multiple_files = true;
26 | option java_outer_classname = "EventsProto";
27 |
28 | message Eventing {
29 | string in = 1;
30 | string out = 2; // Special value "discard" means do not publish
31 | }
32 |
33 | extend google.protobuf.MethodOptions {
34 | Eventing eventing = 50003;
35 | }
36 |
--------------------------------------------------------------------------------
/presence/src/main/proto/google/api/annotations.proto:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2015, Google Inc.
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 google.api;
18 |
19 | import "google/api/http.proto";
20 | import "google/protobuf/descriptor.proto";
21 |
22 | option csharp_namespace = "Google.Protobuf";
23 | option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
24 | option java_multiple_files = true;
25 | option java_outer_classname = "AnnotationsProto";
26 | option java_package = "com.google.api";
27 | option objc_class_prefix = "GAPI";
28 |
29 | extend google.protobuf.MethodOptions {
30 | // See `HttpRule`.
31 | HttpRule http = 72295728;
32 | }
33 |
--------------------------------------------------------------------------------
/presence/src/main/proto/google/api/http.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2019 Google LLC.
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 |
16 | syntax = "proto3";
17 |
18 | package google.api;
19 |
20 | option csharp_namespace = "Google.Protobuf";
21 | option cc_enable_arenas = true;
22 | option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
23 | option java_multiple_files = true;
24 | option java_outer_classname = "HttpProto";
25 | option java_package = "com.google.api";
26 | option objc_class_prefix = "GAPI";
27 |
28 | // Defines the HTTP configuration for an API service. It contains a list of
29 | // [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method
30 | // to one or more HTTP REST API methods.
31 | message Http {
32 | // A list of HTTP configuration rules that apply to individual API methods.
33 | //
34 | // **NOTE:** All service configuration rules follow "last one wins" order.
35 | repeated HttpRule rules = 1;
36 |
37 | // When set to true, URL path parameters will be fully URI-decoded except in
38 | // cases of single segment matches in reserved expansion, where "%2F" will be
39 | // left encoded.
40 | //
41 | // The default behavior is to not decode RFC 6570 reserved characters in multi
42 | // segment matches.
43 | bool fully_decode_reserved_expansion = 2;
44 | }
45 |
46 | // # gRPC Transcoding
47 | //
48 | // gRPC Transcoding is a feature for mapping between a gRPC method and one or
49 | // more HTTP REST endpoints. It allows developers to build a single API service
50 | // that supports both gRPC APIs and REST APIs. Many systems, including [Google
51 | // APIs](https://github.com/googleapis/googleapis),
52 | // [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC
53 | // Gateway](https://github.com/grpc-ecosystem/grpc-gateway),
54 | // and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature
55 | // and use it for large scale production services.
56 | //
57 | // `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies
58 | // how different portions of the gRPC request message are mapped to the URL
59 | // path, URL query parameters, and HTTP request body. It also controls how the
60 | // gRPC response message is mapped to the HTTP response body. `HttpRule` is
61 | // typically specified as an `google.api.http` annotation on the gRPC method.
62 | //
63 | // Each mapping specifies a URL path template and an HTTP method. The path
64 | // template may refer to one or more fields in the gRPC request message, as long
65 | // as each field is a non-repeated field with a primitive (non-message) type.
66 | // The path template controls how fields of the request message are mapped to
67 | // the URL path.
68 | //
69 | // Example:
70 | //
71 | // service Messaging {
72 | // rpc GetMessage(GetMessageRequest) returns (Message) {
73 | // option (google.api.http) = {
74 | // get: "/v1/{name=messages/*}"
75 | // };
76 | // }
77 | // }
78 | // message GetMessageRequest {
79 | // string name = 1; // Mapped to URL path.
80 | // }
81 | // message Message {
82 | // string text = 1; // The resource content.
83 | // }
84 | //
85 | // This enables an HTTP REST to gRPC mapping as below:
86 | //
87 | // HTTP | gRPC
88 | // -----|-----
89 | // `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")`
90 | //
91 | // Any fields in the request message which are not bound by the path template
92 | // automatically become HTTP query parameters if there is no HTTP request body.
93 | // For example:
94 | //
95 | // service Messaging {
96 | // rpc GetMessage(GetMessageRequest) returns (Message) {
97 | // option (google.api.http) = {
98 | // get:"/v1/messages/{message_id}"
99 | // };
100 | // }
101 | // }
102 | // message GetMessageRequest {
103 | // message SubMessage {
104 | // string subfield = 1;
105 | // }
106 | // string message_id = 1; // Mapped to URL path.
107 | // int64 revision = 2; // Mapped to URL query parameter `revision`.
108 | // SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`.
109 | // }
110 | //
111 | // This enables a HTTP JSON to RPC mapping as below:
112 | //
113 | // HTTP | gRPC
114 | // -----|-----
115 | // `GET /v1/messages/123456?revision=2&sub.subfield=foo` |
116 | // `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield:
117 | // "foo"))`
118 | //
119 | // Note that fields which are mapped to URL query parameters must have a
120 | // primitive type or a repeated primitive type or a non-repeated message type.
121 | // In the case of a repeated type, the parameter can be repeated in the URL
122 | // as `...?param=A¶m=B`. In the case of a message type, each field of the
123 | // message is mapped to a separate parameter, such as
124 | // `...?foo.a=A&foo.b=B&foo.c=C`.
125 | //
126 | // For HTTP methods that allow a request body, the `body` field
127 | // specifies the mapping. Consider a REST update method on the
128 | // message resource collection:
129 | //
130 | // service Messaging {
131 | // rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
132 | // option (google.api.http) = {
133 | // patch: "/v1/messages/{message_id}"
134 | // body: "message"
135 | // };
136 | // }
137 | // }
138 | // message UpdateMessageRequest {
139 | // string message_id = 1; // mapped to the URL
140 | // Message message = 2; // mapped to the body
141 | // }
142 | //
143 | // The following HTTP JSON to RPC mapping is enabled, where the
144 | // representation of the JSON in the request body is determined by
145 | // protos JSON encoding:
146 | //
147 | // HTTP | gRPC
148 | // -----|-----
149 | // `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:
150 | // "123456" message { text: "Hi!" })`
151 | //
152 | // The special name `*` can be used in the body mapping to define that
153 | // every field not bound by the path template should be mapped to the
154 | // request body. This enables the following alternative definition of
155 | // the update method:
156 | //
157 | // service Messaging {
158 | // rpc UpdateMessage(Message) returns (Message) {
159 | // option (google.api.http) = {
160 | // patch: "/v1/messages/{message_id}"
161 | // body: "*"
162 | // };
163 | // }
164 | // }
165 | // message Message {
166 | // string message_id = 1;
167 | // string text = 2;
168 | // }
169 | //
170 | //
171 | // The following HTTP JSON to RPC mapping is enabled:
172 | //
173 | // HTTP | gRPC
174 | // -----|-----
175 | // `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id:
176 | // "123456" text: "Hi!")`
177 | //
178 | // Note that when using `*` in the body mapping, it is not possible to
179 | // have HTTP parameters, as all fields not bound by the path end in
180 | // the body. This makes this option more rarely used in practice when
181 | // defining REST APIs. The common usage of `*` is in custom methods
182 | // which don't use the URL at all for transferring data.
183 | //
184 | // It is possible to define multiple HTTP methods for one RPC by using
185 | // the `additional_bindings` option. Example:
186 | //
187 | // service Messaging {
188 | // rpc GetMessage(GetMessageRequest) returns (Message) {
189 | // option (google.api.http) = {
190 | // get: "/v1/messages/{message_id}"
191 | // additional_bindings {
192 | // get: "/v1/users/{user_id}/messages/{message_id}"
193 | // }
194 | // };
195 | // }
196 | // }
197 | // message GetMessageRequest {
198 | // string message_id = 1;
199 | // string user_id = 2;
200 | // }
201 | //
202 | // This enables the following two alternative HTTP JSON to RPC mappings:
203 | //
204 | // HTTP | gRPC
205 | // -----|-----
206 | // `GET /v1/messages/123456` | `GetMessage(message_id: "123456")`
207 | // `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id:
208 | // "123456")`
209 | //
210 | // ## Rules for HTTP mapping
211 | //
212 | // 1. Leaf request fields (recursive expansion nested messages in the request
213 | // message) are classified into three categories:
214 | // - Fields referred by the path template. They are passed via the URL path.
215 | // - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They are passed via the HTTP
216 | // request body.
217 | // - All other fields are passed via the URL query parameters, and the
218 | // parameter name is the field path in the request message. A repeated
219 | // field can be represented as multiple query parameters under the same
220 | // name.
221 | // 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL query parameter, all fields
222 | // are passed via URL path and HTTP request body.
223 | // 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP request body, all
224 | // fields are passed via URL path and URL query parameters.
225 | //
226 | // ### Path template syntax
227 | //
228 | // Template = "/" Segments [ Verb ] ;
229 | // Segments = Segment { "/" Segment } ;
230 | // Segment = "*" | "**" | LITERAL | Variable ;
231 | // Variable = "{" FieldPath [ "=" Segments ] "}" ;
232 | // FieldPath = IDENT { "." IDENT } ;
233 | // Verb = ":" LITERAL ;
234 | //
235 | // The syntax `*` matches a single URL path segment. The syntax `**` matches
236 | // zero or more URL path segments, which must be the last part of the URL path
237 | // except the `Verb`.
238 | //
239 | // The syntax `Variable` matches part of the URL path as specified by its
240 | // template. A variable template must not contain other variables. If a variable
241 | // matches a single path segment, its template may be omitted, e.g. `{var}`
242 | // is equivalent to `{var=*}`.
243 | //
244 | // The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL`
245 | // contains any reserved character, such characters should be percent-encoded
246 | // before the matching.
247 | //
248 | // If a variable contains exactly one path segment, such as `"{var}"` or
249 | // `"{var=*}"`, when such a variable is expanded into a URL path on the client
250 | // side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The
251 | // server side does the reverse decoding. Such variables show up in the
252 | // [Discovery
253 | // Document](https://developers.google.com/discovery/v1/reference/apis) as
254 | // `{var}`.
255 | //
256 | // If a variable contains multiple path segments, such as `"{var=foo/*}"`
257 | // or `"{var=**}"`, when such a variable is expanded into a URL path on the
258 | // client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded.
259 | // The server side does the reverse decoding, except "%2F" and "%2f" are left
260 | // unchanged. Such variables show up in the
261 | // [Discovery
262 | // Document](https://developers.google.com/discovery/v1/reference/apis) as
263 | // `{+var}`.
264 | //
265 | // ## Using gRPC API Service Configuration
266 | //
267 | // gRPC API Service Configuration (service config) is a configuration language
268 | // for configuring a gRPC service to become a user-facing product. The
269 | // service config is simply the YAML representation of the `google.api.Service`
270 | // proto message.
271 | //
272 | // As an alternative to annotating your proto file, you can configure gRPC
273 | // transcoding in your service config YAML files. You do this by specifying a
274 | // `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same
275 | // effect as the proto annotation. This can be particularly useful if you
276 | // have a proto that is reused in multiple services. Note that any transcoding
277 | // specified in the service config will override any matching transcoding
278 | // configuration in the proto.
279 | //
280 | // Example:
281 | //
282 | // http:
283 | // rules:
284 | // # Selects a gRPC method and applies HttpRule to it.
285 | // - selector: example.v1.Messaging.GetMessage
286 | // get: /v1/messages/{message_id}/{sub.subfield}
287 | //
288 | // ## Special notes
289 | //
290 | // When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the
291 | // proto to JSON conversion must follow the [proto3
292 | // specification](https://developers.google.com/protocol-buffers/docs/proto3#json).
293 | //
294 | // While the single segment variable follows the semantics of
295 | // [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String
296 | // Expansion, the multi segment variable **does not** follow RFC 6570 Section
297 | // 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion
298 | // does not expand special characters like `?` and `#`, which would lead
299 | // to invalid URLs. As the result, gRPC Transcoding uses a custom encoding
300 | // for multi segment variables.
301 | //
302 | // The path variables **must not** refer to any repeated or mapped field,
303 | // because client libraries are not capable of handling such variable expansion.
304 | //
305 | // The path variables **must not** capture the leading "/" character. The reason
306 | // is that the most common use case "{var}" does not capture the leading "/"
307 | // character. For consistency, all path variables must share the same behavior.
308 | //
309 | // Repeated message fields must not be mapped to URL query parameters, because
310 | // no client library can support such complicated mapping.
311 | //
312 | // If an API needs to use a JSON array for request or response body, it can map
313 | // the request or response body to a repeated field. However, some gRPC
314 | // Transcoding implementations may not support this feature.
315 | message HttpRule {
316 | // Selects a method to which this rule applies.
317 | //
318 | // Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
319 | string selector = 1;
320 |
321 | // Determines the URL pattern is matched by this rules. This pattern can be
322 | // used with any of the {get|put|post|delete|patch} methods. A custom method
323 | // can be defined using the 'custom' field.
324 | oneof pattern {
325 | // Maps to HTTP GET. Used for listing and getting information about
326 | // resources.
327 | string get = 2;
328 |
329 | // Maps to HTTP PUT. Used for replacing a resource.
330 | string put = 3;
331 |
332 | // Maps to HTTP POST. Used for creating a resource or performing an action.
333 | string post = 4;
334 |
335 | // Maps to HTTP DELETE. Used for deleting a resource.
336 | string delete = 5;
337 |
338 | // Maps to HTTP PATCH. Used for updating a resource.
339 | string patch = 6;
340 |
341 | // The custom pattern is used for specifying an HTTP method that is not
342 | // included in the `pattern` field, such as HEAD, or "*" to leave the
343 | // HTTP method unspecified for this rule. The wild-card rule is useful
344 | // for services that provide content to Web (HTML) clients.
345 | CustomHttpPattern custom = 8;
346 | }
347 |
348 | // The name of the request field whose value is mapped to the HTTP request
349 | // body, or `*` for mapping all request fields not captured by the path
350 | // pattern to the HTTP body, or omitted for not having any HTTP request body.
351 | //
352 | // NOTE: the referred field must be present at the top-level of the request
353 | // message type.
354 | string body = 7;
355 |
356 | // Optional. The name of the response field whose value is mapped to the HTTP
357 | // response body. When omitted, the entire response message will be used
358 | // as the HTTP response body.
359 | //
360 | // NOTE: The referred field must be present at the top-level of the response
361 | // message type.
362 | string response_body = 12;
363 |
364 | // Additional HTTP bindings for the selector. Nested bindings must
365 | // not contain an `additional_bindings` field themselves (that is,
366 | // the nesting may only be one level deep).
367 | repeated HttpRule additional_bindings = 11;
368 | }
369 |
370 | // A custom pattern is used for defining custom HTTP verb.
371 | message CustomHttpPattern {
372 | // The name of this custom HTTP verb.
373 | string kind = 1;
374 |
375 | // The path matched by this custom verb.
376 | string path = 2;
377 | }
378 |
--------------------------------------------------------------------------------
/presence/src/main/proto/google/api/httpbody.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2019 Google LLC.
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 |
16 | syntax = "proto3";
17 |
18 | package google.api;
19 |
20 | import "google/protobuf/any.proto";
21 |
22 | option cc_enable_arenas = true;
23 | option go_package = "google.golang.org/genproto/googleapis/api/httpbody;httpbody";
24 | option java_multiple_files = true;
25 | option java_outer_classname = "HttpBodyProto";
26 | option java_package = "com.google.api";
27 | option objc_class_prefix = "GAPI";
28 |
29 | // Message that represents an arbitrary HTTP body. It should only be used for
30 | // payload formats that can't be represented as JSON, such as raw binary or
31 | // an HTML page.
32 | //
33 | //
34 | // This message can be used both in streaming and non-streaming API methods in
35 | // the request as well as the response.
36 | //
37 | // It can be used as a top-level request field, which is convenient if one
38 | // wants to extract parameters from either the URL or HTTP template into the
39 | // request fields and also want access to the raw HTTP body.
40 | //
41 | // Example:
42 | //
43 | // message GetResourceRequest {
44 | // // A unique request id.
45 | // string request_id = 1;
46 | //
47 | // // The raw HTTP body is bound to this field.
48 | // google.api.HttpBody http_body = 2;
49 | // }
50 | //
51 | // service ResourceService {
52 | // rpc GetResource(GetResourceRequest) returns (google.api.HttpBody);
53 | // rpc UpdateResource(google.api.HttpBody) returns
54 | // (google.protobuf.Empty);
55 | // }
56 | //
57 | // Example with streaming methods:
58 | //
59 | // service CaldavService {
60 | // rpc GetCalendar(stream google.api.HttpBody)
61 | // returns (stream google.api.HttpBody);
62 | // rpc UpdateCalendar(stream google.api.HttpBody)
63 | // returns (stream google.api.HttpBody);
64 | // }
65 | //
66 | // Use of this type only changes how the request and response bodies are
67 | // handled, all other features will continue to work unchanged.
68 | message HttpBody {
69 | // The HTTP Content-Type header value specifying the content type of the body.
70 | string content_type = 1;
71 |
72 | // The HTTP request/response body as raw binary.
73 | bytes data = 2;
74 |
75 | // Application specific response metadata. Must be set in the first response
76 | // for streaming APIs.
77 | repeated google.protobuf.Any extensions = 3;
78 | }
79 |
--------------------------------------------------------------------------------
/presence/src/main/proto/google/protobuf/any.proto:
--------------------------------------------------------------------------------
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/any";
37 | option java_package = "com.google.protobuf";
38 | option java_outer_classname = "AnyProto";
39 | option java_multiple_files = true;
40 | option objc_class_prefix = "GPB";
41 |
42 | // `Any` contains an arbitrary serialized protocol buffer message along with a
43 | // URL that describes the type of the serialized message.
44 | //
45 | // Protobuf library provides support to pack/unpack Any values in the form
46 | // of utility functions or additional generated methods of the Any type.
47 | //
48 | // Example 1: Pack and unpack a message in C++.
49 | //
50 | // Foo foo = ...;
51 | // Any any;
52 | // any.PackFrom(foo);
53 | // ...
54 | // if (any.UnpackTo(&foo)) {
55 | // ...
56 | // }
57 | //
58 | // Example 2: Pack and unpack a message in Java.
59 | //
60 | // Foo foo = ...;
61 | // Any any = Any.pack(foo);
62 | // ...
63 | // if (any.is(Foo.class)) {
64 | // foo = any.unpack(Foo.class);
65 | // }
66 | //
67 | // Example 3: Pack and unpack a message in Python.
68 | //
69 | // foo = Foo(...)
70 | // any = Any()
71 | // any.Pack(foo)
72 | // ...
73 | // if any.Is(Foo.DESCRIPTOR):
74 | // any.Unpack(foo)
75 | // ...
76 | //
77 | // Example 4: Pack and unpack a message in Go
78 | //
79 | // foo := &pb.Foo{...}
80 | // any, err := ptypes.MarshalAny(foo)
81 | // ...
82 | // foo := &pb.Foo{}
83 | // if err := ptypes.UnmarshalAny(any, foo); err != nil {
84 | // ...
85 | // }
86 | //
87 | // The pack methods provided by protobuf library will by default use
88 | // 'type.googleapis.com/full.type.name' as the type URL and the unpack
89 | // methods only use the fully qualified type name after the last '/'
90 | // in the type URL, for example "foo.bar.com/x/y.z" will yield type
91 | // name "y.z".
92 | //
93 | //
94 | // JSON
95 | // ====
96 | // The JSON representation of an `Any` value uses the regular
97 | // representation of the deserialized, embedded message, with an
98 | // additional field `@type` which contains the type URL. Example:
99 | //
100 | // package google.profile;
101 | // message Person {
102 | // string first_name = 1;
103 | // string last_name = 2;
104 | // }
105 | //
106 | // {
107 | // "@type": "type.googleapis.com/google.profile.Person",
108 | // "firstName": ,
109 | // "lastName":
110 | // }
111 | //
112 | // If the embedded message type is well-known and has a custom JSON
113 | // representation, that representation will be embedded adding a field
114 | // `value` which holds the custom JSON in addition to the `@type`
115 | // field. Example (for message [google.protobuf.Duration][]):
116 | //
117 | // {
118 | // "@type": "type.googleapis.com/google.protobuf.Duration",
119 | // "value": "1.212s"
120 | // }
121 | //
122 | message Any {
123 | // A URL/resource name that uniquely identifies the type of the serialized
124 | // protocol buffer message. This string must contain at least
125 | // one "/" character. The last segment of the URL's path must represent
126 | // the fully qualified name of the type (as in
127 | // `path/google.protobuf.Duration`). The name should be in a canonical form
128 | // (e.g., leading "." is not accepted).
129 | //
130 | // In practice, teams usually precompile into the binary all types that they
131 | // expect it to use in the context of Any. However, for URLs which use the
132 | // scheme `http`, `https`, or no scheme, one can optionally set up a type
133 | // server that maps type URLs to message definitions as follows:
134 | //
135 | // * If no scheme is provided, `https` is assumed.
136 | // * An HTTP GET on the URL must yield a [google.protobuf.Type][]
137 | // value in binary format, or produce an error.
138 | // * Applications are allowed to cache lookup results based on the
139 | // URL, or have them precompiled into a binary to avoid any
140 | // lookup. Therefore, binary compatibility needs to be preserved
141 | // on changes to types. (Use versioned type names to manage
142 | // breaking changes.)
143 | //
144 | // Note: this functionality is not currently available in the official
145 | // protobuf release, and it is not used for type URLs beginning with
146 | // type.googleapis.com.
147 | //
148 | // Schemes other than `http`, `https` (or the empty scheme) might be
149 | // used with implementation specific semantics.
150 | //
151 | string type_url = 1;
152 |
153 | // Must be a valid serialized protocol buffer of the above specified type.
154 | bytes value = 2;
155 | }
156 |
--------------------------------------------------------------------------------
/presence/src/main/proto/google/protobuf/api.proto:
--------------------------------------------------------------------------------
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 | import "google/protobuf/source_context.proto";
36 | import "google/protobuf/type.proto";
37 |
38 | option csharp_namespace = "Google.Protobuf.WellKnownTypes";
39 | option java_package = "com.google.protobuf";
40 | option java_outer_classname = "ApiProto";
41 | option java_multiple_files = true;
42 | option objc_class_prefix = "GPB";
43 | option go_package = "google.golang.org/genproto/protobuf/api;api";
44 |
45 | // Api is a light-weight descriptor for an API Interface.
46 | //
47 | // Interfaces are also described as "protocol buffer services" in some contexts,
48 | // such as by the "service" keyword in a .proto file, but they are different
49 | // from API Services, which represent a concrete implementation of an interface
50 | // as opposed to simply a description of methods and bindings. They are also
51 | // sometimes simply referred to as "APIs" in other contexts, such as the name of
52 | // this message itself. See https://cloud.google.com/apis/design/glossary for
53 | // detailed terminology.
54 | message Api {
55 |
56 | // The fully qualified name of this interface, including package name
57 | // followed by the interface's simple name.
58 | string name = 1;
59 |
60 | // The methods of this interface, in unspecified order.
61 | repeated Method methods = 2;
62 |
63 | // Any metadata attached to the interface.
64 | repeated Option options = 3;
65 |
66 | // A version string for this interface. If specified, must have the form
67 | // `major-version.minor-version`, as in `1.10`. If the minor version is
68 | // omitted, it defaults to zero. If the entire version field is empty, the
69 | // major version is derived from the package name, as outlined below. If the
70 | // field is not empty, the version in the package name will be verified to be
71 | // consistent with what is provided here.
72 | //
73 | // The versioning schema uses [semantic
74 | // versioning](http://semver.org) where the major version number
75 | // indicates a breaking change and the minor version an additive,
76 | // non-breaking change. Both version numbers are signals to users
77 | // what to expect from different versions, and should be carefully
78 | // chosen based on the product plan.
79 | //
80 | // The major version is also reflected in the package name of the
81 | // interface, which must end in `v`, as in
82 | // `google.feature.v1`. For major versions 0 and 1, the suffix can
83 | // be omitted. Zero major versions must only be used for
84 | // experimental, non-GA interfaces.
85 | //
86 | //
87 | string version = 4;
88 |
89 | // Source context for the protocol buffer service represented by this
90 | // message.
91 | SourceContext source_context = 5;
92 |
93 | // Included interfaces. See [Mixin][].
94 | repeated Mixin mixins = 6;
95 |
96 | // The source syntax of the service.
97 | Syntax syntax = 7;
98 | }
99 |
100 | // Method represents a method of an API interface.
101 | message Method {
102 |
103 | // The simple name of this method.
104 | string name = 1;
105 |
106 | // A URL of the input message type.
107 | string request_type_url = 2;
108 |
109 | // If true, the request is streamed.
110 | bool request_streaming = 3;
111 |
112 | // The URL of the output message type.
113 | string response_type_url = 4;
114 |
115 | // If true, the response is streamed.
116 | bool response_streaming = 5;
117 |
118 | // Any metadata attached to the method.
119 | repeated Option options = 6;
120 |
121 | // The source syntax of this method.
122 | Syntax syntax = 7;
123 | }
124 |
125 | // Declares an API Interface to be included in this interface. The including
126 | // interface must redeclare all the methods from the included interface, but
127 | // documentation and options are inherited as follows:
128 | //
129 | // - If after comment and whitespace stripping, the documentation
130 | // string of the redeclared method is empty, it will be inherited
131 | // from the original method.
132 | //
133 | // - Each annotation belonging to the service config (http,
134 | // visibility) which is not set in the redeclared method will be
135 | // inherited.
136 | //
137 | // - If an http annotation is inherited, the path pattern will be
138 | // modified as follows. Any version prefix will be replaced by the
139 | // version of the including interface plus the [root][] path if
140 | // specified.
141 | //
142 | // Example of a simple mixin:
143 | //
144 | // package google.acl.v1;
145 | // service AccessControl {
146 | // // Get the underlying ACL object.
147 | // rpc GetAcl(GetAclRequest) returns (Acl) {
148 | // option (google.api.http).get = "/v1/{resource=**}:getAcl";
149 | // }
150 | // }
151 | //
152 | // package google.storage.v2;
153 | // service Storage {
154 | // rpc GetAcl(GetAclRequest) returns (Acl);
155 | //
156 | // // Get a data record.
157 | // rpc GetData(GetDataRequest) returns (Data) {
158 | // option (google.api.http).get = "/v2/{resource=**}";
159 | // }
160 | // }
161 | //
162 | // Example of a mixin configuration:
163 | //
164 | // apis:
165 | // - name: google.storage.v2.Storage
166 | // mixins:
167 | // - name: google.acl.v1.AccessControl
168 | //
169 | // The mixin construct implies that all methods in `AccessControl` are
170 | // also declared with same name and request/response types in
171 | // `Storage`. A documentation generator or annotation processor will
172 | // see the effective `Storage.GetAcl` method after inherting
173 | // documentation and annotations as follows:
174 | //
175 | // service Storage {
176 | // // Get the underlying ACL object.
177 | // rpc GetAcl(GetAclRequest) returns (Acl) {
178 | // option (google.api.http).get = "/v2/{resource=**}:getAcl";
179 | // }
180 | // ...
181 | // }
182 | //
183 | // Note how the version in the path pattern changed from `v1` to `v2`.
184 | //
185 | // If the `root` field in the mixin is specified, it should be a
186 | // relative path under which inherited HTTP paths are placed. Example:
187 | //
188 | // apis:
189 | // - name: google.storage.v2.Storage
190 | // mixins:
191 | // - name: google.acl.v1.AccessControl
192 | // root: acls
193 | //
194 | // This implies the following inherited HTTP annotation:
195 | //
196 | // service Storage {
197 | // // Get the underlying ACL object.
198 | // rpc GetAcl(GetAclRequest) returns (Acl) {
199 | // option (google.api.http).get = "/v2/acls/{resource=**}:getAcl";
200 | // }
201 | // ...
202 | // }
203 | message Mixin {
204 | // The fully qualified name of the interface which is included.
205 | string name = 1;
206 |
207 | // If non-empty specifies a path under which inherited HTTP paths
208 | // are rooted.
209 | string root = 2;
210 | }
211 |
--------------------------------------------------------------------------------
/presence/src/main/proto/google/protobuf/compiler/plugin.proto:
--------------------------------------------------------------------------------
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 | // Author: kenton@google.com (Kenton Varda)
32 | //
33 | // WARNING: The plugin interface is currently EXPERIMENTAL and is subject to
34 | // change.
35 | //
36 | // protoc (aka the Protocol Compiler) can be extended via plugins. A plugin is
37 | // just a program that reads a CodeGeneratorRequest from stdin and writes a
38 | // CodeGeneratorResponse to stdout.
39 | //
40 | // Plugins written using C++ can use google/protobuf/compiler/plugin.h instead
41 | // of dealing with the raw protocol defined here.
42 | //
43 | // A plugin executable needs only to be placed somewhere in the path. The
44 | // plugin should be named "protoc-gen-$NAME", and will then be used when the
45 | // flag "--${NAME}_out" is passed to protoc.
46 |
47 | syntax = "proto2";
48 |
49 | package google.protobuf.compiler;
50 | option java_package = "com.google.protobuf.compiler";
51 | option java_outer_classname = "PluginProtos";
52 |
53 | option go_package = "github.com/golang/protobuf/protoc-gen-go/plugin;plugin_go";
54 |
55 | import "google/protobuf/descriptor.proto";
56 |
57 | // The version number of protocol compiler.
58 | message Version {
59 | optional int32 major = 1;
60 | optional int32 minor = 2;
61 | optional int32 patch = 3;
62 | // A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should
63 | // be empty for mainline stable releases.
64 | optional string suffix = 4;
65 | }
66 |
67 | // An encoded CodeGeneratorRequest is written to the plugin's stdin.
68 | message CodeGeneratorRequest {
69 | // The .proto files that were explicitly listed on the command-line. The
70 | // code generator should generate code only for these files. Each file's
71 | // descriptor will be included in proto_file, below.
72 | repeated string file_to_generate = 1;
73 |
74 | // The generator parameter passed on the command-line.
75 | optional string parameter = 2;
76 |
77 | // FileDescriptorProtos for all files in files_to_generate and everything
78 | // they import. The files will appear in topological order, so each file
79 | // appears before any file that imports it.
80 | //
81 | // protoc guarantees that all proto_files will be written after
82 | // the fields above, even though this is not technically guaranteed by the
83 | // protobuf wire format. This theoretically could allow a plugin to stream
84 | // in the FileDescriptorProtos and handle them one by one rather than read
85 | // the entire set into memory at once. However, as of this writing, this
86 | // is not similarly optimized on protoc's end -- it will store all fields in
87 | // memory at once before sending them to the plugin.
88 | //
89 | // Type names of fields and extensions in the FileDescriptorProto are always
90 | // fully qualified.
91 | repeated FileDescriptorProto proto_file = 15;
92 |
93 | // The version number of protocol compiler.
94 | optional Version compiler_version = 3;
95 |
96 | }
97 |
98 | // The plugin writes an encoded CodeGeneratorResponse to stdout.
99 | message CodeGeneratorResponse {
100 | // Error message. If non-empty, code generation failed. The plugin process
101 | // should exit with status code zero even if it reports an error in this way.
102 | //
103 | // This should be used to indicate errors in .proto files which prevent the
104 | // code generator from generating correct code. Errors which indicate a
105 | // problem in protoc itself -- such as the input CodeGeneratorRequest being
106 | // unparseable -- should be reported by writing a message to stderr and
107 | // exiting with a non-zero status code.
108 | optional string error = 1;
109 |
110 | // Represents a single generated file.
111 | message File {
112 | // The file name, relative to the output directory. The name must not
113 | // contain "." or ".." components and must be relative, not be absolute (so,
114 | // the file cannot lie outside the output directory). "/" must be used as
115 | // the path separator, not "\".
116 | //
117 | // If the name is omitted, the content will be appended to the previous
118 | // file. This allows the generator to break large files into small chunks,
119 | // and allows the generated text to be streamed back to protoc so that large
120 | // files need not reside completely in memory at one time. Note that as of
121 | // this writing protoc does not optimize for this -- it will read the entire
122 | // CodeGeneratorResponse before writing files to disk.
123 | optional string name = 1;
124 |
125 | // If non-empty, indicates that the named file should already exist, and the
126 | // content here is to be inserted into that file at a defined insertion
127 | // point. This feature allows a code generator to extend the output
128 | // produced by another code generator. The original generator may provide
129 | // insertion points by placing special annotations in the file that look
130 | // like:
131 | // @@protoc_insertion_point(NAME)
132 | // The annotation can have arbitrary text before and after it on the line,
133 | // which allows it to be placed in a comment. NAME should be replaced with
134 | // an identifier naming the point -- this is what other generators will use
135 | // as the insertion_point. Code inserted at this point will be placed
136 | // immediately above the line containing the insertion point (thus multiple
137 | // insertions to the same point will come out in the order they were added).
138 | // The double-@ is intended to make it unlikely that the generated code
139 | // could contain things that look like insertion points by accident.
140 | //
141 | // For example, the C++ code generator places the following line in the
142 | // .pb.h files that it generates:
143 | // // @@protoc_insertion_point(namespace_scope)
144 | // This line appears within the scope of the file's package namespace, but
145 | // outside of any particular class. Another plugin can then specify the
146 | // insertion_point "namespace_scope" to generate additional classes or
147 | // other declarations that should be placed in this scope.
148 | //
149 | // Note that if the line containing the insertion point begins with
150 | // whitespace, the same whitespace will be added to every line of the
151 | // inserted text. This is useful for languages like Python, where
152 | // indentation matters. In these languages, the insertion point comment
153 | // should be indented the same amount as any inserted code will need to be
154 | // in order to work correctly in that context.
155 | //
156 | // The code generator that generates the initial file and the one which
157 | // inserts into it must both run as part of a single invocation of protoc.
158 | // Code generators are executed in the order in which they appear on the
159 | // command line.
160 | //
161 | // If |insertion_point| is present, |name| must also be present.
162 | optional string insertion_point = 2;
163 |
164 | // The file contents.
165 | optional string content = 15;
166 | }
167 | repeated File file = 15;
168 | }
169 |
--------------------------------------------------------------------------------
/presence/src/main/proto/google/protobuf/duration.proto:
--------------------------------------------------------------------------------
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 | // # Examples
51 | //
52 | // Example 1: Compute Duration from two Timestamps in pseudo code.
53 | //
54 | // Timestamp start = ...;
55 | // Timestamp end = ...;
56 | // Duration duration = ...;
57 | //
58 | // duration.seconds = end.seconds - start.seconds;
59 | // duration.nanos = end.nanos - start.nanos;
60 | //
61 | // if (duration.seconds < 0 && duration.nanos > 0) {
62 | // duration.seconds += 1;
63 | // duration.nanos -= 1000000000;
64 | // } else if (durations.seconds > 0 && duration.nanos < 0) {
65 | // duration.seconds -= 1;
66 | // duration.nanos += 1000000000;
67 | // }
68 | //
69 | // Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
70 | //
71 | // Timestamp start = ...;
72 | // Duration duration = ...;
73 | // Timestamp end = ...;
74 | //
75 | // end.seconds = start.seconds + duration.seconds;
76 | // end.nanos = start.nanos + duration.nanos;
77 | //
78 | // if (end.nanos < 0) {
79 | // end.seconds -= 1;
80 | // end.nanos += 1000000000;
81 | // } else if (end.nanos >= 1000000000) {
82 | // end.seconds += 1;
83 | // end.nanos -= 1000000000;
84 | // }
85 | //
86 | // Example 3: Compute Duration from datetime.timedelta in Python.
87 | //
88 | // td = datetime.timedelta(days=3, minutes=10)
89 | // duration = Duration()
90 | // duration.FromTimedelta(td)
91 | //
92 | // # JSON Mapping
93 | //
94 | // In JSON format, the Duration type is encoded as a string rather than an
95 | // object, where the string ends in the suffix "s" (indicating seconds) and
96 | // is preceded by the number of seconds, with nanoseconds expressed as
97 | // fractional seconds. For example, 3 seconds with 0 nanoseconds should be
98 | // encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
99 | // be expressed in JSON format as "3.000000001s", and 3 seconds and 1
100 | // microsecond should be expressed in JSON format as "3.000001s".
101 | //
102 | //
103 | message Duration {
104 | // Signed seconds of the span of time. Must be from -315,576,000,000
105 | // to +315,576,000,000 inclusive. Note: these bounds are computed from:
106 | // 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
107 | int64 seconds = 1;
108 |
109 | // Signed fractions of a second at nanosecond resolution of the span
110 | // of time. Durations less than one second are represented with a 0
111 | // `seconds` field and a positive or negative `nanos` field. For durations
112 | // of one second or more, a non-zero value for the `nanos` field must be
113 | // of the same sign as the `seconds` field. Must be from -999,999,999
114 | // to +999,999,999 inclusive.
115 | int32 nanos = 2;
116 | }
117 |
--------------------------------------------------------------------------------
/presence/src/main/proto/google/protobuf/empty.proto:
--------------------------------------------------------------------------------
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 {}
53 |
--------------------------------------------------------------------------------
/presence/src/main/proto/google/protobuf/field_mask.proto:
--------------------------------------------------------------------------------
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 | option cc_enable_arenas = true;
42 |
43 | // `FieldMask` represents a set of symbolic field paths, for example:
44 | //
45 | // paths: "f.a"
46 | // paths: "f.b.d"
47 | //
48 | // Here `f` represents a field in some root message, `a` and `b`
49 | // fields in the message found in `f`, and `d` a field found in the
50 | // message in `f.b`.
51 | //
52 | // Field masks are used to specify a subset of fields that should be
53 | // returned by a get operation or modified by an update operation.
54 | // Field masks also have a custom JSON encoding (see below).
55 | //
56 | // # Field Masks in Projections
57 | //
58 | // When used in the context of a projection, a response message or
59 | // sub-message is filtered by the API to only contain those fields as
60 | // specified in the mask. For example, if the mask in the previous
61 | // example is applied to a response message as follows:
62 | //
63 | // f {
64 | // a : 22
65 | // b {
66 | // d : 1
67 | // x : 2
68 | // }
69 | // y : 13
70 | // }
71 | // z: 8
72 | //
73 | // The result will not contain specific values for fields x,y and z
74 | // (their value will be set to the default, and omitted in proto text
75 | // output):
76 | //
77 | //
78 | // f {
79 | // a : 22
80 | // b {
81 | // d : 1
82 | // }
83 | // }
84 | //
85 | // A repeated field is not allowed except at the last position of a
86 | // paths string.
87 | //
88 | // If a FieldMask object is not present in a get operation, the
89 | // operation applies to all fields (as if a FieldMask of all fields
90 | // had been specified).
91 | //
92 | // Note that a field mask does not necessarily apply to the
93 | // top-level response message. In case of a REST get operation, the
94 | // field mask applies directly to the response, but in case of a REST
95 | // list operation, the mask instead applies to each individual message
96 | // in the returned resource list. In case of a REST custom method,
97 | // other definitions may be used. Where the mask applies will be
98 | // clearly documented together with its declaration in the API. In
99 | // any case, the effect on the returned resource/resources is required
100 | // behavior for APIs.
101 | //
102 | // # Field Masks in Update Operations
103 | //
104 | // A field mask in update operations specifies which fields of the
105 | // targeted resource are going to be updated. The API is required
106 | // to only change the values of the fields as specified in the mask
107 | // and leave the others untouched. If a resource is passed in to
108 | // describe the updated values, the API ignores the values of all
109 | // fields not covered by the mask.
110 | //
111 | // If a repeated field is specified for an update operation, new values will
112 | // be appended to the existing repeated field in the target resource. Note that
113 | // a repeated field is only allowed in the last position of a `paths` string.
114 | //
115 | // If a sub-message is specified in the last position of the field mask for an
116 | // update operation, then new value will be merged into the existing sub-message
117 | // in the target resource.
118 | //
119 | // For example, given the target message:
120 | //
121 | // f {
122 | // b {
123 | // d: 1
124 | // x: 2
125 | // }
126 | // c: [1]
127 | // }
128 | //
129 | // And an update message:
130 | //
131 | // f {
132 | // b {
133 | // d: 10
134 | // }
135 | // c: [2]
136 | // }
137 | //
138 | // then if the field mask is:
139 | //
140 | // paths: ["f.b", "f.c"]
141 | //
142 | // then the result will be:
143 | //
144 | // f {
145 | // b {
146 | // d: 10
147 | // x: 2
148 | // }
149 | // c: [1, 2]
150 | // }
151 | //
152 | // An implementation may provide options to override this default behavior for
153 | // repeated and message fields.
154 | //
155 | // In order to reset a field's value to the default, the field must
156 | // be in the mask and set to the default value in the provided resource.
157 | // Hence, in order to reset all fields of a resource, provide a default
158 | // instance of the resource and set all fields in the mask, or do
159 | // not provide a mask as described below.
160 | //
161 | // If a field mask is not present on update, the operation applies to
162 | // all fields (as if a field mask of all fields has been specified).
163 | // Note that in the presence of schema evolution, this may mean that
164 | // fields the client does not know and has therefore not filled into
165 | // the request will be reset to their default. If this is unwanted
166 | // behavior, a specific service may require a client to always specify
167 | // a field mask, producing an error if not.
168 | //
169 | // As with get operations, the location of the resource which
170 | // describes the updated values in the request message depends on the
171 | // operation kind. In any case, the effect of the field mask is
172 | // required to be honored by the API.
173 | //
174 | // ## Considerations for HTTP REST
175 | //
176 | // The HTTP kind of an update operation which uses a field mask must
177 | // be set to PATCH instead of PUT in order to satisfy HTTP semantics
178 | // (PUT must only be used for full updates).
179 | //
180 | // # JSON Encoding of Field Masks
181 | //
182 | // In JSON, a field mask is encoded as a single string where paths are
183 | // separated by a comma. Fields name in each path are converted
184 | // to/from lower-camel naming conventions.
185 | //
186 | // As an example, consider the following message declarations:
187 | //
188 | // message Profile {
189 | // User user = 1;
190 | // Photo photo = 2;
191 | // }
192 | // message User {
193 | // string display_name = 1;
194 | // string address = 2;
195 | // }
196 | //
197 | // In proto a field mask for `Profile` may look as such:
198 | //
199 | // mask {
200 | // paths: "user.display_name"
201 | // paths: "photo"
202 | // }
203 | //
204 | // In JSON, the same mask is represented as below:
205 | //
206 | // {
207 | // mask: "user.displayName,photo"
208 | // }
209 | //
210 | // # Field Masks and Oneof Fields
211 | //
212 | // Field masks treat fields in oneofs just as regular fields. Consider the
213 | // following message:
214 | //
215 | // message SampleMessage {
216 | // oneof test_oneof {
217 | // string name = 4;
218 | // SubMessage sub_message = 9;
219 | // }
220 | // }
221 | //
222 | // The field mask can be:
223 | //
224 | // mask {
225 | // paths: "name"
226 | // }
227 | //
228 | // Or:
229 | //
230 | // mask {
231 | // paths: "sub_message"
232 | // }
233 | //
234 | // Note that oneof type names ("test_oneof" in this case) cannot be used in
235 | // paths.
236 | //
237 | // ## Field Mask Verification
238 | //
239 | // The implementation of any API method which has a FieldMask type field in the
240 | // request should verify the included field paths, and return an
241 | // `INVALID_ARGUMENT` error if any path is duplicated or unmappable.
242 | message FieldMask {
243 | // The set of field mask paths.
244 | repeated string paths = 1;
245 | }
246 |
--------------------------------------------------------------------------------
/presence/src/main/proto/google/protobuf/source_context.proto:
--------------------------------------------------------------------------------
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 | }
49 |
--------------------------------------------------------------------------------
/presence/src/main/proto/google/protobuf/struct.proto:
--------------------------------------------------------------------------------
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 | // `Struct` represents a structured data value, consisting of fields
44 | // which map to dynamically typed values. In some languages, `Struct`
45 | // might be supported by a native representation. For example, in
46 | // scripting languages like JS a struct is represented as an
47 | // object. The details of that representation are described together
48 | // with the proto support for the language.
49 | //
50 | // The JSON representation for `Struct` is JSON object.
51 | message Struct {
52 | // Unordered map of dynamically typed values.
53 | map fields = 1;
54 | }
55 |
56 | // `Value` represents a dynamically typed value which can be either
57 | // null, a number, a string, a boolean, a recursive struct value, or a
58 | // list of values. A producer of value is expected to set one of that
59 | // variants, absence of any variant indicates an error.
60 | //
61 | // The JSON representation for `Value` is JSON value.
62 | message Value {
63 | // The kind of value.
64 | oneof kind {
65 | // Represents a null value.
66 | NullValue null_value = 1;
67 | // Represents a double value.
68 | double number_value = 2;
69 | // Represents a string value.
70 | string string_value = 3;
71 | // Represents a boolean value.
72 | bool bool_value = 4;
73 | // Represents a structured value.
74 | Struct struct_value = 5;
75 | // Represents a repeated `Value`.
76 | ListValue list_value = 6;
77 | }
78 | }
79 |
80 | // `NullValue` is a singleton enumeration to represent the null value for the
81 | // `Value` type union.
82 | //
83 | // The JSON representation for `NullValue` is JSON `null`.
84 | enum NullValue {
85 | // Null value.
86 | NULL_VALUE = 0;
87 | }
88 |
89 | // `ListValue` is a wrapper around a repeated field of values.
90 | //
91 | // The JSON representation for `ListValue` is JSON array.
92 | message ListValue {
93 | // Repeated field of dynamically typed values.
94 | repeated Value values = 1;
95 | }
96 |
--------------------------------------------------------------------------------
/presence/src/main/proto/google/protobuf/timestamp.proto:
--------------------------------------------------------------------------------
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 or local
44 | // calendar, encoded as a count of seconds and fractions of seconds at
45 | // nanosecond resolution. The count is relative to an epoch at UTC midnight on
46 | // January 1, 1970, in the proleptic Gregorian calendar which extends the
47 | // Gregorian calendar backwards to year one.
48 | //
49 | // All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap
50 | // second table is needed for interpretation, using a [24-hour linear
51 | // smear](https://developers.google.com/time/smear).
52 | //
53 | // The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By
54 | // restricting to that range, we ensure that we can convert to and from [RFC
55 | // 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.
56 | //
57 | // # Examples
58 | //
59 | // Example 1: Compute Timestamp from POSIX `time()`.
60 | //
61 | // Timestamp timestamp;
62 | // timestamp.set_seconds(time(NULL));
63 | // timestamp.set_nanos(0);
64 | //
65 | // Example 2: Compute Timestamp from POSIX `gettimeofday()`.
66 | //
67 | // struct timeval tv;
68 | // gettimeofday(&tv, NULL);
69 | //
70 | // Timestamp timestamp;
71 | // timestamp.set_seconds(tv.tv_sec);
72 | // timestamp.set_nanos(tv.tv_usec * 1000);
73 | //
74 | // Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.
75 | //
76 | // FILETIME ft;
77 | // GetSystemTimeAsFileTime(&ft);
78 | // UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
79 | //
80 | // // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z
81 | // // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.
82 | // Timestamp timestamp;
83 | // timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));
84 | // timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));
85 | //
86 | // Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.
87 | //
88 | // long millis = System.currentTimeMillis();
89 | //
90 | // Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)
91 | // .setNanos((int) ((millis % 1000) * 1000000)).build();
92 | //
93 | //
94 | // Example 5: Compute Timestamp from current time in Python.
95 | //
96 | // timestamp = Timestamp()
97 | // timestamp.GetCurrentTime()
98 | //
99 | // # JSON Mapping
100 | //
101 | // In JSON format, the Timestamp type is encoded as a string in the
102 | // [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the
103 | // format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z"
104 | // where {year} is always expressed using four digits while {month}, {day},
105 | // {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
106 | // seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
107 | // are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
108 | // is required. A proto3 JSON serializer should always use UTC (as indicated by
109 | // "Z") when printing the Timestamp type and a proto3 JSON parser should be
110 | // able to accept both UTC and other timezones (as indicated by an offset).
111 | //
112 | // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
113 | // 01:30 UTC on January 15, 2017.
114 | //
115 | // In JavaScript, one can convert a Date object to this format using the
116 | // standard
117 | // [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)
118 | // method. In Python, a standard `datetime.datetime` object can be converted
119 | // to this format using
120 | // [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with
121 | // the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use
122 | // the Joda Time's [`ISODateTimeFormat.dateTime()`](
123 | // http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D
124 | // ) to obtain a formatter capable of generating timestamps in this format.
125 | //
126 | //
127 | message Timestamp {
128 | // Represents seconds of UTC time since Unix epoch
129 | // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
130 | // 9999-12-31T23:59:59Z inclusive.
131 | int64 seconds = 1;
132 |
133 | // Non-negative fractions of a second at nanosecond resolution. Negative
134 | // second values with fractions must still have non-negative nanos values
135 | // that count forward in time. Must be from 0 to 999,999,999
136 | // inclusive.
137 | int32 nanos = 2;
138 | }
139 |
--------------------------------------------------------------------------------
/presence/src/main/proto/google/protobuf/type.proto:
--------------------------------------------------------------------------------
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 | import "google/protobuf/any.proto";
36 | import "google/protobuf/source_context.proto";
37 |
38 | option csharp_namespace = "Google.Protobuf.WellKnownTypes";
39 | option cc_enable_arenas = true;
40 | option java_package = "com.google.protobuf";
41 | option java_outer_classname = "TypeProto";
42 | option java_multiple_files = true;
43 | option objc_class_prefix = "GPB";
44 | option go_package = "google.golang.org/genproto/protobuf/ptype;ptype";
45 |
46 | // A protocol buffer message type.
47 | message Type {
48 | // The fully qualified message name.
49 | string name = 1;
50 | // The list of fields.
51 | repeated Field fields = 2;
52 | // The list of types appearing in `oneof` definitions in this type.
53 | repeated string oneofs = 3;
54 | // The protocol buffer options.
55 | repeated Option options = 4;
56 | // The source context.
57 | SourceContext source_context = 5;
58 | // The source syntax.
59 | Syntax syntax = 6;
60 | }
61 |
62 | // A single field of a message type.
63 | message Field {
64 | // Basic field types.
65 | enum Kind {
66 | // Field type unknown.
67 | TYPE_UNKNOWN = 0;
68 | // Field type double.
69 | TYPE_DOUBLE = 1;
70 | // Field type float.
71 | TYPE_FLOAT = 2;
72 | // Field type int64.
73 | TYPE_INT64 = 3;
74 | // Field type uint64.
75 | TYPE_UINT64 = 4;
76 | // Field type int32.
77 | TYPE_INT32 = 5;
78 | // Field type fixed64.
79 | TYPE_FIXED64 = 6;
80 | // Field type fixed32.
81 | TYPE_FIXED32 = 7;
82 | // Field type bool.
83 | TYPE_BOOL = 8;
84 | // Field type string.
85 | TYPE_STRING = 9;
86 | // Field type group. Proto2 syntax only, and deprecated.
87 | TYPE_GROUP = 10;
88 | // Field type message.
89 | TYPE_MESSAGE = 11;
90 | // Field type bytes.
91 | TYPE_BYTES = 12;
92 | // Field type uint32.
93 | TYPE_UINT32 = 13;
94 | // Field type enum.
95 | TYPE_ENUM = 14;
96 | // Field type sfixed32.
97 | TYPE_SFIXED32 = 15;
98 | // Field type sfixed64.
99 | TYPE_SFIXED64 = 16;
100 | // Field type sint32.
101 | TYPE_SINT32 = 17;
102 | // Field type sint64.
103 | TYPE_SINT64 = 18;
104 | }
105 |
106 | // Whether a field is optional, required, or repeated.
107 | enum Cardinality {
108 | // For fields with unknown cardinality.
109 | CARDINALITY_UNKNOWN = 0;
110 | // For optional fields.
111 | CARDINALITY_OPTIONAL = 1;
112 | // For required fields. Proto2 syntax only.
113 | CARDINALITY_REQUIRED = 2;
114 | // For repeated fields.
115 | CARDINALITY_REPEATED = 3;
116 | };
117 |
118 | // The field type.
119 | Kind kind = 1;
120 | // The field cardinality.
121 | Cardinality cardinality = 2;
122 | // The field number.
123 | int32 number = 3;
124 | // The field name.
125 | string name = 4;
126 | // The field type URL, without the scheme, for message or enumeration
127 | // types. Example: `"type.googleapis.com/google.protobuf.Timestamp"`.
128 | string type_url = 6;
129 | // The index of the field type in `Type.oneofs`, for message or enumeration
130 | // types. The first type has index 1; zero means the type is not in the list.
131 | int32 oneof_index = 7;
132 | // Whether to use alternative packed wire representation.
133 | bool packed = 8;
134 | // The protocol buffer options.
135 | repeated Option options = 9;
136 | // The field JSON name.
137 | string json_name = 10;
138 | // The string value of the default value of this field. Proto2 syntax only.
139 | string default_value = 11;
140 | }
141 |
142 | // Enum type definition.
143 | message Enum {
144 | // Enum type name.
145 | string name = 1;
146 | // Enum value definitions.
147 | repeated EnumValue enumvalue = 2;
148 | // Protocol buffer options.
149 | repeated Option options = 3;
150 | // The source context.
151 | SourceContext source_context = 4;
152 | // The source syntax.
153 | Syntax syntax = 5;
154 | }
155 |
156 | // Enum value definition.
157 | message EnumValue {
158 | // Enum value name.
159 | string name = 1;
160 | // Enum value number.
161 | int32 number = 2;
162 | // Protocol buffer options.
163 | repeated Option options = 3;
164 | }
165 |
166 | // A protocol buffer option, which can be attached to a message, field,
167 | // enumeration, etc.
168 | message Option {
169 | // The option's name. For protobuf built-in options (options defined in
170 | // descriptor.proto), this is the short name. For example, `"map_entry"`.
171 | // For custom options, it should be the fully-qualified name. For example,
172 | // `"google.api.http"`.
173 | string name = 1;
174 | // The option's value packed in an Any message. If the value is a primitive,
175 | // the corresponding wrapper type defined in google/protobuf/wrappers.proto
176 | // should be used. If the value is an enum, it should be stored as an int32
177 | // value using the google.protobuf.Int32Value type.
178 | Any value = 2;
179 | }
180 |
181 | // The syntax in which a protocol buffer element is defined.
182 | enum Syntax {
183 | // Syntax `proto2`.
184 | SYNTAX_PROTO2 = 0;
185 | // Syntax `proto3`.
186 | SYNTAX_PROTO3 = 1;
187 | }
188 |
--------------------------------------------------------------------------------
/presence/src/main/proto/google/protobuf/wrappers.proto:
--------------------------------------------------------------------------------
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 | // Wrappers for primitive (non-message) types. These types are useful
32 | // for embedding primitives in the `google.protobuf.Any` type and for places
33 | // where we need to distinguish between the absence of a primitive
34 | // typed field and its default value.
35 | //
36 | // These wrappers have no meaningful use within repeated fields as they lack
37 | // the ability to detect presence on individual elements.
38 | // These wrappers have no meaningful use within a map or a oneof since
39 | // individual entries of a map or fields of a oneof can already detect presence.
40 |
41 | syntax = "proto3";
42 |
43 | package google.protobuf;
44 |
45 | option csharp_namespace = "Google.Protobuf.WellKnownTypes";
46 | option cc_enable_arenas = true;
47 | option go_package = "github.com/golang/protobuf/ptypes/wrappers";
48 | option java_package = "com.google.protobuf";
49 | option java_outer_classname = "WrappersProto";
50 | option java_multiple_files = true;
51 | option objc_class_prefix = "GPB";
52 |
53 | // Wrapper message for `double`.
54 | //
55 | // The JSON representation for `DoubleValue` is JSON number.
56 | message DoubleValue {
57 | // The double value.
58 | double value = 1;
59 | }
60 |
61 | // Wrapper message for `float`.
62 | //
63 | // The JSON representation for `FloatValue` is JSON number.
64 | message FloatValue {
65 | // The float value.
66 | float value = 1;
67 | }
68 |
69 | // Wrapper message for `int64`.
70 | //
71 | // The JSON representation for `Int64Value` is JSON string.
72 | message Int64Value {
73 | // The int64 value.
74 | int64 value = 1;
75 | }
76 |
77 | // Wrapper message for `uint64`.
78 | //
79 | // The JSON representation for `UInt64Value` is JSON string.
80 | message UInt64Value {
81 | // The uint64 value.
82 | uint64 value = 1;
83 | }
84 |
85 | // Wrapper message for `int32`.
86 | //
87 | // The JSON representation for `Int32Value` is JSON number.
88 | message Int32Value {
89 | // The int32 value.
90 | int32 value = 1;
91 | }
92 |
93 | // Wrapper message for `uint32`.
94 | //
95 | // The JSON representation for `UInt32Value` is JSON number.
96 | message UInt32Value {
97 | // The uint32 value.
98 | uint32 value = 1;
99 | }
100 |
101 | // Wrapper message for `bool`.
102 | //
103 | // The JSON representation for `BoolValue` is JSON `true` and `false`.
104 | message BoolValue {
105 | // The bool value.
106 | bool value = 1;
107 | }
108 |
109 | // Wrapper message for `string`.
110 | //
111 | // The JSON representation for `StringValue` is JSON string.
112 | message StringValue {
113 | // The string value.
114 | string value = 1;
115 | }
116 |
117 | // Wrapper message for `bytes`.
118 | //
119 | // The JSON representation for `BytesValue` is JSON string.
120 | message BytesValue {
121 | // The bytes value.
122 | bytes value = 1;
123 | }
124 |
--------------------------------------------------------------------------------
/presence/src/main/proto/presence.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 |
3 | import "cloudstate/entity_key.proto";
4 |
5 | package cloudstate.samples.chat.presence;
6 |
7 | option java_multiple_files = true;
8 | option java_package = "cloudstate.samples.chat.presence.grpc";
9 | option java_outer_classname = "PresenceGrpc";
10 |
11 | message User {
12 | string name = 1 [(.cloudstate.entity_key) = true];
13 | }
14 |
15 | message OnlineStatus {
16 | bool online = 1;
17 | }
18 |
19 | message Empty {
20 | }
21 |
22 | service Presence {
23 | // Connect the given user. They will stay connected as long as the stream stays open.
24 | rpc Connect(User) returns (stream Empty);
25 | // Monitor the online status of the given user.
26 | rpc Monitor(User) returns (stream OnlineStatus);
27 | }
28 |
--------------------------------------------------------------------------------
/presence/src/main/resources/application.conf:
--------------------------------------------------------------------------------
1 | cloudstate {
2 | system {
3 | loggers = ["akka.event.slf4j.Slf4jLogger"]
4 | loglevel = "DEBUG"
5 | logging-filter = "akka.event.slf4j.Slf4jLoggingFilter"
6 | }
7 |
8 | }
9 |
--------------------------------------------------------------------------------
/presence/src/main/resources/log4j2.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/presence/src/main/resources/simplelogger.properties:
--------------------------------------------------------------------------------
1 | org.slf4j.simpleLogger.logFile=System.out
2 | org.slf4j.simpleLogger.cacheOutputStream=false
3 | org.slf4j.simpleLogger.defaultLogLevel=debug
4 | org.slf4j.simpleLogger.log.io.cloudstate.javasupport=debug
5 | org.slf4j.simpleLogger.log.io.cloudstate=debug
6 | org.slf4j.simpleLogger.log.akka=debug
7 | org.slf4j.simpleLogger.showDateTime=true
8 | org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss.SSS
9 | org.slf4j.simpleLogger.showThreadName=false
10 | org.slf4j.simpleLogger.showLogName=true
11 | org.slf4j.simpleLogger.showShortLogName=false
12 | org.slf4j.simpleLogger.levelInBrackets=false
13 | org.slf4j.simpleLogger.warnLevelString=WARN
14 |
--------------------------------------------------------------------------------