alanlxl | 30f15bd | 2020-08-11 21:26:12 +1000 | [diff] [blame] | 1 | // Copyright 2020 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef FEDERATED_UTILS_H_ |
| 6 | #define FEDERATED_UTILS_H_ |
| 7 | |
alanlxl | 9d26c1c | 2020-08-21 13:42:36 +1000 | [diff] [blame] | 8 | #include <string> |
| 9 | |
| 10 | #include <base/files/file_path.h> |
| 11 | |
alanlxl | 30f15bd | 2020-08-11 21:26:12 +1000 | [diff] [blame] | 12 | #include "chrome/knowledge/federated/example.pb.h" |
| 13 | #include "chrome/knowledge/federated/feature.pb.h" |
| 14 | #include "federated/mojom/example.mojom.h" |
| 15 | |
| 16 | namespace federated { |
| 17 | |
alanlxl | 9d26c1c | 2020-08-21 13:42:36 +1000 | [diff] [blame] | 18 | // The maximum of example count that are consumed in one federated computation |
| 19 | // round. |
| 20 | extern const size_t kMaxStreamingExampleCount; |
| 21 | // The minimum of example count that are required in one federated computation |
| 22 | // round. |
| 23 | extern const size_t kMinExampleCount; |
| 24 | extern const char kSessionStartedState[]; |
| 25 | extern const char kSessionStoppedState[]; |
| 26 | extern const char kUserDatabasePath[]; |
| 27 | extern const char kDatabaseFileName[]; |
| 28 | |
| 29 | // Gets the database file path with the given sanitized_username. |
| 30 | base::FilePath GetDatabasePath(const std::string& sanitized_username); |
| 31 | |
alanlxl | 30f15bd | 2020-08-11 21:26:12 +1000 | [diff] [blame] | 32 | // Converts the mojom Example struct to a TensorFlow Example proto. |
| 33 | tensorflow::Example ConvertToTensorFlowExampleProto( |
| 34 | const chromeos::federated::mojom::ExamplePtr& example); |
| 35 | |
| 36 | } // namespace federated |
| 37 | |
| 38 | #endif // FEDERATED_UTILS_H_ |