chromium/components/optimization_guide/proto/hint_cache.proto

// Copyright 2019 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 optimization_guide.proto;

import "components/optimization_guide/proto/hints.proto";
import "components/optimization_guide/proto/models.proto";

// The types of StoreEntries.
//
// The values should match those of
// components/optimization_guide/core/optimization_guide_store.h
enum StoreEntryType {
  // StoreEntryType when the entry type is unknown.
  EMPTY = 0;
  // StoreEntryType when storing a metadata entry, which holds metadata about
  // the store and the set of entries for a particular source, fetched or
  // component.
  METADATA = 1;
  // StoreEntryType when storing a component hint entry, holds a hint that was
  // provided by a component update. The version should be provided.
  COMPONENT_HINT = 2;
  // StoreEntryType when storing a fetched hint entry, holds a hint that was
  // fetched from the remote Optimization Guide Service. |update_time_secs|
  // should be provided.
  FETCHED_HINT = 3;
  // StoreEntryType when storing a prediction model entry, holds a prediction
  // model provided by the remote Optimization Guide Service.
  PREDICTION_MODEL = 4;
  // StoreEntryType when storing a host model features entry, holds the model
  // features keyed provided by host from the remote Optimization Guide
  // Service. |update_time_secs| should be provided.
  DEPRECATED_HOST_MODEL_FEATURES = 5 [deprecated = true];
}

message StoreEntry {
  reserved 7;

  // Generic version field. For the schema metadata entry, version represents
  // the schema version; for the component metadata entry, version represents
  // the component version.
  optional string version = 1;
  // The actual hint data.
  optional Hint hint = 2;
  // Time when top host fetched hints are still usable but update should be
  // requested. This is set on the fetched metadata entry and host model feature
  // metadata entries.
  optional int64 update_time_secs = 3;
  // The type of entry stored.
  optional StoreEntryType entry_type = 4;
  // Expiry time for this Hint entry (i.e., when hint is no longer usable). This
  // is set on OnePlatform Hint entries, as well as PredictionModel entries.
  optional int64 expiry_time_secs = 5;
  // The actual PredictionModel data.
  optional PredictionModel prediction_model = 6;
  // Whether to delete a model once expiry_time_secs is past.
  optional bool keep_beyond_valid_duration = 8;
}