2 * Copyright 2011 Google Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 // Specification of protocol buffers that are used with the Android
20 // Note: unless otherwise specified in a comment, all fields in all messages
21 // are required, even though they are listed as optional.
25 package com.google.protos.ipc.invalidation;
27 option optimize_for = LITE_RUNTIME;
31 option java_outer_classname = "NanoAndroidService";
32 option java_package = "com.google.protos.ipc.invalidation";
36 import "client_protocol.proto";
37 import "java_client.proto";
39 // Call from application to Ticl.
41 // Android service messages are typically validated. Validation rules may be
42 // declared in ClientProtoWrapperGenerator.java.
44 message ClientDowncall {
45 message StartDowncall {}
46 message StopDowncall {}
48 optional bytes ack_handle = 1;
50 message RegistrationDowncall {
51 repeated ObjectIdP registrations = 1;
52 repeated ObjectIdP unregistrations = 2;
55 // Serial number to prevent intent reordering.
57 optional int64 serial = 1;
58 optional Version version = 2;
60 // Exactly one of the following fields must be set.
61 optional StartDowncall start = 3;
62 optional StopDowncall stop = 4;
63 optional AckDowncall ack = 5;
64 optional RegistrationDowncall registrations = 6;
67 // Internal (non-public) call from application to Ticl.
68 message InternalDowncall {
69 message ServerMessage {
70 optional bytes data = 1;
72 message NetworkStatus {
73 optional bool is_online = 1;
75 message CreateClient {
76 optional int32 client_type = 1; // client type code.
77 optional bytes client_name = 2; // application client id.
78 optional ClientConfigP client_config = 3; // Client config.
80 // Whether the client should not be started on creation. Must always be
81 // false for production use.
82 optional bool skip_start_for_test = 4;
84 optional Version version = 1;
86 // Exactly one must be set.
87 optional ServerMessage server_message = 2;
88 optional NetworkStatus network_status = 3;
89 optional bool network_addr_change = 4;
90 optional CreateClient create_client = 5;
93 // Upcall from Ticl to application listener.
95 message ListenerUpcall {
96 message ReadyUpcall {}
98 message InvalidateUpcall {
100 optional bytes ack_handle = 1;
102 // Exactly one must be set.
103 optional InvalidationP invalidation = 2;
104 optional ObjectIdP invalidate_unknown = 3;
105 optional bool invalidate_all = 4;
108 message RegistrationStatusUpcall {
109 optional ObjectIdP object_id = 1;
110 optional bool is_registered = 2;
113 message RegistrationFailureUpcall {
114 optional ObjectIdP object_id = 1;
115 optional bool transient = 2;
116 optional string message = 3;
119 message ReissueRegistrationsUpcall {
120 optional bytes prefix = 1;
121 optional int32 length = 2;
124 message ErrorUpcall {
125 optional int32 error_code = 1;
126 optional string error_message = 2;
127 optional bool is_transient = 3;
130 // Serial number to prevent intent reordering. Not currently used.
132 optional int64 serial = 1;
133 optional Version version = 2;
135 // Exactly one must be sent.
136 optional ReadyUpcall ready = 3;
137 optional InvalidateUpcall invalidate = 4;
138 optional RegistrationStatusUpcall registration_status = 5;
139 optional RegistrationFailureUpcall registration_failure = 6;
140 optional ReissueRegistrationsUpcall reissue_registrations = 7;
141 optional ErrorUpcall error = 8;
144 // Internal proto used by the Android scheduler to represent an event to run.
145 message AndroidSchedulerEvent {
146 optional Version version = 1;
148 // Name of the recurring task to execute.
149 optional string event_name = 2;
151 // Generation number of the Ticl with which this event is associated. Used to
152 // prevent old events from accidentally firing on new Ticls.
153 optional int64 ticl_id = 3;
156 // Represents a task scheduled to run at a particular time.
157 message ScheduledTask {
158 // The task to be run.
159 optional string event_name = 1;
161 // When the task should run, in milliseconds on the device's clock.
162 optional int64 execute_time_ms = 2;
165 // Internal proto used by the Android network to represent a message to send
166 // to the data center from the client.
167 message AndroidNetworkSendRequest {
168 optional Version version = 1; // Required
169 optional bytes message = 2; // Required
172 // Protocol buffer used to store state for a persisted Ticl.
173 message AndroidTiclState {
175 // All fields are required.
176 optional int32 client_type = 1; // client type code.
177 optional bytes client_name = 2; // application client id.
178 optional int64 ticl_id = 3; // Ticl uniquifier.
179 optional ClientConfigP client_config = 4; // client config.
181 optional Version version = 1;
182 optional InvalidationClientState ticl_state = 2; // Marshalled Ticl.
183 optional Metadata metadata = 3; // Extra state needed to construct a Ticl.
184 repeated ScheduledTask scheduled_task = 4; // Scheduled tasks.
187 // An AndroidTiclState state plus a digest; this is the protocol buffer actually
188 // stored persistently by the service.
189 message AndroidTiclStateWithDigest {
190 optional AndroidTiclState state = 1;
191 optional bytes digest = 2; // Digest of "state."