chromium/components/reporting/proto/synced/interface.proto

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

syntax = "proto2";

option optimize_for = LITE_RUNTIME;

package reporting;

import "components/reporting/proto/synced/health.proto";
import "components/reporting/proto/synced/record_constants.proto";
import "components/reporting/proto/synced/record.proto";
import "components/reporting/proto/synced/status.proto";

// ------------ CLIENT/USER REQUEST AND RESPONSES -----------------
// EnqueueRecordRequest enqueues records for encryption,
// storage, and upload.
message EnqueueRecordRequest {
  // Record the user wants to enqueue.
  optional Record record = 1;

  // Priority from
  // //chrome/cros/reporting/api/proto/synced/record_constants.proto
  // indicates what priority queue the record should be included in.
  optional Priority priority = 2;

  // Flag indicating health data logging state (`true` means "enable logging").
  // Can only be present when originating from Ash.
  optional bool health_data_logging_enabled = 3 [default = false];
}

// EnqueueRecordResponse indicates the enqueue success or
// failure.
message EnqueueRecordResponse {
  // Indicates success or failure of EnqueueRecordRequest.
  // Specific error codes indicate if a retry is appropriate.
  // Expected errors:
  //   FAILED_PRECONDITION:
  //     "The daemon is unable to locate the public key for record encryption."
  //     - Not Retryable
  //   FAILED_PRECONDITION:
  //     "The daemon has insufficient permissions to read/write from/to disk"
  //     - Not Retryable
  //   FAILED_PRECONDITION:
  //     "Policy controlling daemon is either unset or off."
  //     - Not Retryable
  //   UNAVAILABLE:
  //     "The daemon is still starting."
  //     - Retryable
  //   RESOURCE_EXHAUSTED:
  //     "The daemon has no available threads for processing"
  //     - Retryable
  optional StatusProto status = 1;

  // Portion of debug logging (if enabled).
  optional ERPHealthData health_data = 2;
}

// FlushPriorityRequest requests that the indicated priority
// queue is flushed (records are uploaded to the server).
message FlushPriorityRequest {
  // Priority of the desired queue. Defaults to MANUAL_BATCH.
  optional Priority priority = 1 [default = MANUAL_BATCH];

  // Flag indicating health data logging state (`true` means "enable logging").
  // Can only be present when originating from Ash.
  optional bool health_data_logging_enabled = 2 [default = false];
}

// FlushPriorityResponse indicates success or failure of
// processing FlushPriorityRequest.
message FlushPriorityResponse {
  // Indicates success or failure of FlushPriorityRequest.
  // Specific error codes indicate if a retry is appropriate.
  // Expected errors:
  //   FAILED_PRECONDITION:
  //     "The daemon is unable to locate the public key for record encryption."
  //     - Not Retryable
  //   FAILED_PRECONDITION:
  //     "The daemon has insufficient permissions to read/write from/to disk"
  //     - Not Retryable
  //   FAILED_PRECONDITION:
  //     "Policy controlling daemon is either unset or off."
  //     - Not Retryable
  //   UNAVAILABLE:
  //     "The daemon is still starting."
  //     - Retryable
  optional StatusProto status = 1;

  // Portion of debug logging (if enabled).
  optional ERPHealthData health_data = 2;
}

// --------------- CHROME CALLS AND RESPONSES -------------------
// Daemon DBus call to Chrome for uploading records. The Daemon sends a
// batch of records, and the Upload Service accepts as many (but at least
// one) as it can for upload. Records not sent for upload can be sent again
// at a later time.
message UploadEncryptedRecordRequest {
  repeated EncryptedRecord encrypted_record = 1;

  // Must be either true or absent. If true, server should send the server's
  // public values in the next response. It corresponds to the
  // "attachEncryptionSettings" field in the payload.
  optional bool need_encryption_keys = 2;

  // The remaining storage capacity in bytes.
  optional uint64 remaining_storage_capacity = 3;

  // The rate (bytes/sec) at which new events are added to the storage.
  optional uint64 new_events_rate = 4;

  // Portion of debug logging (if enabled).
  optional ERPHealthData health_data = 5;
}

