blob: 98d18deca8c713b6282a9f996c2c83b0b3d10c56 [file] [log] [blame]
alanlxl30f15bd2020-08-11 21:26:12 +10001// 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
alanlxl9d26c1c2020-08-21 13:42:36 +10008#include <string>
9
10#include <base/files/file_path.h>
11
alanlxl30f15bd2020-08-11 21:26:12 +100012#include "chrome/knowledge/federated/example.pb.h"
13#include "chrome/knowledge/federated/feature.pb.h"
14#include "federated/mojom/example.mojom.h"
15
16namespace federated {
17
alanlxl9d26c1c2020-08-21 13:42:36 +100018// The maximum of example count that are consumed in one federated computation
19// round.
20extern const size_t kMaxStreamingExampleCount;
21// The minimum of example count that are required in one federated computation
22// round.
23extern const size_t kMinExampleCount;
24extern const char kSessionStartedState[];
25extern const char kSessionStoppedState[];
26extern const char kUserDatabasePath[];
27extern const char kDatabaseFileName[];
28
29// Gets the database file path with the given sanitized_username.
30base::FilePath GetDatabasePath(const std::string& sanitized_username);
31
alanlxl30f15bd2020-08-11 21:26:12 +100032// Converts the mojom Example struct to a TensorFlow Example proto.
33tensorflow::Example ConvertToTensorFlowExampleProto(
34 const chromeos::federated::mojom::ExamplePtr& example);
35
36} // namespace federated
37
38#endif // FEDERATED_UTILS_H_