xref: /aosp_15_r20/external/federated-compute/fcp/protos/federatedcompute/eligibility_eval_tasks.proto (revision 14675a029014e728ec732f129a32e299b2da0601)
1// Copyright 2021 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto3";
16
17package google.internal.federatedcompute.v1;
18
19import "fcp/protos/federatedcompute/common.proto";
20
21option java_package = "com.google.internal.federatedcompute.v1";
22option java_multiple_files = true;
23
24service EligibilityEvalTasks {
25  // A request, sent by the device to request the eligibility-computing task for
26  // the population. This task is run by the client to generate a
27  // `TaskEligibilityInfo` proto result, which is then included with a
28  // subsequent `StartTaskAssignmentRequest` to inform the server which tasks
29  // the client is eligible for.
30  //
31  // Returns NOT_FOUND if the population does not exist.
32  rpc RequestEligibilityEvalTask(EligibilityEvalTaskRequest)
33      returns (EligibilityEvalTaskResponse) {
34  }
35
36  // A request sent by the device to report the result of running the
37  // EligibilityEval task provided by `EligibilityEvalTaskResponse`.
38  //
39  // A result with a status code other than Code.OK indicates client session
40  // termination. The client may not send any future requests with the given
41  // session_id.
42  //
43  // Clients should use the same `ForwardingInfo` as used in the
44  // `RequestEligibilityEvalTask` request to construct the URI for this request.
45  rpc ReportEligibilityEvalTaskResult(ReportEligibilityEvalTaskResultRequest)
46      returns (ReportEligibilityEvalTaskResultResponse) {
47  }
48}
49
50message EligibilityEvalTaskRequest {
51  // The name of the population this client belongs to.
52  //
53  // Note that http clients set this value in the request URL instead of the
54  // request body.
55  string population_name = 1
56      ;
57
58  // The attestation measurement providing evidence of integrity for this
59  // client. The measurement is bound to the population_name value in this
60  // request.
61  //
62  // Note that the subsequent `StartTaskAssignmentRequest` will use the same
63  // value for this field, since it is considered part of the same logical
64  // protocol session as this request.
65  AttestationMeasurement attestation_measurement = 2;
66
67  ClientVersion client_version = 3;
68
69  // The client's capabilities when downloading and processing resources.
70  ResourceCapabilities resource_capabilities = 4;
71
72  // The client's capabilities when downloading and running Eligibility Eval
73  // tasks.
74  EligibilityEvalTaskCapabilities eligibility_eval_task_capabilities = 5;
75}
76
77// The client's capabilities for determining task eligibility.
78message EligibilityEvalTaskCapabilities {
79  // Whether the client supports multiple task assignment
80  // (/TaskAssignments.PerformMultipleTaskAssignments). If false, the client
81  // will not be provided information about tasks that require multiple task
82  // assignment.
83  bool supports_multiple_task_assignment = 1;
84}
85
86message EligibilityEvalTaskResponse {
87  // Information to construct the URI to use when calling StartTaskAssignment.
88  // This will not be populated if the result below contains a RejectionInfo
89  // message since the client should not call StartTaskAssignment in that case.
90  //
91  // Note that this forwarding info does not apply to
92  // `ReportEligibilityEvalTaskResult` which should instead be sent to the same
93  // endpoint as `RequestEligibilityEvalTask`.
94  ForwardingInfo task_assignment_forwarding_info = 1;
95
96  // Unique identifier for the protocol session. This field will not be set if
97  // the result below contains a RejectionInfo.
98  string session_id = 2;
99
100  oneof result {
101    // If the population has an eligibility-computing task configured, and if
102    // the client is compatible with that task, then this field will be set,
103    // containing the task's information. The client should run the task and
104    // include its `TaskEligibilityInfo` result in the subsequent
105    // `StartTaskAssignmentRequest`.
106    EligibilityEvalTask eligibility_eval_task = 3;
107
108    // If the population does not have an eligibility-computing task configured,
109    // then this field will be set. The client should continue by issuing a
110    // `StartTaskAssignmentRequest` without the `task_eligibility_info` field
111    // set.
112    NoEligibilityEvalConfigured no_eligibility_eval_configured = 4;
113
114    // If the population has an eligibility-computing task configured, but the
115    // client is incompatible with that task or if the server is unable to
116    // service the request at the moment, then this field will be set.
117    RejectionInfo rejection_info = 5;
118  }
119
120  // Retry window to use for the next RequestEligibilityEvalTask attempt if
121  // the following StartTaskAssignment attempt ends up being subsequently
122  // accepted by the server, as in the client received a
123  // StartTaskAssignmentResponse with a TaskAssignment. This will not be set if
124  // the result above contains a RejectionInfo.
125  RetryWindow retry_window_if_accepted = 6;
126
127  // Retry window to use if this request was rejected or if the following
128  // StartTaskAssignment attempt is not accepted by the server, as in the client
129  // receives a StartTaskAssignmentResponse without a TaskAssignment.
130  RetryWindow retry_window_if_rejected = 7;
131}
132
133message EligibilityEvalTask {
134  // The checkpoint from which to start execution (if any).
135  // Optional: This field and `plan` may both be unset if the client supports
136  // multiple task assignment but the population does not have an Eligibility
137  // Eval task configured.
138  Resource init_checkpoint = 1;
139
140  // The task to be used for execution.
141  // Optional: This field and `init_checkpoint` may both be unset if the client
142  // supports multiple task assignment but the population does not have an
143  // Eligibility Eval task configured.
144  Resource plan = 2;
145
146  // A serialized PopulationEligibilitySpec describing the eligibility criteria
147  // for tasks in the population.
148  Resource population_eligibility_spec = 4;
149
150  // The opaque id of the eligibility evaluation task payload the client is
151  // being given. This is a string generated by the server and used by the
152  // client for logging purposes. This id MUST NOT contain any information that
153  // could be used to identify a specific device.
154  // Also see the similar `TaskAssignment.execution_phase_id`.
155  // Optional: If `plan` is absent, this field may also be absent.
156  string execution_id = 3;
157}
158
159// Currently-empty message describing the case where a population does not have
160// an eligibility-computing task configured.
161message NoEligibilityEvalConfigured {}
162
163// Provides the information needed to determine eligibility for tasks in a
164// population.
165message PopulationEligibilitySpec {
166  // Eligibility-related information about each task in the population.
167  repeated TaskInfo task_info = 1;
168
169  message TaskInfo {
170    // The name of the task.
171    string task_name = 1;
172
173    // The TaskAssignments method to use for the task.
174    TaskAssignmentMode task_assignment_mode = 2;
175
176    enum TaskAssignmentMode {
177      TASK_ASSIGNMENT_MODE_UNSPECIFIED = 0;
178      // Task assignment uses /TaskAssignments.StartTaskAssignment.
179      TASK_ASSIGNMENT_MODE_SINGLE = 1;
180      // Task assignment uses /TaskAssignments.PerformMultipleTaskAssignments.
181      TASK_ASSIGNMENT_MODE_MULTIPLE = 2;
182    }
183  }
184}
185
186message ReportEligibilityEvalTaskResultRequest {
187  // The name of the population this client belongs to.
188  //
189  // Note that http clients set this value in the request URL instead of the
190  // request body.
191  string population_name = 1
192      ;
193
194  // The session id returned by the server.
195  //
196  // Note that http clients set this value in the request URL instead of the
197  // request body.
198  string session_id = 2
199      ;
200
201  // Status code reported by client.
202  // Code.OK indicates that client execution completed successfully. Any other
203  // code indicates unsuccessful execution and termination of the protocol
204  // session.
205  int32 status_code = 3;
206}
207
208message ReportEligibilityEvalTaskResultResponse {}
209