Sync federated mojom files from Chromium OS side
Bug: 1125906 Test: None Change-Id: I1da249ca0eac1bf81648ef2151e854c77df61b59 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2489124 Reviewed-by: Xiyuan Xia <xiyuan@chromium.org> Reviewed-by: Andrew Moylan <amoylan@chromium.org> Commit-Queue: Xinglong Luan <alanlxl@chromium.org> Cr-Commit-Position: refs/heads/master@{#886116}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
88a387abd2
commit
46b87797c2
chromeos/services/federated/public/mojom
14
chromeos/services/federated/public/mojom/BUILD.gn
Normal file
14
chromeos/services/federated/public/mojom/BUILD.gn
Normal file
@ -0,0 +1,14 @@
|
||||
# Copyright 2021 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import("//mojo/public/tools/bindings/mojom.gni")
|
||||
|
||||
mojom("mojom") {
|
||||
sources = [
|
||||
"example.mojom",
|
||||
"federated_service.mojom",
|
||||
]
|
||||
|
||||
public_deps = [ "//mojo/public/mojom/base" ]
|
||||
}
|
2
chromeos/services/federated/public/mojom/OWNERS
Normal file
2
chromeos/services/federated/public/mojom/OWNERS
Normal file
@ -0,0 +1,2 @@
|
||||
per-file *.mojom=set noparent
|
||||
per-file *.mojom=file://ipc/SECURITY_OWNERS
|
49
chromeos/services/federated/public/mojom/example.mojom
Normal file
49
chromeos/services/federated/public/mojom/example.mojom
Normal file
@ -0,0 +1,49 @@
|
||||
// Copyright 2021 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Datatypes used in the Federated Service API.
|
||||
// This module is derived from the Feature and Example proto definition of
|
||||
// TensorFlow. See /tensorflow/core/example/feature.proto and
|
||||
// /tensorflow/core/example/example.proto in the TensorFlow code.
|
||||
|
||||
// NOTE: This mojom should exist in two places and must be kept in sync:
|
||||
// Chromium: src/chromeos/services/federated/public/mojom/
|
||||
// Chrome OS: src/platform2/federated/mojom/
|
||||
// Note: Other repos downstream of Chromium might also use this mojom.
|
||||
// Example: A backwards-compatible mojom change (and corresponding
|
||||
// implementation change) can be made in Chrome OS first, then replicated to the
|
||||
// clients (Chromium, other downstream repos) later.
|
||||
// TODO(alanlxl): config a sync tool for federated mojo files.
|
||||
|
||||
module chromeos.federated.mojom;
|
||||
|
||||
struct StringList {
|
||||
array<string> value;
|
||||
};
|
||||
|
||||
struct FloatList {
|
||||
array<double> value;
|
||||
};
|
||||
|
||||
struct Int64List {
|
||||
array<int64> value;
|
||||
};
|
||||
|
||||
// The union of all supported value types.
|
||||
union ValueList {
|
||||
StringList string_list;
|
||||
FloatList float_list;
|
||||
Int64List int64_list;
|
||||
};
|
||||
|
||||
// The mirror of tensorflow::Features.
|
||||
struct Features {
|
||||
// Map from feature name to feature.
|
||||
map<string, ValueList> feature;
|
||||
};
|
||||
|
||||
// The mirror of tensorflow::Example.
|
||||
struct Example {
|
||||
Features features;
|
||||
};
|
@ -0,0 +1,28 @@
|
||||
// Copyright 2021 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Top-level API of the Federated Service: report an example.
|
||||
|
||||
// NOTE: This mojom should exist in two places and must be kept in sync:
|
||||
// Chromium: //chromeos/services/federated/public/mojom
|
||||
// Chrome OS: src/platform2/federated/mojom/
|
||||
|
||||
module chromeos.federated.mojom;
|
||||
|
||||
// NOTE: The base directory for 'import' statements is expected to differ
|
||||
// between Chromium and Chrome OS versions of this file.
|
||||
import "chromeos/services/federated/public/mojom/example.mojom";
|
||||
|
||||
// Top-level interface between Chromium and the Federated Service daemon.
|
||||
// Next ordinal: 2
|
||||
interface FederatedService {
|
||||
// Binds another pipe to this instance.
|
||||
Clone@0(pending_receiver<FederatedService> receiver);
|
||||
|
||||
// Stores `example` in cryptohome-backed storage for use during future
|
||||
// scheduled federated analytics or ML model training, identified by
|
||||
// `client_id`.
|
||||
// Examples are deleted when they are used for federated analytics/training.
|
||||
ReportExample@1(string client_name, Example example);
|
||||
};
|
Reference in New Issue
Block a user