xref: /aosp_15_r20/external/federated-compute/fcp/client/selector_context.proto (revision 14675a029014e728ec732f129a32e299b2da0601)
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 fcp.client;
18*14675a02SAndroid Build Coastguard Worker
19*14675a02SAndroid Build Coastguard Workerimport "google/protobuf/timestamp.proto";
20*14675a02SAndroid Build Coastguard Worker
21*14675a02SAndroid Build Coastguard Workeroption java_package = "com.google.intelligence.fcp.client";
22*14675a02SAndroid Build Coastguard Workeroption java_multiple_files = true;
23*14675a02SAndroid Build Coastguard Worker
24*14675a02SAndroid Build Coastguard Workermessage SelectorContext {
25*14675a02SAndroid Build Coastguard Worker  QueryTimeComputationProperties computation_properties = 1;
26*14675a02SAndroid Build Coastguard Worker}
27*14675a02SAndroid Build Coastguard Worker
28*14675a02SAndroid Build Coastguard Worker// Properties about the computation exposed to the iterator.
29*14675a02SAndroid Build Coastguard Workermessage QueryTimeComputationProperties {
30*14675a02SAndroid Build Coastguard Worker  // Session name, if applicable.
31*14675a02SAndroid Build Coastguard Worker  string session_name = 1;
32*14675a02SAndroid Build Coastguard Worker
33*14675a02SAndroid Build Coastguard Worker  // Different kinds of computation types.
34*14675a02SAndroid Build Coastguard Worker  oneof computation_type {
35*14675a02SAndroid Build Coastguard Worker    // Local computation type.
36*14675a02SAndroid Build Coastguard Worker    LocalComputation local_compute = 2;
37*14675a02SAndroid Build Coastguard Worker
38*14675a02SAndroid Build Coastguard Worker    // EligibilityEval computation type.
39*14675a02SAndroid Build Coastguard Worker    EligibilityEvalComputation eligibility_eval = 3;
40*14675a02SAndroid Build Coastguard Worker
41*14675a02SAndroid Build Coastguard Worker    // Federated computation type.
42*14675a02SAndroid Build Coastguard Worker    FederatedComputation federated = 4;
43*14675a02SAndroid Build Coastguard Worker  }
44*14675a02SAndroid Build Coastguard Worker
45*14675a02SAndroid Build Coastguard Worker  // A unique ID identifying the computation run.
46*14675a02SAndroid Build Coastguard Worker  int64 run_id = 5;
47*14675a02SAndroid Build Coastguard Worker
48*14675a02SAndroid Build Coastguard Worker  // Additional context data.
49*14675a02SAndroid Build Coastguard Worker  bytes context_data = 6;
50*14675a02SAndroid Build Coastguard Worker
51*14675a02SAndroid Build Coastguard Worker  enum ExampleIteratorOutputFormat {
52*14675a02SAndroid Build Coastguard Worker    // The specific serialization format is left unspecified and up to the
53*14675a02SAndroid Build Coastguard Worker    // ExampleStore implementation and TensorFlow-based tasks.
54*14675a02SAndroid Build Coastguard Worker    // In most cases, data is encoded in binary-serialized `tf.train.Example`
55*14675a02SAndroid Build Coastguard Worker    // protos.
56*14675a02SAndroid Build Coastguard Worker    EXAMPLE_ITERATOR_OUTPUT_FORMAT_UNSPECIFIED = 0;
57*14675a02SAndroid Build Coastguard Worker
58*14675a02SAndroid Build Coastguard Worker    // Data encoded in binary-serialized `fcp.client.ExampleQueryResult` protos.
59*14675a02SAndroid Build Coastguard Worker    EXAMPLE_QUERY_RESULT = 1;
60*14675a02SAndroid Build Coastguard Worker  }
61*14675a02SAndroid Build Coastguard Worker
62*14675a02SAndroid Build Coastguard Worker  // Expected output format from the example iterator.
63*14675a02SAndroid Build Coastguard Worker  ExampleIteratorOutputFormat example_iterator_output_format = 7;
64*14675a02SAndroid Build Coastguard Worker}
65*14675a02SAndroid Build Coastguard Worker
66*14675a02SAndroid Build Coastguard Worker// On-device, local computation only. No aggregation.
67*14675a02SAndroid Build Coastguard Workermessage LocalComputation {
68*14675a02SAndroid Build Coastguard Worker  // The absolute path to the input directory.
69*14675a02SAndroid Build Coastguard Worker  string input_dir = 1;
70*14675a02SAndroid Build Coastguard Worker  // The absolute path to the output directory.
71*14675a02SAndroid Build Coastguard Worker  string output_dir = 2;
72*14675a02SAndroid Build Coastguard Worker  // The map of input resources where the key is the name of the resource, and
73*14675a02SAndroid Build Coastguard Worker  // the value is the absolute paths to the resource.
74*14675a02SAndroid Build Coastguard Worker  map<string, string> input_resource_map = 3;
75*14675a02SAndroid Build Coastguard Worker}
76*14675a02SAndroid Build Coastguard Worker
77*14675a02SAndroid Build Coastguard Worker// ElgibilityEval computation, no aggregation.
78*14675a02SAndroid Build Coastguard Workermessage EligibilityEvalComputation {
79*14675a02SAndroid Build Coastguard Worker  // Population name.
80*14675a02SAndroid Build Coastguard Worker  string population_name = 1;
81*14675a02SAndroid Build Coastguard Worker}
82*14675a02SAndroid Build Coastguard Worker
83*14675a02SAndroid Build Coastguard Worker// Federated computation with server aggregation.
84*14675a02SAndroid Build Coastguard Workermessage FederatedComputation {
85*14675a02SAndroid Build Coastguard Worker  // Population name.
86*14675a02SAndroid Build Coastguard Worker  string population_name = 1;
87*14675a02SAndroid Build Coastguard Worker  // Name of the task that was executed.
88*14675a02SAndroid Build Coastguard Worker  string task_name = 2;
89*14675a02SAndroid Build Coastguard Worker
90*14675a02SAndroid Build Coastguard Worker  // Identity representing the computation e.g. its plan hash.
91*14675a02SAndroid Build Coastguard Worker  bytes computation_id = 5;
92*14675a02SAndroid Build Coastguard Worker
93*14675a02SAndroid Build Coastguard Worker  // Details about previous executions for the currently executing task.
94*14675a02SAndroid Build Coastguard Worker  HistoricalContext historical_context = 6;
95*14675a02SAndroid Build Coastguard Worker
96*14675a02SAndroid Build Coastguard Worker  // Types of server aggregation.
97*14675a02SAndroid Build Coastguard Worker  oneof aggregation_type {
98*14675a02SAndroid Build Coastguard Worker    // Simple aggregation. At least one value is aggregated with simple
99*14675a02SAndroid Build Coastguard Worker    // aggregation. This includes the mixed case where some values are
100*14675a02SAndroid Build Coastguard Worker    // aggregated with simple aggregation while others are aggregated with
101*14675a02SAndroid Build Coastguard Worker    // secure aggregation.
102*14675a02SAndroid Build Coastguard Worker    SimpleAggregation simple_aggregation = 3;
103*14675a02SAndroid Build Coastguard Worker
104*14675a02SAndroid Build Coastguard Worker    // Secure aggregation. All values are aggregated with secure aggregation.
105*14675a02SAndroid Build Coastguard Worker    SecureAggregation secure_aggregation = 4;
106*14675a02SAndroid Build Coastguard Worker  }
107*14675a02SAndroid Build Coastguard Worker}
108*14675a02SAndroid Build Coastguard Worker
109*14675a02SAndroid Build Coastguard Worker// Simple aggregation.
110*14675a02SAndroid Build Coastguard Workermessage SimpleAggregation {}
111*14675a02SAndroid Build Coastguard Worker
112*14675a02SAndroid Build Coastguard Worker// Secure aggregation.
113*14675a02SAndroid Build Coastguard Workermessage SecureAggregation {
114*14675a02SAndroid Build Coastguard Worker  // The minimum number of clients' values that must be aggregated together
115*14675a02SAndroid Build Coastguard Worker  // before the server can gain access to the aggregate,
116*14675a02SAndroid Build Coastguard Worker  // even transiently (e.g. in RAM).
117*14675a02SAndroid Build Coastguard Worker  // This isn't needed by Secure Aggregation protocol on the client side but
118*14675a02SAndroid Build Coastguard Worker  // shared by the server with clients for transparency and/or policy reasons.
119*14675a02SAndroid Build Coastguard Worker  // See `federated_api.proto`.
120*14675a02SAndroid Build Coastguard Worker  int32 minimum_clients_in_server_visible_aggregate = 1;
121*14675a02SAndroid Build Coastguard Worker}
122*14675a02SAndroid Build Coastguard Worker
123*14675a02SAndroid Build Coastguard Worker// Details about previous executions for the currently executing task.
124*14675a02SAndroid Build Coastguard Workermessage HistoricalContext {
125*14675a02SAndroid Build Coastguard Worker  // Timestamp of when this task was last successfully contributed to.
126*14675a02SAndroid Build Coastguard Worker  google.protobuf.Timestamp last_successful_contribution_time = 1;
127*14675a02SAndroid Build Coastguard Worker}
128