chromium/components/reporting/proto/synced/health.proto

// Copyright 2022 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/record_constants.proto";
import "components/reporting/proto/synced/status.proto";

// Information about records being removed from a storage queue.
message StorageDequeue {
  optional int64 sequencing_id = 1;  // required
  optional int64 records_count = 2;  // required
}

// Information about records being added to a storage queue.
message StorageEnqueue {
  optional int64 sequencing_id = 1;  // required
}

// Data about a record being added or removed from a storage queue
message StorageQueueAction {
  oneof action {
    StorageDequeue storage_dequeue = 1;
    StorageEnqueue storage_enqueue = 2;
  }
  optional Priority priority = 3;   // required
  optional StatusProto status = 4;  // OK if absent.
}

// Data about the EnqueueRecord dBus call.
message EnqueueRecordCall {
  optional Priority priority = 1;        // required
  optional Destination destination = 2;  // required
  optional StatusProto status = 3;       // OK if absent.
}

// Data about the FlushPriority dBus call.
message FlushPriorityCall {
  optional Priority priority = 1;   // required
  optional StatusProto status = 2;  // OK if absent.
}

// Single upload record item.
message UploadRecordItem {
  optional int64 sequencing_id = 1;  // required
}

// Single upload gap item.
message UploadGapItem {
  optional int64 sequencing_id = 1;  // required
  optional int64 count = 2;          // required
}

// Single upload item.
message UploadItem {
  oneof item {
    UploadRecordItem record = 1;
    UploadGapItem gap = 2;
  }
}

// Data about the UploadEncryptedRecord dBus call.
message UploadEncryptedRecordCall {
  repeated UploadItem items = 1;
  optional string upload_reason = 2;  // required
  optional Priority priority = 3;     // required
  optional StatusProto status = 4;    // OK if absent.
}

// Data about the ConfirmRecordUpload dBus call.
message ConfirmRecordUploadCall {
  optional int64 sequencing_id = 1;  // required
  optional bool force_confirm = 2;
  optional Priority priority = 3;   // required
  optional StatusProto status = 4;  // OK if absent.
}

// Data about a blocked record.
message BlockedRecordCall {
  optional Priority priority = 1;        // required
  optional Destination destination = 2;  // required
}

// Data about the list of blocked destinations received from the server.
message BlockedDestinationsUpdatedCall {
  repeated Destination destinations = 1;  // required
}

message HealthDataHistory {
  oneof record {
    EnqueueRecordCall enqueue_record_call = 1;
    FlushPriorityCall flush_priority_call = 2;
    UploadEncryptedRecordCall upload_encrypted_record_call = 3;
    ConfirmRecordUploadCall confirm_record_upload_call = 4;
    StorageQueueAction storage_queue_action = 5;
    BlockedRecordCall blocked_record_call = 7;
    BlockedDestinationsUpdatedCall blocked_destinations_updated_call = 8;
  }

  optional int64 timestamp_seconds = 6;  // required
}

// Aggregate health data of the ERP.
message ERPHealthData {
  repeated HealthDataHistory history = 1;  // required
}