1*14675a02SAndroid Build Coastguard Worker// Copyright 2021 Google LLC 2*14675a02SAndroid Build Coastguard Worker// 3*14675a02SAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License"); 4*14675a02SAndroid Build Coastguard Worker// you may not use this file except in compliance with the License. 5*14675a02SAndroid Build Coastguard Worker// You may obtain a copy of the License at 6*14675a02SAndroid Build Coastguard Worker// 7*14675a02SAndroid Build Coastguard Worker// http://www.apache.org/licenses/LICENSE-2.0 8*14675a02SAndroid Build Coastguard Worker// 9*14675a02SAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software 10*14675a02SAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS, 11*14675a02SAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12*14675a02SAndroid Build Coastguard Worker// See the License for the specific language governing permissions and 13*14675a02SAndroid Build Coastguard Worker// limitations under the License. 14*14675a02SAndroid Build Coastguard Worker 15*14675a02SAndroid Build Coastguard Workersyntax = "proto3"; 16*14675a02SAndroid Build Coastguard Worker 17*14675a02SAndroid Build Coastguard Workerpackage google.internal.federatedcompute.v1; 18*14675a02SAndroid Build Coastguard Worker 19*14675a02SAndroid Build Coastguard Workerimport "google/protobuf/duration.proto"; 20*14675a02SAndroid Build Coastguard Workerimport "fcp/protos/federated_api.proto"; 21*14675a02SAndroid Build Coastguard Workerimport "fcp/protos/federatedcompute/common.proto"; 22*14675a02SAndroid Build Coastguard Worker 23*14675a02SAndroid Build Coastguard Workeroption java_package = "com.google.internal.federatedcompute.v1"; 24*14675a02SAndroid Build Coastguard Workeroption java_multiple_files = true; 25*14675a02SAndroid Build Coastguard Worker 26*14675a02SAndroid Build Coastguard Workerservice TaskAssignments { 27*14675a02SAndroid Build Coastguard Worker // A request sent by the device to check if it should participate in the 28*14675a02SAndroid Build Coastguard Worker // current task. 29*14675a02SAndroid Build Coastguard Worker // 30*14675a02SAndroid Build Coastguard Worker // Clients should use the same `ForwardingInfo` (incl. the headers) as used in 31*14675a02SAndroid Build Coastguard Worker // this request to construct the URI to poll the operation service to check 32*14675a02SAndroid Build Coastguard Worker // for task assignment completion. 33*14675a02SAndroid Build Coastguard Worker // 34*14675a02SAndroid Build Coastguard Worker // When the task assignment is complete, the result of the operation will 35*14675a02SAndroid Build Coastguard Worker // either contain an error or the resulting `StartTaskAssignmentResponse` in 36*14675a02SAndroid Build Coastguard Worker // the response. 37*14675a02SAndroid Build Coastguard Worker // 38*14675a02SAndroid Build Coastguard Worker // If the client no longer needs a task assignment because it is interrupted 39*14675a02SAndroid Build Coastguard Worker // or drops out or an error occurs during polling the long running operation, 40*14675a02SAndroid Build Coastguard Worker // the client should make a best effort to call CancelOperation. 41*14675a02SAndroid Build Coastguard Worker // 42*14675a02SAndroid Build Coastguard Worker // If the returned operation is not complete, clients should poll for status 43*14675a02SAndroid Build Coastguard Worker // at the rate specified in the StartTaskAssignmentMetadata. 44*14675a02SAndroid Build Coastguard Worker rpc StartTaskAssignment(StartTaskAssignmentRequest) 45*14675a02SAndroid Build Coastguard Worker returns (StartTaskAssignmentResponse) {} 46*14675a02SAndroid Build Coastguard Worker 47*14675a02SAndroid Build Coastguard Worker // A request sent by the device to participate in multiple tasks 48*14675a02SAndroid Build Coastguard Worker // simultaneously. 49*14675a02SAndroid Build Coastguard Worker // 50*14675a02SAndroid Build Coastguard Worker // Unlike StartTaskAssignment, which returns at most one task assignment of 51*14675a02SAndroid Build Coastguard Worker // the server's choice, this RPC attempts to return assignments for *all* 52*14675a02SAndroid Build Coastguard Worker // tasks requested by the client. 53*14675a02SAndroid Build Coastguard Worker rpc PerformMultipleTaskAssignments(PerformMultipleTaskAssignmentsRequest) 54*14675a02SAndroid Build Coastguard Worker returns (PerformMultipleTaskAssignmentsResponse) {} 55*14675a02SAndroid Build Coastguard Worker 56*14675a02SAndroid Build Coastguard Worker // A request sent by the device to report the result of running the task 57*14675a02SAndroid Build Coastguard Worker // provided by `StartTaskAssignmentResponse`. 58*14675a02SAndroid Build Coastguard Worker // 59*14675a02SAndroid Build Coastguard Worker // Clients should use the same `ForwardingInfo` as used in the 60*14675a02SAndroid Build Coastguard Worker // `StartTaskAssignment` request to construct the URI for this request. 61*14675a02SAndroid Build Coastguard Worker // 62*14675a02SAndroid Build Coastguard Worker // A result with a status code other than Code.OK indicates client session 63*14675a02SAndroid Build Coastguard Worker // termination. The client may not send any future requests with the given 64*14675a02SAndroid Build Coastguard Worker // session_id. 65*14675a02SAndroid Build Coastguard Worker rpc ReportTaskResult(ReportTaskResultRequest) 66*14675a02SAndroid Build Coastguard Worker returns (ReportTaskResultResponse) {} 67*14675a02SAndroid Build Coastguard Worker} 68*14675a02SAndroid Build Coastguard Worker 69*14675a02SAndroid Build Coastguard Workermessage StartTaskAssignmentRequest { 70*14675a02SAndroid Build Coastguard Worker // The name of the population this client belongs to. 71*14675a02SAndroid Build Coastguard Worker // 72*14675a02SAndroid Build Coastguard Worker // Note that http clients set this value in the request URL instead of the 73*14675a02SAndroid Build Coastguard Worker // request body. 74*14675a02SAndroid Build Coastguard Worker string population_name = 1 75*14675a02SAndroid Build Coastguard Worker ; 76*14675a02SAndroid Build Coastguard Worker 77*14675a02SAndroid Build Coastguard Worker // The session id returned by the server. 78*14675a02SAndroid Build Coastguard Worker // 79*14675a02SAndroid Build Coastguard Worker // Note that http clients set this value in the request URL instead of the 80*14675a02SAndroid Build Coastguard Worker // request body. 81*14675a02SAndroid Build Coastguard Worker string session_id = 2 82*14675a02SAndroid Build Coastguard Worker ; 83*14675a02SAndroid Build Coastguard Worker 84*14675a02SAndroid Build Coastguard Worker reserved 3; 85*14675a02SAndroid Build Coastguard Worker 86*14675a02SAndroid Build Coastguard Worker ClientVersion client_version = 4; 87*14675a02SAndroid Build Coastguard Worker 88*14675a02SAndroid Build Coastguard Worker // The client computes this message using the task returned by a previous 89*14675a02SAndroid Build Coastguard Worker // `RequestEligibilityEvalTask` call. 90*14675a02SAndroid Build Coastguard Worker // 91*14675a02SAndroid Build Coastguard Worker // If this field is set, it describes to the server which tasks the client is 92*14675a02SAndroid Build Coastguard Worker // (in)eligible. The server must take this information into account when 93*14675a02SAndroid Build Coastguard Worker // deciding task to serve in response to this request. 94*14675a02SAndroid Build Coastguard Worker // 95*14675a02SAndroid Build Coastguard Worker // If this field is unset, it may indicate that the client previously received 96*14675a02SAndroid Build Coastguard Worker // an `EligibilityEvalTask` without an `EligibilityEvalPayload` message (i.e. 97*14675a02SAndroid Build Coastguard Worker // the population did not have an eligibility-computing task configured at the 98*14675a02SAndroid Build Coastguard Worker // time of the request). It may also indicate a client for which the 99*14675a02SAndroid Build Coastguard Worker // eligibility-computing task feature has been disabled, or an old client that 100*14675a02SAndroid Build Coastguard Worker // does not support this feature yet. 101*14675a02SAndroid Build Coastguard Worker // 102*14675a02SAndroid Build Coastguard Worker // If this field is unset but the population has an eligibility-computing task 103*14675a02SAndroid Build Coastguard Worker // configured, then the server must reject this client, since the server has 104*14675a02SAndroid Build Coastguard Worker // no way to determine which tasks the client is (in)eligible for. 105*14675a02SAndroid Build Coastguard Worker // 106*14675a02SAndroid Build Coastguard Worker // If this field is unset and the population does not have an 107*14675a02SAndroid Build Coastguard Worker // eligibility-computing task configured, then the server may serve this 108*14675a02SAndroid Build Coastguard Worker // client any task. 109*14675a02SAndroid Build Coastguard Worker // 110*14675a02SAndroid Build Coastguard Worker google.internal.federatedml.v2.TaskEligibilityInfo task_eligibility_info = 5; 111*14675a02SAndroid Build Coastguard Worker 112*14675a02SAndroid Build Coastguard Worker // The client's capabilities when downloading and processing resources. 113*14675a02SAndroid Build Coastguard Worker ResourceCapabilities resource_capabilities = 6; 114*14675a02SAndroid Build Coastguard Worker} 115*14675a02SAndroid Build Coastguard Worker 116*14675a02SAndroid Build Coastguard Workermessage StartTaskAssignmentMetadata { 117*14675a02SAndroid Build Coastguard Worker // The suggested duration between instances of polling the StartTaskAssignment 118*14675a02SAndroid Build Coastguard Worker // LRO. 119*14675a02SAndroid Build Coastguard Worker google.protobuf.Duration polling_interval = 1; 120*14675a02SAndroid Build Coastguard Worker} 121*14675a02SAndroid Build Coastguard Worker 122*14675a02SAndroid Build Coastguard Workermessage StartTaskAssignmentResponse { 123*14675a02SAndroid Build Coastguard Worker // One of two outcomes, depending on server's decision on participation of the 124*14675a02SAndroid Build Coastguard Worker // client. 125*14675a02SAndroid Build Coastguard Worker oneof result { 126*14675a02SAndroid Build Coastguard Worker // If the client joined the task with this call, information on how to 127*14675a02SAndroid Build Coastguard Worker // proceed. 128*14675a02SAndroid Build Coastguard Worker TaskAssignment task_assignment = 1; 129*14675a02SAndroid Build Coastguard Worker 130*14675a02SAndroid Build Coastguard Worker // If the client was not accepted, information how to proceed. 131*14675a02SAndroid Build Coastguard Worker RejectionInfo rejection_info = 2; 132*14675a02SAndroid Build Coastguard Worker } 133*14675a02SAndroid Build Coastguard Worker} 134*14675a02SAndroid Build Coastguard Worker 135*14675a02SAndroid Build Coastguard Workermessage PerformMultipleTaskAssignmentsRequest { 136*14675a02SAndroid Build Coastguard Worker // The name of the population this client belongs to. 137*14675a02SAndroid Build Coastguard Worker // 138*14675a02SAndroid Build Coastguard Worker // Note that http clients set this value in the request URL instead of the 139*14675a02SAndroid Build Coastguard Worker // request body. 140*14675a02SAndroid Build Coastguard Worker string population_name = 1 141*14675a02SAndroid Build Coastguard Worker ; 142*14675a02SAndroid Build Coastguard Worker 143*14675a02SAndroid Build Coastguard Worker // The session id returned by the server. 144*14675a02SAndroid Build Coastguard Worker string session_id = 2 145*14675a02SAndroid Build Coastguard Worker ; 146*14675a02SAndroid Build Coastguard Worker 147*14675a02SAndroid Build Coastguard Worker // The client's version information. 148*14675a02SAndroid Build Coastguard Worker ClientVersion client_version = 3; 149*14675a02SAndroid Build Coastguard Worker 150*14675a02SAndroid Build Coastguard Worker // The client's capabilities when downloading and processing resources. 151*14675a02SAndroid Build Coastguard Worker ResourceCapabilities resource_capabilities = 4; 152*14675a02SAndroid Build Coastguard Worker 153*14675a02SAndroid Build Coastguard Worker // The list of tasks for which the client would like TaskAssignments. These 154*14675a02SAndroid Build Coastguard Worker // names are produced by running the population's Eligibility Eval task (see 155*14675a02SAndroid Build Coastguard Worker // /EligibilityEvalTasks.RequestEligibilityEvalTask). 156*14675a02SAndroid Build Coastguard Worker repeated string task_names = 5 157*14675a02SAndroid Build Coastguard Worker ; 158*14675a02SAndroid Build Coastguard Worker} 159*14675a02SAndroid Build Coastguard Worker 160*14675a02SAndroid Build Coastguard Workermessage PerformMultipleTaskAssignmentsResponse { 161*14675a02SAndroid Build Coastguard Worker // The TaskAssignments requested by the client. The server may omit requested 162*14675a02SAndroid Build Coastguard Worker // TaskAssignments, e.g. for any tasks that no longer exist or are not 163*14675a02SAndroid Build Coastguard Worker // currently accepting client contributions; these cases should be infrequent. 164*14675a02SAndroid Build Coastguard Worker repeated TaskAssignment task_assignments = 1; 165*14675a02SAndroid Build Coastguard Worker} 166*14675a02SAndroid Build Coastguard Worker 167*14675a02SAndroid Build Coastguard Worker// When client (device) is accepted for the current task, this data structure 168*14675a02SAndroid Build Coastguard Worker// carries information necessary to begin task execution. 169*14675a02SAndroid Build Coastguard Workermessage TaskAssignment { 170*14675a02SAndroid Build Coastguard Worker // Information to construct the URI to use for providing resulting aggregation 171*14675a02SAndroid Build Coastguard Worker // data after task execution. 172*14675a02SAndroid Build Coastguard Worker ForwardingInfo aggregation_data_forwarding_info = 1; 173*14675a02SAndroid Build Coastguard Worker 174*14675a02SAndroid Build Coastguard Worker message AggregationInfo {} 175*14675a02SAndroid Build Coastguard Worker 176*14675a02SAndroid Build Coastguard Worker message SecureAggregationInfo { 177*14675a02SAndroid Build Coastguard Worker // The minimum number of clients' values that must be aggregated together 178*14675a02SAndroid Build Coastguard Worker // before the server can gain access to the aggregate, 179*14675a02SAndroid Build Coastguard Worker // even transiently (e.g. in RAM). 180*14675a02SAndroid Build Coastguard Worker // This isn't needed by Secure Aggregation protocol on the client side but 181*14675a02SAndroid Build Coastguard Worker // shared by the server with clients for transparency or policy reasons. 182*14675a02SAndroid Build Coastguard Worker int32 minimum_clients_in_server_visible_aggregate = 1; 183*14675a02SAndroid Build Coastguard Worker } 184*14675a02SAndroid Build Coastguard Worker 185*14675a02SAndroid Build Coastguard Worker oneof aggregation_type { 186*14675a02SAndroid Build Coastguard Worker // If set, indicates that the Aggregations service (see 187*14675a02SAndroid Build Coastguard Worker // `aggregations.proto`) should be used to perform aggregation. 188*14675a02SAndroid Build Coastguard Worker AggregationInfo aggregation_info = 9; 189*14675a02SAndroid Build Coastguard Worker 190*14675a02SAndroid Build Coastguard Worker // If set, indicates that the SecureAggregations service (see 191*14675a02SAndroid Build Coastguard Worker // `secure_aggregations.proto`) should be used to perform aggregation. 192*14675a02SAndroid Build Coastguard Worker SecureAggregationInfo secure_aggregation_info = 10; 193*14675a02SAndroid Build Coastguard Worker } 194*14675a02SAndroid Build Coastguard Worker 195*14675a02SAndroid Build Coastguard Worker // Unique identifier for the client's protocol session. 196*14675a02SAndroid Build Coastguard Worker string session_id = 5; 197*14675a02SAndroid Build Coastguard Worker 198*14675a02SAndroid Build Coastguard Worker // The opaque id of the aggregation session the client has joined. This is a 199*14675a02SAndroid Build Coastguard Worker // string generated by the server and MUST NOT contain any information that 200*14675a02SAndroid Build Coastguard Worker // could be used to identify a specific device. 201*14675a02SAndroid Build Coastguard Worker string aggregation_id = 2; 202*14675a02SAndroid Build Coastguard Worker 203*14675a02SAndroid Build Coastguard Worker // Unique identifier for the client's participation in an aggregation session. 204*14675a02SAndroid Build Coastguard Worker string authorization_token = 6; 205*14675a02SAndroid Build Coastguard Worker 206*14675a02SAndroid Build Coastguard Worker // The name identifying the task that was assigned. 207*14675a02SAndroid Build Coastguard Worker string task_name = 7; 208*14675a02SAndroid Build Coastguard Worker 209*14675a02SAndroid Build Coastguard Worker // The checkpoint from which to start execution. 210*14675a02SAndroid Build Coastguard Worker Resource init_checkpoint = 3; 211*14675a02SAndroid Build Coastguard Worker 212*14675a02SAndroid Build Coastguard Worker // The plan to be used for execution. 213*14675a02SAndroid Build Coastguard Worker Resource plan = 4; 214*14675a02SAndroid Build Coastguard Worker 215*14675a02SAndroid Build Coastguard Worker // Info for how to generate URIs for fetching slices at runtime. 216*14675a02SAndroid Build Coastguard Worker FederatedSelectUriInfo federated_select_uri_info = 8; 217*14675a02SAndroid Build Coastguard Worker} 218*14675a02SAndroid Build Coastguard Worker 219*14675a02SAndroid Build Coastguard Worker// Info for how to generate URIs for fetching slices that the task might request 220*14675a02SAndroid Build Coastguard Worker// to be downloaded at runtime. 221*14675a02SAndroid Build Coastguard Worker// 222*14675a02SAndroid Build Coastguard Worker// When one or more slices are requested by the task, the template specified 223*14675a02SAndroid Build Coastguard Worker// here should be used to form a URI from which the client can download the 224*14675a02SAndroid Build Coastguard Worker// slice data, by replacing the "{served_at_id}" and "{key_base10}" substrings 225*14675a02SAndroid Build Coastguard Worker// with the `google.internal.federated.plan.SlicesSelector.served_at_id` and the 226*14675a02SAndroid Build Coastguard Worker// base-10 representation of the `SlicesSelector.keys` value. The client must 227*14675a02SAndroid Build Coastguard Worker// not perform any URI escaping to the values that the substrings are replaced 228*14675a02SAndroid Build Coastguard Worker// with. 229*14675a02SAndroid Build Coastguard Workermessage FederatedSelectUriInfo { 230*14675a02SAndroid Build Coastguard Worker // The URI template to use for fetching slices. 231*14675a02SAndroid Build Coastguard Worker // 232*14675a02SAndroid Build Coastguard Worker // This template must always start with "https://". 233*14675a02SAndroid Build Coastguard Worker // 234*14675a02SAndroid Build Coastguard Worker // This template must contain the following substrings: "{served_at_id}" and 235*14675a02SAndroid Build Coastguard Worker // "{key_base10}", as per the above documentation. 236*14675a02SAndroid Build Coastguard Worker string uri_template = 1; 237*14675a02SAndroid Build Coastguard Worker} 238*14675a02SAndroid Build Coastguard Worker 239*14675a02SAndroid Build Coastguard Workermessage ReportTaskResultRequest { 240*14675a02SAndroid Build Coastguard Worker // The name of the population this client belongs to. 241*14675a02SAndroid Build Coastguard Worker // 242*14675a02SAndroid Build Coastguard Worker // Note that http clients set this value in the request URL instead of the 243*14675a02SAndroid Build Coastguard Worker // request body. 244*14675a02SAndroid Build Coastguard Worker string population_name = 1 245*14675a02SAndroid Build Coastguard Worker ; 246*14675a02SAndroid Build Coastguard Worker 247*14675a02SAndroid Build Coastguard Worker // The session id returned by the server. 248*14675a02SAndroid Build Coastguard Worker // 249*14675a02SAndroid Build Coastguard Worker // Note that http clients set this value in the request URL instead of the 250*14675a02SAndroid Build Coastguard Worker // request body. 251*14675a02SAndroid Build Coastguard Worker string session_id = 2 252*14675a02SAndroid Build Coastguard Worker ; 253*14675a02SAndroid Build Coastguard Worker 254*14675a02SAndroid Build Coastguard Worker // The opaque id of the aggregation session the client has joined. This is a 255*14675a02SAndroid Build Coastguard Worker // string generated by the server and MUST NOT contain any information that 256*14675a02SAndroid Build Coastguard Worker // could be used to identify a specific device. 257*14675a02SAndroid Build Coastguard Worker string aggregation_id = 5 258*14675a02SAndroid Build Coastguard Worker ; 259*14675a02SAndroid Build Coastguard Worker 260*14675a02SAndroid Build Coastguard Worker // The name identifying the task that was assigned. 261*14675a02SAndroid Build Coastguard Worker string task_name = 6; 262*14675a02SAndroid Build Coastguard Worker 263*14675a02SAndroid Build Coastguard Worker // Computation status code reported by client. 264*14675a02SAndroid Build Coastguard Worker // Code.OK indicates that the client computation completed successfully. Any 265*14675a02SAndroid Build Coastguard Worker // other code indicates unsuccessful computation execution and termination of 266*14675a02SAndroid Build Coastguard Worker // the protocol session. 267*14675a02SAndroid Build Coastguard Worker int32 computation_status_code = 3; 268*14675a02SAndroid Build Coastguard Worker 269*14675a02SAndroid Build Coastguard Worker // Stats produced during the client-side execution of the task. 270*14675a02SAndroid Build Coastguard Worker ClientStats client_stats = 4; 271*14675a02SAndroid Build Coastguard Worker} 272*14675a02SAndroid Build Coastguard Worker 273*14675a02SAndroid Build Coastguard Worker// This message is used to report client stats and execution duration to the 274*14675a02SAndroid Build Coastguard Worker// server. 275*14675a02SAndroid Build Coastguard Workermessage ClientStats { 276*14675a02SAndroid Build Coastguard Worker // The time spent on running the task (includes I/O such as reading examples, 277*14675a02SAndroid Build Coastguard Worker // but does not include time spent on the network for retrieving the task 278*14675a02SAndroid Build Coastguard Worker // or uploading results). 279*14675a02SAndroid Build Coastguard Worker google.protobuf.Duration computation_execution_duration = 1; 280*14675a02SAndroid Build Coastguard Worker} 281*14675a02SAndroid Build Coastguard Worker 282*14675a02SAndroid Build Coastguard Workermessage ReportTaskResultResponse {} 283