chromium/chromeos/ash/services/federated/public/mojom/federated_service.mojom

// Copyright 2021 The Chromium Authors
// 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/ash/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/ash/services/federated/public/mojom/example.mojom";
import "chromeos/ash/services/federated/public/mojom/tables.mojom";

// Config struct used by `StartSchedulingWithConfig` that indicates the launch
// stage and the table id for the example storage of a client. Two clients may
// share the same example collection by specifying the same
// `example_storage_table_id`.
[Stable]
struct ClientScheduleConfig {
  string client_name@0;
  string launch_stage@1;
  FederatedExampleTableId example_storage_table_id@2;
};


// Top-level interface between Chromium and the Federated Service daemon.
// Next MinVersion: 3
// Next ordinal: 5
interface FederatedService {
  // Binds another pipe to this instance.
  Clone@0(pending_receiver<FederatedService> receiver);

  // NOTE FOR AUTHORS AND REVIEWERS:
  // Any use of this API must go through the ChromeOS launch process,
  // including Privacy review. See ../README.md for more details.
  // Stores `example` in cryptohome-backed storage for use during future
  // scheduled federated analytics or ML model training, identified by
  // `table_name`.
  // Examples are deleted when they expire.
  ReportExample@1(string table_name, Example example);

  // Starts scheduling federated training tasks if they are not scheduled yet,
  // otherwise does nothing.
  // `client_launch_stage` indicates the launch stage each client should try to
  // check in with the server. Does nothing if `client_launch_stage` is not
  // provided or empty.
  StartScheduling@2([MinVersion=1] map<string, string>? client_launch_stage);

  // Similar to `ReportExample` but takes the table_id instead of table_name.
  [MinVersion=2]ReportExampleToTable@3(
      FederatedExampleTableId table_id, Example example);

  // Starts scheduling federated training tasks for the given `client_configs`.
  // Does nothing if the federated service already schedules tasks.
  [MinVersion=2]StartSchedulingWithConfig@4(
      array<ClientScheduleConfig> client_configs);
};