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