xref: /aosp_15_r20/external/federated-compute/fcp/protos/federated_api.proto (revision 14675a029014e728ec732f129a32e299b2da0601)
1*14675a02SAndroid Build Coastguard Worker/*
2*14675a02SAndroid Build Coastguard Worker * Copyright 2019 Google LLC
3*14675a02SAndroid Build Coastguard Worker *
4*14675a02SAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License");
5*14675a02SAndroid Build Coastguard Worker * you may not use this file except in compliance with the License.
6*14675a02SAndroid Build Coastguard Worker * You may obtain a copy of the License at
7*14675a02SAndroid Build Coastguard Worker *
8*14675a02SAndroid Build Coastguard Worker *      http://www.apache.org/licenses/LICENSE-2.0
9*14675a02SAndroid Build Coastguard Worker *
10*14675a02SAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software
11*14675a02SAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS,
12*14675a02SAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*14675a02SAndroid Build Coastguard Worker * See the License for the specific language governing permissions and
14*14675a02SAndroid Build Coastguard Worker * limitations under the License.
15*14675a02SAndroid Build Coastguard Worker */
16*14675a02SAndroid Build Coastguard Worker
17*14675a02SAndroid Build Coastguard Workersyntax = "proto3";
18*14675a02SAndroid Build Coastguard Worker
19*14675a02SAndroid Build Coastguard Workerpackage google.internal.federatedml.v2;
20*14675a02SAndroid Build Coastguard Worker
21*14675a02SAndroid Build Coastguard Workerimport "google/protobuf/any.proto";
22*14675a02SAndroid Build Coastguard Workerimport "google/protobuf/duration.proto";
23*14675a02SAndroid Build Coastguard Workerimport "fcp/secagg/shared/secagg_messages.proto";
24*14675a02SAndroid Build Coastguard Worker
25*14675a02SAndroid Build Coastguard Workeroption java_package = "com.google.internal.federatedml.v2";
26*14675a02SAndroid Build Coastguard Workeroption java_multiple_files = true;
27*14675a02SAndroid Build Coastguard Workeroption java_outer_classname = "FederatedProto";
28*14675a02SAndroid Build Coastguard Worker
29*14675a02SAndroid Build Coastguard Worker// `FederatedTrainingApi` provides the protocol between a device and
30*14675a02SAndroid Build Coastguard Worker// cloud servers for federated computations.
31*14675a02SAndroid Build Coastguard Worker//
32*14675a02SAndroid Build Coastguard Worker// This API works as follows:
33*14675a02SAndroid Build Coastguard Worker//
34*14675a02SAndroid Build Coastguard Worker// 1. Clients are associated with *populations*. A population is
35*14675a02SAndroid Build Coastguard Worker//    uniquely identified by an opaque string which indicates the
36*14675a02SAndroid Build Coastguard Worker//    application together with additional information like a specific
37*14675a02SAndroid Build Coastguard Worker//    flavor within this application.
38*14675a02SAndroid Build Coastguard Worker//
39*14675a02SAndroid Build Coastguard Worker// 2. Periodically, clients issue an `EligibilityEvalCheckinRequest` to indicate
40*14675a02SAndroid Build Coastguard Worker//    they are interested in participating in a computation, followed by a
41*14675a02SAndroid Build Coastguard Worker//    `CheckinRequest` to actually be assigned one of the available
42*14675a02SAndroid Build Coastguard Worker//    computations they are compatible with. These requests specify the
43*14675a02SAndroid Build Coastguard Worker//    population for which the requests are issued.
44*14675a02SAndroid Build Coastguard Worker//
45*14675a02SAndroid Build Coastguard Worker// 3. The server decides whether the client shall participate in a computation,
46*14675a02SAndroid Build Coastguard Worker//    and if so returns the data (a computation description and a checkpoint)
47*14675a02SAndroid Build Coastguard Worker//    needed for the client to start executing the computation.
48*14675a02SAndroid Build Coastguard Worker//
49*14675a02SAndroid Build Coastguard Worker// 4. If the client is selected, it performs local execution. When done, the
50*14675a02SAndroid Build Coastguard Worker//    client issues a `ReportRequest`, specifying both population and phase id,
51*14675a02SAndroid Build Coastguard Worker//    and the updated checkpoint.
52*14675a02SAndroid Build Coastguard Workerservice FederatedTrainingApi {
53*14675a02SAndroid Build Coastguard Worker  // Initiates client-server communication session (bidirectional stream).
54*14675a02SAndroid Build Coastguard Worker  rpc Session(stream ClientStreamMessage) returns (stream ServerStreamMessage) {
55*14675a02SAndroid Build Coastguard Worker  }
56*14675a02SAndroid Build Coastguard Worker}
57*14675a02SAndroid Build Coastguard Worker
58*14675a02SAndroid Build Coastguard Worker// Message sent from a client to a server in a bidirectional stream.
59*14675a02SAndroid Build Coastguard Worker// The message is sent either directly or (for large messages when chunking
60*14675a02SAndroid Build Coastguard Worker// is supported) split into chunk encapsulated into smaller instances of
61*14675a02SAndroid Build Coastguard Worker// ClientStreamMessage.
62*14675a02SAndroid Build Coastguard Workermessage ClientStreamMessage {
63*14675a02SAndroid Build Coastguard Worker  // Different kinds of messages.
64*14675a02SAndroid Build Coastguard Worker  oneof kind {
65*14675a02SAndroid Build Coastguard Worker    // Checkin request.
66*14675a02SAndroid Build Coastguard Worker    CheckinRequest checkin_request = 1;
67*14675a02SAndroid Build Coastguard Worker
68*14675a02SAndroid Build Coastguard Worker    // Report request.
69*14675a02SAndroid Build Coastguard Worker    ReportRequest report_request = 2;
70*14675a02SAndroid Build Coastguard Worker
71*14675a02SAndroid Build Coastguard Worker    // Transfer of ClientStreamMessage in multiple chunks
72*14675a02SAndroid Build Coastguard Worker    ChunkedTransferMessage chunked_transfer = 6;
73*14675a02SAndroid Build Coastguard Worker
74*14675a02SAndroid Build Coastguard Worker    // Eligibility evaluation checkin request.
75*14675a02SAndroid Build Coastguard Worker    EligibilityEvalCheckinRequest eligibility_eval_checkin_request = 7;
76*14675a02SAndroid Build Coastguard Worker  }
77*14675a02SAndroid Build Coastguard Worker
78*14675a02SAndroid Build Coastguard Worker  // Secure Aggregation messages.  These form a parallel stream of
79*14675a02SAndroid Build Coastguard Worker  // messages, and so are outside the 'kind' oneof.
80*14675a02SAndroid Build Coastguard Worker  fcp.secagg.ClientToServerWrapperMessage secure_aggregation_client_message = 4;
81*14675a02SAndroid Build Coastguard Worker
82*14675a02SAndroid Build Coastguard Worker  repeated google.protobuf.Any serialized_side_channel_event = 5;
83*14675a02SAndroid Build Coastguard Worker
84*14675a02SAndroid Build Coastguard Worker  // Internal identifier of the connection to the client. This value isn't set
85*14675a02SAndroid Build Coastguard Worker  // by the device (ignored if set), but used by the server when forwarding
86*14675a02SAndroid Build Coastguard Worker  // requests internally within the system.
87*14675a02SAndroid Build Coastguard Worker  string internal_client_id = 3 [deprecated = true];
88*14675a02SAndroid Build Coastguard Worker}
89*14675a02SAndroid Build Coastguard Worker
90*14675a02SAndroid Build Coastguard Worker// Message sent from a server to a client in a bidirectional stream.
91*14675a02SAndroid Build Coastguard Worker// The message is sent either directly or (for large messages when chunking
92*14675a02SAndroid Build Coastguard Worker// is supported) split into chunks encapsulated into smaller instances of
93*14675a02SAndroid Build Coastguard Worker// ServerStreamMessage.
94*14675a02SAndroid Build Coastguard Workermessage ServerStreamMessage {
95*14675a02SAndroid Build Coastguard Worker  // Different kinds of messages.
96*14675a02SAndroid Build Coastguard Worker  oneof kind {
97*14675a02SAndroid Build Coastguard Worker    // Checkin response.
98*14675a02SAndroid Build Coastguard Worker    CheckinResponse checkin_response = 1;
99*14675a02SAndroid Build Coastguard Worker
100*14675a02SAndroid Build Coastguard Worker    // Report response.
101*14675a02SAndroid Build Coastguard Worker    ReportResponse report_response = 2;
102*14675a02SAndroid Build Coastguard Worker
103*14675a02SAndroid Build Coastguard Worker    // Transfer of ServerStreamMessage in multiple chunks
104*14675a02SAndroid Build Coastguard Worker    ChunkedTransferMessage chunked_transfer = 4;
105*14675a02SAndroid Build Coastguard Worker
106*14675a02SAndroid Build Coastguard Worker    // Ack of a CheckinRequest or an EligibilityEvalCheckinRequest. See {@link
107*14675a02SAndroid Build Coastguard Worker    // CheckinRequest} for details.
108*14675a02SAndroid Build Coastguard Worker    CheckinRequestAck checkin_request_ack = 5;
109*14675a02SAndroid Build Coastguard Worker
110*14675a02SAndroid Build Coastguard Worker    // Eligibility evaluation checkin response.
111*14675a02SAndroid Build Coastguard Worker    EligibilityEvalCheckinResponse eligibility_eval_checkin_response = 6;
112*14675a02SAndroid Build Coastguard Worker
113*14675a02SAndroid Build Coastguard Worker    // This is expected to be extended in upcoming versions of the protocol
114*14675a02SAndroid Build Coastguard Worker  }
115*14675a02SAndroid Build Coastguard Worker
116*14675a02SAndroid Build Coastguard Worker  // Secure Aggregation messages.  These form a parallel stream of
117*14675a02SAndroid Build Coastguard Worker  // messages, and so are outside the 'kind' oneof.
118*14675a02SAndroid Build Coastguard Worker  fcp.secagg.ServerToClientWrapperMessage secure_aggregation_server_message = 3;
119*14675a02SAndroid Build Coastguard Worker}
120*14675a02SAndroid Build Coastguard Worker
121*14675a02SAndroid Build Coastguard Worker// Supported levels of compression for chunked blob transfer.
122*14675a02SAndroid Build Coastguard Workerenum CompressionLevel {
123*14675a02SAndroid Build Coastguard Worker  // Compression disabled
124*14675a02SAndroid Build Coastguard Worker  UNCOMPRESSED = 0;
125*14675a02SAndroid Build Coastguard Worker  // zlib compression with default settings; this level uses gzip-6
126*14675a02SAndroid Build Coastguard Worker  // (currently).
127*14675a02SAndroid Build Coastguard Worker  // 'Z_DEFAULT_COMPRESSION requests a default compromise between speed and
128*14675a02SAndroid Build Coastguard Worker  // compression (currently equivalent to level 6).'
129*14675a02SAndroid Build Coastguard Worker  // Source - // http://www.zlib.net/manual.html
130*14675a02SAndroid Build Coastguard Worker  ZLIB_DEFAULT = 1;
131*14675a02SAndroid Build Coastguard Worker  // zlib compression optimized for most compression; this level uses gzip-9.
132*14675a02SAndroid Build Coastguard Worker  // '9 gives best compression' Source - http://www.zlib.net/manual.html
133*14675a02SAndroid Build Coastguard Worker  ZLIB_BEST_COMPRESSION = 2;
134*14675a02SAndroid Build Coastguard Worker  // zlib compression optimized for speed; this level uses gzip-1.
135*14675a02SAndroid Build Coastguard Worker  // '1 gives best speed' Source - http://www.zlib.net/manual.html
136*14675a02SAndroid Build Coastguard Worker  ZLIB_BEST_SPEED = 3;
137*14675a02SAndroid Build Coastguard Worker}
138*14675a02SAndroid Build Coastguard Worker
139*14675a02SAndroid Build Coastguard Worker// Supported compressed file formats for HTTP downloads.
140*14675a02SAndroid Build Coastguard Workerenum HttpCompressionFormat {
141*14675a02SAndroid Build Coastguard Worker  HTTP_COMPRESSION_FORMAT_UNSPECIFIED = 0;
142*14675a02SAndroid Build Coastguard Worker  // Gzip-compressed data. If data is compressed in this way, then the
143*14675a02SAndroid Build Coastguard Worker  // "Content-Type" HTTP response header will have a "+gzip" suffix.
144*14675a02SAndroid Build Coastguard Worker  HTTP_COMPRESSION_FORMAT_GZIP = 1;
145*14675a02SAndroid Build Coastguard Worker}
146*14675a02SAndroid Build Coastguard Worker
147*14675a02SAndroid Build Coastguard Worker// A request, sent by the device to check if it should participate
148*14675a02SAndroid Build Coastguard Worker// in the current phase.
149*14675a02SAndroid Build Coastguard Workermessage CheckinRequest {
150*14675a02SAndroid Build Coastguard Worker  // The name of the population this client belongs to.
151*14675a02SAndroid Build Coastguard Worker  string population_name = 1;
152*14675a02SAndroid Build Coastguard Worker
153*14675a02SAndroid Build Coastguard Worker  // Optional. Retry token (opaque to the client) passed by the server when last
154*14675a02SAndroid Build Coastguard Worker  // participated in the training or rejected. If clients have such a token
155*14675a02SAndroid Build Coastguard Worker  // available, they should provide it. If not, things are still expected to
156*14675a02SAndroid Build Coastguard Worker  // work, but providing this gives server better control on organizing
157*14675a02SAndroid Build Coastguard Worker  // participation.
158*14675a02SAndroid Build Coastguard Worker  //
159*14675a02SAndroid Build Coastguard Worker  // Note that an `EligibilityEvalCheckinRequest` and its subsequent
160*14675a02SAndroid Build Coastguard Worker  // `CheckinRequest` request will both use the same value for this field,
161*14675a02SAndroid Build Coastguard Worker  // since both requests are considered part of the same logical protocol
162*14675a02SAndroid Build Coastguard Worker  // session.
163*14675a02SAndroid Build Coastguard Worker  string retry_token = 2;
164*14675a02SAndroid Build Coastguard Worker
165*14675a02SAndroid Build Coastguard Worker  reserved 3;
166*14675a02SAndroid Build Coastguard Worker
167*14675a02SAndroid Build Coastguard Worker  // The attestation measurement providing evidence of integrity for this
168*14675a02SAndroid Build Coastguard Worker  // client. The measurement is bound to the population_name and retry_token
169*14675a02SAndroid Build Coastguard Worker  // values in this CheckinRequest.
170*14675a02SAndroid Build Coastguard Worker  //
171*14675a02SAndroid Build Coastguard Worker  // Note that an `EligibilityEvalCheckinRequest` and its subsequent
172*14675a02SAndroid Build Coastguard Worker  // `CheckinRequest` request will both use the same value for this field,
173*14675a02SAndroid Build Coastguard Worker  // since both requests are considered part of the same logical protocol
174*14675a02SAndroid Build Coastguard Worker  // session.
175*14675a02SAndroid Build Coastguard Worker  string attestation_measurement = 4;
176*14675a02SAndroid Build Coastguard Worker
177*14675a02SAndroid Build Coastguard Worker  // Protocol options supported by the client.
178*14675a02SAndroid Build Coastguard Worker  ProtocolOptionsRequest protocol_options_request = 5;
179*14675a02SAndroid Build Coastguard Worker
180*14675a02SAndroid Build Coastguard Worker  string client_version = 6 ;
181*14675a02SAndroid Build Coastguard Worker
182*14675a02SAndroid Build Coastguard Worker  // The client computes this message using the plan returned by a previous
183*14675a02SAndroid Build Coastguard Worker  // `EligibilityEvalCheckinResponse`.
184*14675a02SAndroid Build Coastguard Worker  //
185*14675a02SAndroid Build Coastguard Worker  // If this field is set, it describes to the server which tasks the client is
186*14675a02SAndroid Build Coastguard Worker  // (in)eligible. The server must take this information into account when
187*14675a02SAndroid Build Coastguard Worker  // deciding task to serve in response to this request.
188*14675a02SAndroid Build Coastguard Worker  //
189*14675a02SAndroid Build Coastguard Worker  // If this field is unset, it may indicate that the client previously received
190*14675a02SAndroid Build Coastguard Worker  // an `EligibilityEvalCheckinResponse` without an
191*14675a02SAndroid Build Coastguard Worker  // `EligibilityEvalPayload` message (i.e. the population did not
192*14675a02SAndroid Build Coastguard Worker  // have an eligibility-computing task configured at the time of the request).
193*14675a02SAndroid Build Coastguard Worker  // It may also indicate a client for which the eligibility-computing task
194*14675a02SAndroid Build Coastguard Worker  // feature has been disabled, or an old client that does not support this
195*14675a02SAndroid Build Coastguard Worker  // feature yet.
196*14675a02SAndroid Build Coastguard Worker  //
197*14675a02SAndroid Build Coastguard Worker  // If this field is unset but the population has an eligibility-computing task
198*14675a02SAndroid Build Coastguard Worker  // configured, then the server must reject this client, since the server has
199*14675a02SAndroid Build Coastguard Worker  // no way to determine which tasks the client is (in)eligible for.
200*14675a02SAndroid Build Coastguard Worker  //
201*14675a02SAndroid Build Coastguard Worker  // If this field is unset and the population does not have an
202*14675a02SAndroid Build Coastguard Worker  // eligibility-computing task configured, then the server may serve this
203*14675a02SAndroid Build Coastguard Worker  // client any task.
204*14675a02SAndroid Build Coastguard Worker  //
205*14675a02SAndroid Build Coastguard Worker  TaskEligibilityInfo task_eligibility_info = 7;
206*14675a02SAndroid Build Coastguard Worker}
207*14675a02SAndroid Build Coastguard Worker
208*14675a02SAndroid Build Coastguard Worker// Describes to the server which tasks a client is eligible for.
209*14675a02SAndroid Build Coastguard Workermessage TaskEligibilityInfo {
210*14675a02SAndroid Build Coastguard Worker  // A semantic version describing how the set of eligibility descriptors should
211*14675a02SAndroid Build Coastguard Worker  // be interpreted. This fields enables assigning different semantics for how
212*14675a02SAndroid Build Coastguard Worker  // the server should interpret the descriptors, without having to change the
213*14675a02SAndroid Build Coastguard Worker  // wire format (e.g. different ways of interpreting `TaskWeight.weight`).
214*14675a02SAndroid Build Coastguard Worker  int64 version = 1;
215*14675a02SAndroid Build Coastguard Worker
216*14675a02SAndroid Build Coastguard Worker  // A list of task weights, which the server may use when assigning the client
217*14675a02SAndroid Build Coastguard Worker  // a task in response to the current request.
218*14675a02SAndroid Build Coastguard Worker  //
219*14675a02SAndroid Build Coastguard Worker  // If none of the `TaskWeight` messages match a given task, then the client
220*14675a02SAndroid Build Coastguard Worker  // must be considered ineligible for that task, and the server must not serve
221*14675a02SAndroid Build Coastguard Worker  // the client that task.
222*14675a02SAndroid Build Coastguard Worker  //
223*14675a02SAndroid Build Coastguard Worker  // Therefore, if a `TaskEligibilityInfo` message is provided but this field is
224*14675a02SAndroid Build Coastguard Worker  // empty then the client should be considered ineligible for all tasks in the
225*14675a02SAndroid Build Coastguard Worker  // population (although in practice the client will simply close the
226*14675a02SAndroid Build Coastguard Worker  // connection in that case, rather than issue a `CheckinRequest` with such an
227*14675a02SAndroid Build Coastguard Worker  // empty list of weights).
228*14675a02SAndroid Build Coastguard Worker  repeated TaskWeight task_weights = 2;
229*14675a02SAndroid Build Coastguard Worker}
230*14675a02SAndroid Build Coastguard Worker
231*14675a02SAndroid Build Coastguard Worker// Describes a weight that should be assigned to a specific task.
232*14675a02SAndroid Build Coastguard Workermessage TaskWeight {
233*14675a02SAndroid Build Coastguard Worker  // Name of the task this weight applies to.
234*14675a02SAndroid Build Coastguard Worker  string task_name = 1;
235*14675a02SAndroid Build Coastguard Worker
236*14675a02SAndroid Build Coastguard Worker  // The weight that should be applied to the specified task.
237*14675a02SAndroid Build Coastguard Worker  //
238*14675a02SAndroid Build Coastguard Worker  // Must be >0.
239*14675a02SAndroid Build Coastguard Worker  //
240*14675a02SAndroid Build Coastguard Worker  // This weight may (or may not) be used by the server to implement some form
241*14675a02SAndroid Build Coastguard Worker  // of task or client prioritization.
242*14675a02SAndroid Build Coastguard Worker  float weight = 2;
243*14675a02SAndroid Build Coastguard Worker}
244*14675a02SAndroid Build Coastguard Worker
245*14675a02SAndroid Build Coastguard Worker// Response to the checkin request, sent to the device.
246*14675a02SAndroid Build Coastguard Workermessage CheckinResponse {
247*14675a02SAndroid Build Coastguard Worker  // One of two outcomes, depending on server's decision on participation of the
248*14675a02SAndroid Build Coastguard Worker  // client.
249*14675a02SAndroid Build Coastguard Worker  oneof checkin_result {
250*14675a02SAndroid Build Coastguard Worker    // If the client joined the phase with this call, information how
251*14675a02SAndroid Build Coastguard Worker    // to proceed.
252*14675a02SAndroid Build Coastguard Worker    AcceptanceInfo acceptance_info = 1;
253*14675a02SAndroid Build Coastguard Worker
254*14675a02SAndroid Build Coastguard Worker    // If the client was not accepted, information how to proceed.
255*14675a02SAndroid Build Coastguard Worker    RejectionInfo rejection_info = 2;
256*14675a02SAndroid Build Coastguard Worker  }
257*14675a02SAndroid Build Coastguard Worker
258*14675a02SAndroid Build Coastguard Worker  // Instructions from server to the client how to execute protocol.
259*14675a02SAndroid Build Coastguard Worker  // While, conceptually, chunked transfer is a symmetric protocol with respect
260*14675a02SAndroid Build Coastguard Worker  // to peers (both server and client act like senders and receivers), the
261*14675a02SAndroid Build Coastguard Worker  // protocol handshake and configuration part is intentionally skewed towards
262*14675a02SAndroid Build Coastguard Worker  // the server driving the decisions on how chunking are performed on the wire,
263*14675a02SAndroid Build Coastguard Worker  // so we have a centralized way of controlling the feature.
264*14675a02SAndroid Build Coastguard Worker  //
265*14675a02SAndroid Build Coastguard Worker  // Note that if a client receives more than one `ProtocolOptionsResponse` over
266*14675a02SAndroid Build Coastguard Worker  // the life of a protocol session (e.g. in
267*14675a02SAndroid Build Coastguard Worker  // `EligibilityEvalCheckinResponse` as well as `CheckinResponse`)
268*14675a02SAndroid Build Coastguard Worker  // then the client will use the most recently-received value for further
269*14675a02SAndroid Build Coastguard Worker  // communications with the server.
270*14675a02SAndroid Build Coastguard Worker  ProtocolOptionsResponse protocol_options_response = 4;
271*14675a02SAndroid Build Coastguard Worker
272*14675a02SAndroid Build Coastguard Worker  reserved 3;
273*14675a02SAndroid Build Coastguard Worker}
274*14675a02SAndroid Build Coastguard Worker
275*14675a02SAndroid Build Coastguard Worker// Acknowledgement for a `CheckinRequest` or an `EligibilityEvalCheckinRequest`
276*14675a02SAndroid Build Coastguard Worker// from the client. This happens almost instantenously for all clients (that
277*14675a02SAndroid Build Coastguard Worker// request an ack using ProtocolRequestOptions#should_ack_checkin) as soon as
278*14675a02SAndroid Build Coastguard Worker// they issue either request, and happens *before* either a `CheckinResponse`
279*14675a02SAndroid Build Coastguard Worker// or a `EligibilityEvalCheckinResponse` is returned to the client.
280*14675a02SAndroid Build Coastguard Workermessage CheckinRequestAck {
281*14675a02SAndroid Build Coastguard Worker  // Retry window to use for the next checkin attempt if this attempt ends up
282*14675a02SAndroid Build Coastguard Worker  // being subsequently accepted by the server, as in the client received a
283*14675a02SAndroid Build Coastguard Worker  // CheckinResponse with an AcceptanceInfo.
284*14675a02SAndroid Build Coastguard Worker  RetryWindow retry_window_if_accepted = 1;
285*14675a02SAndroid Build Coastguard Worker
286*14675a02SAndroid Build Coastguard Worker  // Retry window to use if this checkin attempt is not accepted by the server,
287*14675a02SAndroid Build Coastguard Worker  // as in the client doesn't receive a CheckinResponse with an AcceptanceInfo.
288*14675a02SAndroid Build Coastguard Worker  RetryWindow retry_window_if_rejected = 2;
289*14675a02SAndroid Build Coastguard Worker}
290*14675a02SAndroid Build Coastguard Worker
291*14675a02SAndroid Build Coastguard Worker// A request, sent by the device to request the eligibility-computing plan for
292*14675a02SAndroid Build Coastguard Worker// the population. This plan is run by the client to generate a
293*14675a02SAndroid Build Coastguard Worker// `TaskEligibilityInfo` proto result, which is then included with a subsequent
294*14675a02SAndroid Build Coastguard Worker// `CheckinRequest` (within the same protocol session) to inform the server
295*14675a02SAndroid Build Coastguard Worker// which tasks the client is eligible for.
296*14675a02SAndroid Build Coastguard Worker//
297*14675a02SAndroid Build Coastguard Worker// The use of an `EligibilityEvalCheckinRequest` is optional (i.e. clients
298*14675a02SAndroid Build Coastguard Worker// may simply issue a `CheckinRequest` without a preceding
299*14675a02SAndroid Build Coastguard Worker// `EligibilityEvalCheckinRequest`, in which case the
300*14675a02SAndroid Build Coastguard Worker// `CheckinRequest.task_eligibility_info` field will be left unset).
301*14675a02SAndroid Build Coastguard Workermessage EligibilityEvalCheckinRequest {
302*14675a02SAndroid Build Coastguard Worker  // The name of the population this client belongs to.
303*14675a02SAndroid Build Coastguard Worker  string population_name = 1;
304*14675a02SAndroid Build Coastguard Worker
305*14675a02SAndroid Build Coastguard Worker  // Optional. This field has the same semantics as
306*14675a02SAndroid Build Coastguard Worker  // `CheckinRequest.retry_token`, see that field for details.
307*14675a02SAndroid Build Coastguard Worker  string retry_token = 2;
308*14675a02SAndroid Build Coastguard Worker
309*14675a02SAndroid Build Coastguard Worker  // This field has the same semantics as
310*14675a02SAndroid Build Coastguard Worker  // `CheckinRequest.attestation_measurement`.
311*14675a02SAndroid Build Coastguard Worker  // See that field for details.
312*14675a02SAndroid Build Coastguard Worker  string attestation_measurement = 4;
313*14675a02SAndroid Build Coastguard Worker
314*14675a02SAndroid Build Coastguard Worker  // Protocol options supported by the client.
315*14675a02SAndroid Build Coastguard Worker  ProtocolOptionsRequest protocol_options_request = 5;
316*14675a02SAndroid Build Coastguard Worker
317*14675a02SAndroid Build Coastguard Worker  // This field has the same semantics as `CheckinRequest.client_version`. See
318*14675a02SAndroid Build Coastguard Worker  // that field for details.
319*14675a02SAndroid Build Coastguard Worker  string client_version = 6 ;
320*14675a02SAndroid Build Coastguard Worker
321*14675a02SAndroid Build Coastguard Worker  // The client's capabilities when downloading and running Eligibility Eval
322*14675a02SAndroid Build Coastguard Worker  // tasks.
323*14675a02SAndroid Build Coastguard Worker  EligibilityEvalTaskCapabilities eligibility_eval_task_capabilities = 7;
324*14675a02SAndroid Build Coastguard Worker}
325*14675a02SAndroid Build Coastguard Worker
326*14675a02SAndroid Build Coastguard Worker// The client's capabilities for determining task eligibility.
327*14675a02SAndroid Build Coastguard Workermessage EligibilityEvalTaskCapabilities {
328*14675a02SAndroid Build Coastguard Worker  // Whether the client supports multiple task assignment
329*14675a02SAndroid Build Coastguard Worker  // (/TaskAssignments.PerformMultipleTaskAssignments). If false, the client
330*14675a02SAndroid Build Coastguard Worker  // will not be provided information about tasks that require multiple task
331*14675a02SAndroid Build Coastguard Worker  // assignment.
332*14675a02SAndroid Build Coastguard Worker  bool supports_multiple_task_assignment = 1;
333*14675a02SAndroid Build Coastguard Worker}
334*14675a02SAndroid Build Coastguard Worker
335*14675a02SAndroid Build Coastguard Worker// Response to the `EligibilityEvalCheckinRequest`, sent to the
336*14675a02SAndroid Build Coastguard Worker// device.
337*14675a02SAndroid Build Coastguard Workermessage EligibilityEvalCheckinResponse {
338*14675a02SAndroid Build Coastguard Worker  // Each response will contain one of the following results.
339*14675a02SAndroid Build Coastguard Worker  oneof checkin_result {
340*14675a02SAndroid Build Coastguard Worker    // If the population has an eligibility-computing plan configured, and if
341*14675a02SAndroid Build Coastguard Worker    // the client is compatible with that plan, then this field will be set,
342*14675a02SAndroid Build Coastguard Worker    // containing the plan's payload. The client should run the plan and include
343*14675a02SAndroid Build Coastguard Worker    // its `TaskEligibilityInfo` result in the subsequent `CheckinRequest`.
344*14675a02SAndroid Build Coastguard Worker    EligibilityEvalPayload eligibility_eval_payload = 1;
345*14675a02SAndroid Build Coastguard Worker
346*14675a02SAndroid Build Coastguard Worker    // If the population does not have an eligibility-computing plan configured,
347*14675a02SAndroid Build Coastguard Worker    // then this field will be set. The client should continue by issuing a
348*14675a02SAndroid Build Coastguard Worker    // `CheckinRequest` without the `task_eligibility_info` field set.
349*14675a02SAndroid Build Coastguard Worker    NoEligibilityEvalConfigured no_eligibility_eval_configured = 2;
350*14675a02SAndroid Build Coastguard Worker
351*14675a02SAndroid Build Coastguard Worker    // If the population has an eligibility-computing plan configured, but the
352*14675a02SAndroid Build Coastguard Worker    // client is incompatible with that plan, then this field will be set.
353*14675a02SAndroid Build Coastguard Worker    RejectionInfo rejection_info = 3;
354*14675a02SAndroid Build Coastguard Worker  }
355*14675a02SAndroid Build Coastguard Worker
356*14675a02SAndroid Build Coastguard Worker  // This field has the same semantics as
357*14675a02SAndroid Build Coastguard Worker  // `CheckinResponse.protocol_options_response`. See that field for details.
358*14675a02SAndroid Build Coastguard Worker  ProtocolOptionsResponse protocol_options_response = 4;
359*14675a02SAndroid Build Coastguard Worker}
360*14675a02SAndroid Build Coastguard Worker
361*14675a02SAndroid Build Coastguard Worker// Contains the eligibility evaluation plan payload.
362*14675a02SAndroid Build Coastguard Workermessage EligibilityEvalPayload {
363*14675a02SAndroid Build Coastguard Worker  oneof init_checkpoint_type {
364*14675a02SAndroid Build Coastguard Worker    // A blob representing the checkpoint to start execution from.
365*14675a02SAndroid Build Coastguard Worker    bytes init_checkpoint = 1;
366*14675a02SAndroid Build Coastguard Worker
367*14675a02SAndroid Build Coastguard Worker    // A URI and other metadata of the checkpoint to start execution from.
368*14675a02SAndroid Build Coastguard Worker    UriResource init_checkpoint_resource = 4;
369*14675a02SAndroid Build Coastguard Worker  }
370*14675a02SAndroid Build Coastguard Worker
371*14675a02SAndroid Build Coastguard Worker  oneof plan_type {
372*14675a02SAndroid Build Coastguard Worker    // A blob representing the plan to be used for execution.
373*14675a02SAndroid Build Coastguard Worker    bytes plan = 2;
374*14675a02SAndroid Build Coastguard Worker
375*14675a02SAndroid Build Coastguard Worker    // A URI and other metadata of the plan to be used for execution.
376*14675a02SAndroid Build Coastguard Worker    UriResource plan_resource = 5;
377*14675a02SAndroid Build Coastguard Worker  }
378*14675a02SAndroid Build Coastguard Worker
379*14675a02SAndroid Build Coastguard Worker  oneof population_eligibility_spec_type {
380*14675a02SAndroid Build Coastguard Worker    // A serialized PopulationEligibilitySpec describing the eligibility
381*14675a02SAndroid Build Coastguard Worker    // criteria for tasks in the population.
382*14675a02SAndroid Build Coastguard Worker    bytes population_eligibility_spec = 6;
383*14675a02SAndroid Build Coastguard Worker
384*14675a02SAndroid Build Coastguard Worker    // A URI and other metadata of the population eligibility spec to be used.
385*14675a02SAndroid Build Coastguard Worker    UriResource population_eligibility_spec_resource = 7;
386*14675a02SAndroid Build Coastguard Worker  }
387*14675a02SAndroid Build Coastguard Worker
388*14675a02SAndroid Build Coastguard Worker  // The opaque id of the eligibility evaluation plan payload the client is
389*14675a02SAndroid Build Coastguard Worker  // being given. This is a string generated by the server and used by the
390*14675a02SAndroid Build Coastguard Worker  // client for logging purposes. This id MUST NOT contain any information that
391*14675a02SAndroid Build Coastguard Worker  // could be used to identify a specific device.
392*14675a02SAndroid Build Coastguard Worker  // Also see the similar `AcceptanceInfo.execution_phase_id`.
393*14675a02SAndroid Build Coastguard Worker  string execution_id = 3;
394*14675a02SAndroid Build Coastguard Worker}
395*14675a02SAndroid Build Coastguard Worker
396*14675a02SAndroid Build Coastguard Worker// Currently-empty message describing the case where a population does not have
397*14675a02SAndroid Build Coastguard Worker// an eligibility-computing plan configured.
398*14675a02SAndroid Build Coastguard Workermessage NoEligibilityEvalConfigured {}
399*14675a02SAndroid Build Coastguard Worker
400*14675a02SAndroid Build Coastguard Worker// Per-aggregand dynamic configuration information for side channel protocols.
401*14675a02SAndroid Build Coastguard Workermessage SideChannelExecutionInfo {
402*14675a02SAndroid Build Coastguard Worker  // Dynamic configuration for SecureAggregation side channels.
403*14675a02SAndroid Build Coastguard Worker  message SecureAggregandExecutionInfo {
404*14675a02SAndroid Build Coastguard Worker    // Bitwidth for secure-aggregation.  This must be wide enough to
405*14675a02SAndroid Build Coastguard Worker    // encode the sum of all client inputs, given the current number of clients
406*14675a02SAndroid Build Coastguard Worker    // participating in the protocol.
407*14675a02SAndroid Build Coastguard Worker    //
408*14675a02SAndroid Build Coastguard Worker    // This field is deprecated; use modulus instead.
409*14675a02SAndroid Build Coastguard Worker    int32 output_bitwidth = 1 [deprecated = true];
410*14675a02SAndroid Build Coastguard Worker
411*14675a02SAndroid Build Coastguard Worker    // Modulus for secure aggregation.
412*14675a02SAndroid Build Coastguard Worker    //
413*14675a02SAndroid Build Coastguard Worker    // The secure aggregation protocol will compute the sum modulo this modulus.
414*14675a02SAndroid Build Coastguard Worker    //
415*14675a02SAndroid Build Coastguard Worker    // To achieve equivalence with non-modular summation, the modulus must be
416*14675a02SAndroid Build Coastguard Worker    // larger than the sum of all client inputs, given the number of clients
417*14675a02SAndroid Build Coastguard Worker    // participating in the aggregation shard.
418*14675a02SAndroid Build Coastguard Worker    //
419*14675a02SAndroid Build Coastguard Worker    // If modulus is missing but output_bitwidth is specified, modulus will
420*14675a02SAndroid Build Coastguard Worker    // will be taken to be 2**output_bitwidth (for backwards compatibility).
421*14675a02SAndroid Build Coastguard Worker    uint64 modulus = 2;
422*14675a02SAndroid Build Coastguard Worker  }
423*14675a02SAndroid Build Coastguard Worker
424*14675a02SAndroid Build Coastguard Worker  // What type of side channel is used.
425*14675a02SAndroid Build Coastguard Worker  oneof type {
426*14675a02SAndroid Build Coastguard Worker    // Dynamic configuration for Secure Aggregation side channels.
427*14675a02SAndroid Build Coastguard Worker    SecureAggregandExecutionInfo secure_aggregand = 1;
428*14675a02SAndroid Build Coastguard Worker  }
429*14675a02SAndroid Build Coastguard Worker}
430*14675a02SAndroid Build Coastguard Worker
431*14675a02SAndroid Build Coastguard Worker// Per-protocol options information for side channel protocols.
432*14675a02SAndroid Build Coastguard Workermessage SideChannelProtocolOptionsRequest {
433*14675a02SAndroid Build Coastguard Worker  // Options for SecureAggregation side channels.
434*14675a02SAndroid Build Coastguard Worker  message SecureAggregation {
435*14675a02SAndroid Build Coastguard Worker    // Protocol versions available.
436*14675a02SAndroid Build Coastguard Worker    repeated fcp.secagg.ClientVariant client_variant = 2;
437*14675a02SAndroid Build Coastguard Worker  }
438*14675a02SAndroid Build Coastguard Worker
439*14675a02SAndroid Build Coastguard Worker  // Protocol options for Secure Aggregation side channels.
440*14675a02SAndroid Build Coastguard Worker  SecureAggregation secure_aggregation = 1;
441*14675a02SAndroid Build Coastguard Worker}
442*14675a02SAndroid Build Coastguard Worker
443*14675a02SAndroid Build Coastguard Worker// Negotiated settings for side channel protocols. Side channel options may not
444*14675a02SAndroid Build Coastguard Worker// be set for channels which will not be used in the ReportRequest.
445*14675a02SAndroid Build Coastguard Workermessage SideChannelProtocolOptionsResponse {
446*14675a02SAndroid Build Coastguard Worker  // Server-directed secure aggregation options to apply.
447*14675a02SAndroid Build Coastguard Worker  message SecureAggregation {
448*14675a02SAndroid Build Coastguard Worker    // The client variant to use.
449*14675a02SAndroid Build Coastguard Worker    fcp.secagg.ClientVariant client_variant = 1;
450*14675a02SAndroid Build Coastguard Worker  }
451*14675a02SAndroid Build Coastguard Worker
452*14675a02SAndroid Build Coastguard Worker  // SecureAggregation protocol options.  Only set if a SecureAggregation plan
453*14675a02SAndroid Build Coastguard Worker  // will be used.
454*14675a02SAndroid Build Coastguard Worker  SecureAggregation secure_aggregation = 1;
455*14675a02SAndroid Build Coastguard Worker}
456*14675a02SAndroid Build Coastguard Worker
457*14675a02SAndroid Build Coastguard Worker// Per-protocol dynamic configuration information for side channel protocols.
458*14675a02SAndroid Build Coastguard Workermessage SideChannelProtocolExecutionInfo {
459*14675a02SAndroid Build Coastguard Worker  // Dynamic configuration for SecureAggregation side channels.
460*14675a02SAndroid Build Coastguard Worker  message SecureAggregationProtocolExecutionInfo {
461*14675a02SAndroid Build Coastguard Worker    // Number of clients that a client may exchange data with while running
462*14675a02SAndroid Build Coastguard Worker    // Secure Aggregation protocol. In the case of a full graph SecAgg protocol
463*14675a02SAndroid Build Coastguard Worker    // this is a total number of clients that started the protocol.
464*14675a02SAndroid Build Coastguard Worker    // In the case of subgraph SecAgg protocol this is a number of neighbours
465*14675a02SAndroid Build Coastguard Worker    // that each client has.
466*14675a02SAndroid Build Coastguard Worker    int32 expected_number_of_clients = 1;
467*14675a02SAndroid Build Coastguard Worker
468*14675a02SAndroid Build Coastguard Worker    // Secure Aggregation client completion threshold. This is a parameter
469*14675a02SAndroid Build Coastguard Worker    // communicated by the server side of Secure Aggregation protocol to each
470*14675a02SAndroid Build Coastguard Worker    // client to establish Shamir sharing of secrets.
471*14675a02SAndroid Build Coastguard Worker    // Additionally, at least `minimum_surviving_clients_for_reconstruction` out
472*14675a02SAndroid Build Coastguard Worker    // of the initial `expected_number_of_clients` must 'survive' in order for
473*14675a02SAndroid Build Coastguard Worker    // the protocol to continue on the client side; otherwise the client will
474*14675a02SAndroid Build Coastguard Worker    // abort its connection.
475*14675a02SAndroid Build Coastguard Worker    int32 minimum_surviving_clients_for_reconstruction = 2;
476*14675a02SAndroid Build Coastguard Worker
477*14675a02SAndroid Build Coastguard Worker    // The minimum number of clients' values that must be aggregated together
478*14675a02SAndroid Build Coastguard Worker    // before the server can gain access to the aggregate,
479*14675a02SAndroid Build Coastguard Worker    // even transiently (e.g. in RAM).
480*14675a02SAndroid Build Coastguard Worker    // This isn't needed by Secure Aggregation protocol on the client side but
481*14675a02SAndroid Build Coastguard Worker    // shared by the server with clients for transparency or policy reasons.
482*14675a02SAndroid Build Coastguard Worker    int32 minimum_clients_in_server_visible_aggregate = 3;
483*14675a02SAndroid Build Coastguard Worker  }
484*14675a02SAndroid Build Coastguard Worker
485*14675a02SAndroid Build Coastguard Worker  // Dynamic configuration for Secure Aggregation side channels.
486*14675a02SAndroid Build Coastguard Worker  SecureAggregationProtocolExecutionInfo secure_aggregation = 1;
487*14675a02SAndroid Build Coastguard Worker}
488*14675a02SAndroid Build Coastguard Worker
489*14675a02SAndroid Build Coastguard Worker// When client (device) supports HTTP download of resources, this message
490*14675a02SAndroid Build Coastguard Worker// is used to carry information about each individual downloadable resource.
491*14675a02SAndroid Build Coastguard Workermessage UriResource {
492*14675a02SAndroid Build Coastguard Worker  // Resource URI e.g. fully qualified URL.
493*14675a02SAndroid Build Coastguard Worker  string uri = 1;
494*14675a02SAndroid Build Coastguard Worker
495*14675a02SAndroid Build Coastguard Worker  // Stable identifier for this resource, used by the client cache
496*14675a02SAndroid Build Coastguard Worker  // implementation. If this field is not set, the client should not attempt to
497*14675a02SAndroid Build Coastguard Worker  // cache the resource referenced by `uri`.
498*14675a02SAndroid Build Coastguard Worker  string client_cache_id = 2;
499*14675a02SAndroid Build Coastguard Worker
500*14675a02SAndroid Build Coastguard Worker  // The maximum duration for how long the resource should be cached by the
501*14675a02SAndroid Build Coastguard Worker  // client. Not set if `client_cache_id` is not set.
502*14675a02SAndroid Build Coastguard Worker  google.protobuf.Duration max_age = 3;
503*14675a02SAndroid Build Coastguard Worker}
504*14675a02SAndroid Build Coastguard Worker
505*14675a02SAndroid Build Coastguard Worker// When client (device) is accepted for the current phase, this
506*14675a02SAndroid Build Coastguard Worker// data structure carries information necessary to begin training.
507*14675a02SAndroid Build Coastguard Workermessage AcceptanceInfo {
508*14675a02SAndroid Build Coastguard Worker  // The opaque id of the phase the client has joined. This is a string
509*14675a02SAndroid Build Coastguard Worker  // generated by the server and used by the client for logging purposes.
510*14675a02SAndroid Build Coastguard Worker  // This id MUST NOT contain any information that could be used to identify
511*14675a02SAndroid Build Coastguard Worker  // a specific device.
512*14675a02SAndroid Build Coastguard Worker  string execution_phase_id = 1;
513*14675a02SAndroid Build Coastguard Worker
514*14675a02SAndroid Build Coastguard Worker  // The name identifying the task for which the client was accepted.
515*14675a02SAndroid Build Coastguard Worker  string task_name = 10;
516*14675a02SAndroid Build Coastguard Worker
517*14675a02SAndroid Build Coastguard Worker  oneof init_checkpoint_type {
518*14675a02SAndroid Build Coastguard Worker    // A blob representing the checkpoint to start execution from.
519*14675a02SAndroid Build Coastguard Worker    bytes init_checkpoint = 2;
520*14675a02SAndroid Build Coastguard Worker
521*14675a02SAndroid Build Coastguard Worker    // A URI and other metadata of the checkpoint to start execution from.
522*14675a02SAndroid Build Coastguard Worker    UriResource init_checkpoint_resource = 8;
523*14675a02SAndroid Build Coastguard Worker  }
524*14675a02SAndroid Build Coastguard Worker
525*14675a02SAndroid Build Coastguard Worker  // Note: Plan fields below should be unset when included in a JoinResponse
526*14675a02SAndroid Build Coastguard Worker  // from the aggregator to the selector, and then set by the selector before
527*14675a02SAndroid Build Coastguard Worker  // sending on to the client.
528*14675a02SAndroid Build Coastguard Worker  oneof plan_type {
529*14675a02SAndroid Build Coastguard Worker    // A blob representing the plan to be used for execution.
530*14675a02SAndroid Build Coastguard Worker    bytes plan = 3;
531*14675a02SAndroid Build Coastguard Worker
532*14675a02SAndroid Build Coastguard Worker    // A URI and other metadata of the plan to be used for execution.
533*14675a02SAndroid Build Coastguard Worker    UriResource plan_resource = 9;
534*14675a02SAndroid Build Coastguard Worker  }
535*14675a02SAndroid Build Coastguard Worker
536*14675a02SAndroid Build Coastguard Worker  // Per-aggregand dynamic configuration information for side channel protocols.
537*14675a02SAndroid Build Coastguard Worker  // The keys in this map are the names of side channels, aligning with
538*14675a02SAndroid Build Coastguard Worker  // CheckpointOp.side_channel_tensors in plan.proto.
539*14675a02SAndroid Build Coastguard Worker  map<string, SideChannelExecutionInfo> side_channels = 4;
540*14675a02SAndroid Build Coastguard Worker
541*14675a02SAndroid Build Coastguard Worker  // Per-protocol dynamic configuration information for side channel protocols.
542*14675a02SAndroid Build Coastguard Worker  // This configuration applies to all aggregands configured to use each
543*14675a02SAndroid Build Coastguard Worker  // protocol.
544*14675a02SAndroid Build Coastguard Worker  SideChannelProtocolExecutionInfo side_channel_protocol_execution_info = 5;
545*14675a02SAndroid Build Coastguard Worker
546*14675a02SAndroid Build Coastguard Worker  reserved 6, 7;
547*14675a02SAndroid Build Coastguard Worker
548*14675a02SAndroid Build Coastguard Worker  // Info for how to generate URIs for fetching slices at runtime.
549*14675a02SAndroid Build Coastguard Worker  FederatedSelectUriInfo federated_select_uri_info = 11;
550*14675a02SAndroid Build Coastguard Worker
551*14675a02SAndroid Build Coastguard Worker  reserved 12, 13;
552*14675a02SAndroid Build Coastguard Worker}
553*14675a02SAndroid Build Coastguard Worker
554*14675a02SAndroid Build Coastguard Worker// Info for how to generate URIs for fetching slices that the task might request
555*14675a02SAndroid Build Coastguard Worker// to be downloaded at runtime.
556*14675a02SAndroid Build Coastguard Worker//
557*14675a02SAndroid Build Coastguard Worker// When one or more slices are requested by the task, the template specified
558*14675a02SAndroid Build Coastguard Worker// here should be used to form a URI from which the client can download the
559*14675a02SAndroid Build Coastguard Worker// slice data, by replacing the "{served_at_id}" and "{key_base10}" substrings
560*14675a02SAndroid Build Coastguard Worker// with the `google.internal.federated.plan.SlicesSelector.served_at_id` and the
561*14675a02SAndroid Build Coastguard Worker// base-10 representation of the `SlicesSelector.keys` value. The client must
562*14675a02SAndroid Build Coastguard Worker// not perform any URI escaping to the values that the substrings are replaced
563*14675a02SAndroid Build Coastguard Worker// with.
564*14675a02SAndroid Build Coastguard Workermessage FederatedSelectUriInfo {
565*14675a02SAndroid Build Coastguard Worker  // The URI template to use for fetching slices.
566*14675a02SAndroid Build Coastguard Worker  //
567*14675a02SAndroid Build Coastguard Worker  // This template must always start with "https://".
568*14675a02SAndroid Build Coastguard Worker  //
569*14675a02SAndroid Build Coastguard Worker  // This template must contain the following substrings: "{served_at_id}" and
570*14675a02SAndroid Build Coastguard Worker  // "{key_base10}", as per the above documentation.
571*14675a02SAndroid Build Coastguard Worker  string uri_template = 1;
572*14675a02SAndroid Build Coastguard Worker}
573*14675a02SAndroid Build Coastguard Worker
574*14675a02SAndroid Build Coastguard Worker// This is sent when client (device) is rejected for the participation.
575*14675a02SAndroid Build Coastguard Workermessage RejectionInfo {
576*14675a02SAndroid Build Coastguard Worker  // Optional. A suggestion to the client when to retry next connection to the
577*14675a02SAndroid Build Coastguard Worker  // service
578*14675a02SAndroid Build Coastguard Worker  // Deprecated in favor of `CheckinRequestAck`. If a client supports
579*14675a02SAndroid Build Coastguard Worker  // `CheckinRequestAck` then this value is ignored.
580*14675a02SAndroid Build Coastguard Worker  RetryWindow retry_window = 4 [deprecated = true];
581*14675a02SAndroid Build Coastguard Worker
582*14675a02SAndroid Build Coastguard Worker  reserved 1, 2, 3;
583*14675a02SAndroid Build Coastguard Worker}
584*14675a02SAndroid Build Coastguard Worker
585*14675a02SAndroid Build Coastguard Worker// This is sent by the client after the client finishes local (on-device)
586*14675a02SAndroid Build Coastguard Worker// training.
587*14675a02SAndroid Build Coastguard Worker//
588*14675a02SAndroid Build Coastguard Worker// If secure aggregation side channel is used, this must accompany the
589*14675a02SAndroid Build Coastguard Worker// secure aggregation commit message in the same ClientStreamMessage.
590*14675a02SAndroid Build Coastguard Workermessage ReportRequest {
591*14675a02SAndroid Build Coastguard Worker  // The name of the population this client belongs to.
592*14675a02SAndroid Build Coastguard Worker  string population_name = 1;
593*14675a02SAndroid Build Coastguard Worker
594*14675a02SAndroid Build Coastguard Worker  // The id of the execution phase this client participates in.
595*14675a02SAndroid Build Coastguard Worker  string execution_phase_id = 2;
596*14675a02SAndroid Build Coastguard Worker
597*14675a02SAndroid Build Coastguard Worker  // The report.
598*14675a02SAndroid Build Coastguard Worker  Report report = 3;
599*14675a02SAndroid Build Coastguard Worker}
600*14675a02SAndroid Build Coastguard Worker
601*14675a02SAndroid Build Coastguard Worker// This is sent by the server as the final message in the reporting protocol.
602*14675a02SAndroid Build Coastguard Workermessage ReportResponse {
603*14675a02SAndroid Build Coastguard Worker  // Optional. A suggestion to the client when to retry next connection to the
604*14675a02SAndroid Build Coastguard Worker  // service
605*14675a02SAndroid Build Coastguard Worker  // Deprecated in favor of `CheckinRequestAck`. If a client supports
606*14675a02SAndroid Build Coastguard Worker  // `CheckinRequestAck` then this value is ignored.
607*14675a02SAndroid Build Coastguard Worker  RetryWindow retry_window = 1 [deprecated = true];
608*14675a02SAndroid Build Coastguard Worker}
609*14675a02SAndroid Build Coastguard Worker
610*14675a02SAndroid Build Coastguard Worker// A report with results of local (on-device) training.
611*14675a02SAndroid Build Coastguard Workermessage Report {
612*14675a02SAndroid Build Coastguard Worker  // A blob representing the updated checkpoint, if any.  The content
613*14675a02SAndroid Build Coastguard Worker  // is dependent of the execution method.
614*14675a02SAndroid Build Coastguard Worker  bytes update_checkpoint = 1;
615*14675a02SAndroid Build Coastguard Worker
616*14675a02SAndroid Build Coastguard Worker  // Status code reported by client.
617*14675a02SAndroid Build Coastguard Worker  // Code.OK indicates that client execution completed successfully and produced
618*14675a02SAndroid Build Coastguard Worker  // report. Any other code indicates unsuccessful execution and train events
619*14675a02SAndroid Build Coastguard Worker  // below might contain detailed diagnostic information.
620*14675a02SAndroid Build Coastguard Worker  int32 status_code = 5;
621*14675a02SAndroid Build Coastguard Worker
622*14675a02SAndroid Build Coastguard Worker  reserved 3;
623*14675a02SAndroid Build Coastguard Worker
624*14675a02SAndroid Build Coastguard Worker  // A serialized ClientExecutionStats field about stats produced during a
625*14675a02SAndroid Build Coastguard Worker  // client side execution of the plan.
626*14675a02SAndroid Build Coastguard Worker  repeated google.protobuf.Any serialized_train_event = 4;
627*14675a02SAndroid Build Coastguard Worker
628*14675a02SAndroid Build Coastguard Worker  reserved 2;
629*14675a02SAndroid Build Coastguard Worker
630*14675a02SAndroid Build Coastguard Worker  reserved 6;
631*14675a02SAndroid Build Coastguard Worker}
632*14675a02SAndroid Build Coastguard Worker
633*14675a02SAndroid Build Coastguard Worker// This message is used to report duration to the server.
634*14675a02SAndroid Build Coastguard Workermessage ClientExecutionStats {
635*14675a02SAndroid Build Coastguard Worker  // The time spent on running the plan (includes I/O such as reading examples,
636*14675a02SAndroid Build Coastguard Worker  // but does not include time spent on the network for retrieving the plan
637*14675a02SAndroid Build Coastguard Worker  // or uploading results).
638*14675a02SAndroid Build Coastguard Worker  google.protobuf.Duration duration = 2;
639*14675a02SAndroid Build Coastguard Worker
640*14675a02SAndroid Build Coastguard Worker  reserved 1;
641*14675a02SAndroid Build Coastguard Worker}
642*14675a02SAndroid Build Coastguard Worker
643*14675a02SAndroid Build Coastguard Worker// A suggestion to the client when to retry the connection to the service next
644*14675a02SAndroid Build Coastguard Worker// time
645*14675a02SAndroid Build Coastguard Workermessage RetryWindow {
646*14675a02SAndroid Build Coastguard Worker  // Optional. If set, the server offers the client to call back in
647*14675a02SAndroid Build Coastguard Worker  // an interval [delay_min .. delay_max].
648*14675a02SAndroid Build Coastguard Worker  // The client must pass this token back to the server to identify he is
649*14675a02SAndroid Build Coastguard Worker  // retrying. If this is not set, the client can retry for another phase at a
650*14675a02SAndroid Build Coastguard Worker  // time of his choosing.
651*14675a02SAndroid Build Coastguard Worker  string retry_token = 1;
652*14675a02SAndroid Build Coastguard Worker
653*14675a02SAndroid Build Coastguard Worker  // Required (if retry_token is set).
654*14675a02SAndroid Build Coastguard Worker  // The suggested minimal duration after which the client should
655*14675a02SAndroid Build Coastguard Worker  // retry. If the client retries earlier, it is likely he will be rejected
656*14675a02SAndroid Build Coastguard Worker  // again.
657*14675a02SAndroid Build Coastguard Worker  google.protobuf.Duration delay_min = 2;
658*14675a02SAndroid Build Coastguard Worker
659*14675a02SAndroid Build Coastguard Worker  // Required. The suggested maximal duration after which the client should
660*14675a02SAndroid Build Coastguard Worker  // retry, provided scheduling conditions allow. The client is supposed to make
661*14675a02SAndroid Build Coastguard Worker  // a best effort to callback in the min..max window, and should avoid
662*14675a02SAndroid Build Coastguard Worker  // calling before min. If he calls after max, the likelihood to be rejected
663*14675a02SAndroid Build Coastguard Worker  // again is higher.
664*14675a02SAndroid Build Coastguard Worker  google.protobuf.Duration delay_max = 3;
665*14675a02SAndroid Build Coastguard Worker}
666*14675a02SAndroid Build Coastguard Worker
667*14675a02SAndroid Build Coastguard Worker// Intermediate Representation for checkpoints after side channels and
668*14675a02SAndroid Build Coastguard Worker// quantization have been applied.  This is the input and post-aggregation
669*14675a02SAndroid Build Coastguard Worker// output of the transport-and-aggregate protocols.
670*14675a02SAndroid Build Coastguard Workermessage Checkpoint {
671*14675a02SAndroid Build Coastguard Worker  // An aggregand is a (flattened) collection of checkpoint variables
672*14675a02SAndroid Build Coastguard Worker  // that will be aggregated using the same transport-and-aggregate protocol.
673*14675a02SAndroid Build Coastguard Worker  message Aggregand {
674*14675a02SAndroid Build Coastguard Worker    repeated uint64 values = 1 [packed = true];
675*14675a02SAndroid Build Coastguard Worker    int32 bitwidth = 2;
676*14675a02SAndroid Build Coastguard Worker  }
677*14675a02SAndroid Build Coastguard Worker
678*14675a02SAndroid Build Coastguard Worker  // Checkpoint variables are partitioned into multiple aggregands,
679*14675a02SAndroid Build Coastguard Worker  // each of which can use a different transport-and-aggregate protocol.
680*14675a02SAndroid Build Coastguard Worker  //
681*14675a02SAndroid Build Coastguard Worker  map<string, Aggregand> aggregands = 1;
682*14675a02SAndroid Build Coastguard Worker}
683*14675a02SAndroid Build Coastguard Worker
684*14675a02SAndroid Build Coastguard Worker// Protocol options sent from client to server inside
685*14675a02SAndroid Build Coastguard Worker// `EligibilityEvalCheckinRequest` and `CheckinRequest`.
686*14675a02SAndroid Build Coastguard Workermessage ProtocolOptionsRequest {
687*14675a02SAndroid Build Coastguard Worker  // True if client supports chunked blob transfer protocol.
688*14675a02SAndroid Build Coastguard Worker  bool supports_chunked_blob_transfer = 1;
689*14675a02SAndroid Build Coastguard Worker
690*14675a02SAndroid Build Coastguard Worker  // Chunked blob transfer compression levels supported by this client.
691*14675a02SAndroid Build Coastguard Worker  repeated CompressionLevel supported_compression_levels = 2;
692*14675a02SAndroid Build Coastguard Worker
693*14675a02SAndroid Build Coastguard Worker  // Per-protocol configuration option information for side channel protocols.
694*14675a02SAndroid Build Coastguard Worker  // These options apply to all aggregands configured to use each protocol.
695*14675a02SAndroid Build Coastguard Worker  SideChannelProtocolOptionsRequest side_channels = 3;
696*14675a02SAndroid Build Coastguard Worker
697*14675a02SAndroid Build Coastguard Worker  // When this is set in a {@link CheckinRequest} or {@link
698*14675a02SAndroid Build Coastguard Worker  // EligibilityEvalCheckinRequest} message, the server should ack using
699*14675a02SAndroid Build Coastguard Worker  // a {@link CheckinRequestAck} sent back to the client.
700*14675a02SAndroid Build Coastguard Worker  //
701*14675a02SAndroid Build Coastguard Worker  // Note that if a client previously issued a
702*14675a02SAndroid Build Coastguard Worker  // `EligibilityEvalCheckinRequest` (for which this field is always set
703*14675a02SAndroid Build Coastguard Worker  // to true), then this field will not be set to true for the subsequent
704*14675a02SAndroid Build Coastguard Worker  // `CheckinRequest`.
705*14675a02SAndroid Build Coastguard Worker  bool should_ack_checkin = 4;
706*14675a02SAndroid Build Coastguard Worker
707*14675a02SAndroid Build Coastguard Worker  // True if client supports download of resources via HTTP.
708*14675a02SAndroid Build Coastguard Worker  bool supports_http_download = 5;
709*14675a02SAndroid Build Coastguard Worker
710*14675a02SAndroid Build Coastguard Worker  // True if client supports download of Eligibility Eval resources via HTTP.
711*14675a02SAndroid Build Coastguard Worker  bool supports_eligibility_eval_http_download = 6;
712*14675a02SAndroid Build Coastguard Worker
713*14675a02SAndroid Build Coastguard Worker  // HTTP download compression formats supported by this client. All clients
714*14675a02SAndroid Build Coastguard Worker  // that support HTTP downloads are assumed to support uncompressed payloads.
715*14675a02SAndroid Build Coastguard Worker  repeated HttpCompressionFormat supported_http_compression_formats = 7;
716*14675a02SAndroid Build Coastguard Worker}
717*14675a02SAndroid Build Coastguard Worker
718*14675a02SAndroid Build Coastguard Worker// Protocol options sent from server to client inside
719*14675a02SAndroid Build Coastguard Worker// `EligibilityEvalCheckinResponse` and `CheckinResponse`.
720*14675a02SAndroid Build Coastguard Workermessage ProtocolOptionsResponse {
721*14675a02SAndroid Build Coastguard Worker  // Tells client what chunk size to use for uploading data, default 8192.
722*14675a02SAndroid Build Coastguard Worker  int32 chunk_size_for_upload = 1;
723*14675a02SAndroid Build Coastguard Worker
724*14675a02SAndroid Build Coastguard Worker  // Tells client how many chunks to send ahead of receiving ack, default: 2
725*14675a02SAndroid Build Coastguard Worker  int32 max_pending_chunks = 2;
726*14675a02SAndroid Build Coastguard Worker
727*14675a02SAndroid Build Coastguard Worker  // Indicates desired compression level
728*14675a02SAndroid Build Coastguard Worker  CompressionLevel compression_level = 4;
729*14675a02SAndroid Build Coastguard Worker
730*14675a02SAndroid Build Coastguard Worker  // Negotiated side channel protocol options; side channel options may not
731*14675a02SAndroid Build Coastguard Worker  // be set for channels which will not be used in the ReportRequest.
732*14675a02SAndroid Build Coastguard Worker  SideChannelProtocolOptionsResponse side_channels = 5;
733*14675a02SAndroid Build Coastguard Worker}
734*14675a02SAndroid Build Coastguard Worker
735*14675a02SAndroid Build Coastguard Worker// Allows to transmit large ClientStreamMessage or ServerStreamMessage
736*14675a02SAndroid Build Coastguard Worker// (depending on a direction of a transfer) as a stream of multiple small chunks
737*14675a02SAndroid Build Coastguard Worker// with optional compression flow control.
738*14675a02SAndroid Build Coastguard Workermessage ChunkedTransferMessage {
739*14675a02SAndroid Build Coastguard Worker  // Supported types of compression scheme. Deprecated, replaced by
740*14675a02SAndroid Build Coastguard Worker  // CompressionLevel. Do not add new values.
741*14675a02SAndroid Build Coastguard Worker  enum CompressionType {
742*14675a02SAndroid Build Coastguard Worker    // Compression disabled
743*14675a02SAndroid Build Coastguard Worker    UNCOMPRESSED = 0;
744*14675a02SAndroid Build Coastguard Worker  }
745*14675a02SAndroid Build Coastguard Worker
746*14675a02SAndroid Build Coastguard Worker  // Initiation of the chunked transfer. Transmitting party starts sending
747*14675a02SAndroid Build Coastguard Worker  // chunks (Data messages) right after sending Start.
748*14675a02SAndroid Build Coastguard Worker  message Start {
749*14675a02SAndroid Build Coastguard Worker    // Uncompressed size of the blob, in bytes.
750*14675a02SAndroid Build Coastguard Worker    int32 uncompressed_size = 2;
751*14675a02SAndroid Build Coastguard Worker
752*14675a02SAndroid Build Coastguard Worker    // Level of compression.
753*14675a02SAndroid Build Coastguard Worker    CompressionLevel compression_level = 3;
754*14675a02SAndroid Build Coastguard Worker
755*14675a02SAndroid Build Coastguard Worker    // Size of the blob transferred over the wire, in bytes.
756*14675a02SAndroid Build Coastguard Worker    // This field may not be set by older clients, so readers should check the
757*14675a02SAndroid Build Coastguard Worker    // uncompressed_size field if this value is zero.
758*14675a02SAndroid Build Coastguard Worker    int32 blob_size_bytes = 4;
759*14675a02SAndroid Build Coastguard Worker
760*14675a02SAndroid Build Coastguard Worker    reserved 1;
761*14675a02SAndroid Build Coastguard Worker  }
762*14675a02SAndroid Build Coastguard Worker
763*14675a02SAndroid Build Coastguard Worker  // Carries a chunk of data. Receiving party assembles all the chunks to get
764*14675a02SAndroid Build Coastguard Worker  // a serialized form of a large ClientStreamMessage or ServerStreamMessage
765*14675a02SAndroid Build Coastguard Worker  // depending on a direction of a transfer.
766*14675a02SAndroid Build Coastguard Worker  message Data {
767*14675a02SAndroid Build Coastguard Worker    // 0-based index of the chunk
768*14675a02SAndroid Build Coastguard Worker    // All chunk messages must be ordered, the index is included for diagnostics
769*14675a02SAndroid Build Coastguard Worker    // purposes.
770*14675a02SAndroid Build Coastguard Worker    int32 chunk_index = 1;
771*14675a02SAndroid Build Coastguard Worker
772*14675a02SAndroid Build Coastguard Worker    // Next chunk of the blob.
773*14675a02SAndroid Build Coastguard Worker    bytes chunk_bytes = 2;
774*14675a02SAndroid Build Coastguard Worker  }
775*14675a02SAndroid Build Coastguard Worker
776*14675a02SAndroid Build Coastguard Worker  // Acknowledgement of receiving of Data message.
777*14675a02SAndroid Build Coastguard Worker  // Must be sent in a response of a successful receiving of a chunk. It is used
778*14675a02SAndroid Build Coastguard Worker  // for the purposes of the flow control: transmitting party limits number of
779*14675a02SAndroid Build Coastguard Worker  // of chunks speculatively sent
780*14675a02SAndroid Build Coastguard Worker  message Ack {
781*14675a02SAndroid Build Coastguard Worker    // 0-based index of received chunk
782*14675a02SAndroid Build Coastguard Worker    // All ack messages must be ordered, the index is included for diagnostic
783*14675a02SAndroid Build Coastguard Worker    // purposes.
784*14675a02SAndroid Build Coastguard Worker    int32 chunk_index = 1;
785*14675a02SAndroid Build Coastguard Worker  }
786*14675a02SAndroid Build Coastguard Worker
787*14675a02SAndroid Build Coastguard Worker  // Completion of the chunked transfer.
788*14675a02SAndroid Build Coastguard Worker  message End {
789*14675a02SAndroid Build Coastguard Worker    // Total number of chunks transferred.
790*14675a02SAndroid Build Coastguard Worker    int32 chunk_count = 1;
791*14675a02SAndroid Build Coastguard Worker
792*14675a02SAndroid Build Coastguard Worker    // TODO(team): Add checksum.
793*14675a02SAndroid Build Coastguard Worker  }
794*14675a02SAndroid Build Coastguard Worker
795*14675a02SAndroid Build Coastguard Worker  // Kind of chunked message.
796*14675a02SAndroid Build Coastguard Worker  oneof kind {
797*14675a02SAndroid Build Coastguard Worker    // Start message, sent by transmitter
798*14675a02SAndroid Build Coastguard Worker    Start start = 1;
799*14675a02SAndroid Build Coastguard Worker
800*14675a02SAndroid Build Coastguard Worker    // Data message (a single chunk), sent by transmitter.
801*14675a02SAndroid Build Coastguard Worker    Data data = 2;
802*14675a02SAndroid Build Coastguard Worker
803*14675a02SAndroid Build Coastguard Worker    // Ack of receiving of Data message, sent by receiver.
804*14675a02SAndroid Build Coastguard Worker    Ack ack = 3;
805*14675a02SAndroid Build Coastguard Worker
806*14675a02SAndroid Build Coastguard Worker    // End of the transmission, sent by transmitter.
807*14675a02SAndroid Build Coastguard Worker    End end = 4;
808*14675a02SAndroid Build Coastguard Worker  }
809*14675a02SAndroid Build Coastguard Worker}
810