| OLD | NEW |
| (Empty) | |
| 1 /* |
| 2 * Copyright 2011 Google Inc. |
| 3 * |
| 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 |
| 7 * |
| 8 * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 * |
| 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. |
| 15 */ |
| 16 // |
| 17 // Specification of protocol buffers that are used with the Android |
| 18 // service. |
| 19 // |
| 20 // Note: unless otherwise specified in a comment, all fields in all messages |
| 21 // are required, even though they are listed as optional. |
| 22 |
| 23 syntax = "proto2"; |
| 24 |
| 25 package com.google.protos.ipc.invalidation; |
| 26 |
| 27 option optimize_for = LITE_RUNTIME; |
| 28 |
| 29 |
| 30 |
| 31 option java_outer_classname = "NanoAndroidService"; |
| 32 option java_package = "com.google.protos.ipc.invalidation"; |
| 33 |
| 34 |
| 35 |
| 36 import "client_protocol.proto"; |
| 37 import "java_client.proto"; |
| 38 |
| 39 // Call from application to Ticl. |
| 40 // |
| 41 // Android service messages are typically validated. Validation rules may be |
| 42 // declared in ClientProtoWrapperGenerator.java. |
| 43 |
| 44 message ClientDowncall { |
| 45 message StartDowncall {} |
| 46 message StopDowncall {} |
| 47 message AckDowncall { |
| 48 optional bytes ack_handle = 1; |
| 49 } |
| 50 message RegistrationDowncall { |
| 51 repeated ObjectIdP registrations = 1; |
| 52 repeated ObjectIdP unregistrations = 2; |
| 53 } |
| 54 |
| 55 // Serial number to prevent intent reordering. |
| 56 // TODO: use. |
| 57 optional int64 serial = 1; |
| 58 optional Version version = 2; |
| 59 |
| 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; |
| 65 } |
| 66 |
| 67 // Internal (non-public) call from application to Ticl. |
| 68 message InternalDowncall { |
| 69 message ServerMessage { |
| 70 optional bytes data = 1; |
| 71 } |
| 72 message NetworkStatus { |
| 73 optional bool is_online = 1; |
| 74 } |
| 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. |
| 79 |
| 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; |
| 83 } |
| 84 optional Version version = 1; |
| 85 |
| 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; |
| 91 } |
| 92 |
| 93 // Upcall from Ticl to application listener. |
| 94 |
| 95 message ListenerUpcall { |
| 96 message ReadyUpcall {} |
| 97 |
| 98 message InvalidateUpcall { |
| 99 // Required. |
| 100 optional bytes ack_handle = 1; |
| 101 |
| 102 // Exactly one must be set. |
| 103 optional InvalidationP invalidation = 2; |
| 104 optional ObjectIdP invalidate_unknown = 3; |
| 105 optional bool invalidate_all = 4; |
| 106 } |
| 107 |
| 108 message RegistrationStatusUpcall { |
| 109 optional ObjectIdP object_id = 1; |
| 110 optional bool is_registered = 2; |
| 111 } |
| 112 |
| 113 message RegistrationFailureUpcall { |
| 114 optional ObjectIdP object_id = 1; |
| 115 optional bool transient = 2; |
| 116 optional string message = 3; |
| 117 } |
| 118 |
| 119 message ReissueRegistrationsUpcall { |
| 120 optional bytes prefix = 1; |
| 121 optional int32 length = 2; |
| 122 } |
| 123 |
| 124 message ErrorUpcall { |
| 125 optional int32 error_code = 1; |
| 126 optional string error_message = 2; |
| 127 optional bool is_transient = 3; |
| 128 } |
| 129 |
| 130 // Serial number to prevent intent reordering. Not currently used. |
| 131 // TODO: use |
| 132 optional int64 serial = 1; |
| 133 optional Version version = 2; |
| 134 |
| 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; |
| 142 } |
| 143 |
| 144 // Internal proto used by the Android scheduler to represent an event to run. |
| 145 message AndroidSchedulerEvent { |
| 146 optional Version version = 1; |
| 147 |
| 148 // Name of the recurring task to execute. |
| 149 optional string event_name = 2; |
| 150 |
| 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; |
| 154 } |
| 155 |
| 156 // Internal proto used by the Android network to represent a message to send |
| 157 // to the data center from the client. |
| 158 message AndroidNetworkSendRequest { |
| 159 optional Version version = 1; // Required |
| 160 optional bytes message = 2; // Required |
| 161 } |
| 162 |
| 163 // Protocol buffer used to store state for a persisted Ticl. |
| 164 message AndroidTiclState { |
| 165 message Metadata { |
| 166 // All fields are required. |
| 167 optional int32 client_type = 1; // client type code. |
| 168 optional bytes client_name = 2; // application client id. |
| 169 optional int64 ticl_id = 3; // Ticl uniquifier. |
| 170 optional ClientConfigP client_config = 4; // client config. |
| 171 } |
| 172 optional Version version = 1; |
| 173 optional InvalidationClientState ticl_state = 2; // Marshalled Ticl. |
| 174 optional Metadata metadata = 3; // Extra state needed to construct a Ticl. |
| 175 } |
| 176 |
| 177 // An AndroidTiclState state plus a digest; this is the protocol buffer actually |
| 178 // stored persistently by the service. |
| 179 message AndroidTiclStateWithDigest { |
| 180 optional AndroidTiclState state = 1; |
| 181 optional bytes digest = 2; // Digest of "state." |
| 182 } |
| OLD | NEW |