message UploadEncryptedRecordResponse {
  // Status indicates if the records will be uploaded.
  // Expected Errors:
  //    UNAVAILABLE:
  //      "No internet connection. Unable to upload records at this time."
  //      - Retryable
  //    FAILED_PRECONDITION:
  //      "Policy controlling reporting upload is unset or off."
  //      - Not Retryable
  optional StatusProto status = 1;

  // Flag indicating that missived should be disabled, if set to `true`:
  // for example, because Chrome got a bad (dummy) API key - see b/239253702.
  optional bool disable = 2 [default = false];

  // Flag indicating health data logging state (`true` means "enable logging").
  // Can only be present when originating from Ash.
  optional bool health_data_logging_enabled = 3 [default = false];

  // List of sequence ids that are cached by Ash.
  // `missived` will not send to Ash the records with listed sequence ids.
  // Backwards compatibility: absent from responses by earlier Ash builds and
  // ignored by earlier `missived` builds.
  repeated int64 cached_events_seq_ids = 4;
}

// ConfirmRecordUploadRequest is expected to only come from
// Chrome and indicates the record with the provided
// SequenceInformation successfully uploaded. It is
// only sent by Chrome after a successful upload.
message ConfirmRecordUploadRequest {
  // SequenceInformation of the successfully uploaded record.
  // SequenceInformation is part of the UploadEncryptedRecordRequest
  // sent to Chrome.
  optional SequenceInformation sequence_information = 1;

  // If true, daemon should update to the provided sequence_information
  // regardless of its current state.
  optional bool force_confirm = 2;

  // Flag indicating health data logging state (`true` means "enable logging").
  // Can only be present when originating from Ash.
  optional bool health_data_logging_enabled = 3 [default = false];
}

// ConfirmRecordUploadResponse indicates that the request was
// successfully resolved. In the event that the daemon is unable
// to process the ConfirmRecordUploadeRequest it is safe to drop it.
// On the next upload, the server will ignore all records with
// SequenceInformation lower than the highest it has processed.
// The next ConfirmRecordUploadRequest will ensure that they are
// deleted from disk. Some data transmission will be repeated, but
// data will not be lost.
message ConfirmRecordUploadResponse {
  // Indicates success or failure of ConfirmRecordUploadRequest.
  // Specific error codes indicate if a retry is appropriate.
  // Expected errors:
  //   FAILED_PRECONDITION:
  //     "The daemon has insufficient permissions to read/write from/to disk"
  //     - Not Retryable
  //   FAILED_PRECONDITION:
  //     "Policy controlling daemon is either unset or off."
  //     - Not Retryable
  //   UNAVAILABLE:
  //     "The daemon is still starting."
  //     - Retryable
  optional StatusProto status = 1;

  // Portion of debug logging (if enabled).
  optional ERPHealthData health_data = 2;
}

// UpdateEncryptionKeyRequest sends a SignedEncryptionInfo to the daemon.
message UpdateEncryptionKeyRequest {
  optional SignedEncryptionInfo signed_encryption_info = 1;
}

message UpdateEncryptionKeyResponse {
  // Indicates success or failure of UpdateEncryptionKeyRequest.
  // Specific error codes indicate if a retry is appropriate.
  // Expected errors:
  //   FAILED_PRECONDITION:
  //     "The daemon has insufficient permissions to read/write from/to disk"
  //     - Not Retryable
  //   FAILED_PRECONDITION:
  //     "Policy controlling daemon is either unset or off."
  //     - Not Retryable
  //   UNAVAILABLE:
  //     "The daemon is still starting."
  //     - Retryable
  optional StatusProto status = 1;
}

// UpdateConfigInMissiveRequest sends a the information received from the
// server configuration file that missive needs.
message UpdateConfigInMissiveRequest {
  // Repeated field for the blocked destinations gotten from the configuration
  // file fetched from the server.
  optional ListOfBlockedDestinations list_of_blocked_destinations = 1;
}

message UpdateConfigInMissiveResponse {
  // Indicates success or failure of UpdateEncryptionKeyRequest.
  // Specific error codes indicate if a retry is appropriate.
  // Expected errors:
  //   FAILED_PRECONDITION:
  //     "The daemon has insufficient permissions to read/write from/to disk"
  //     - Not Retryable
  //   FAILED_PRECONDITION:
  //     "Policy controlling daemon is either unset or off."
  //     - Not Retryable
  //   UNAVAILABLE:
  //     "The daemon is still starting."
  //     - Retryable
  optional StatusProto status = 1;
}