chromium/components/optimization_guide/core/model_store_metadata_entry.cc

// 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.

#include "components/optimization_guide/core/model_store_metadata_entry.h"

#include "base/files/file_path.h"
#include "base/json/values_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/time/time.h"
#include "components/optimization_guide/core/model_util.h"
#include "components/optimization_guide/core/optimization_guide_features.h"
#include "components/optimization_guide/core/optimization_guide_prefs.h"
#include "components/optimization_guide/core/optimization_guide_switches.h"
#include "components/optimization_guide/core/optimization_guide_util.h"
#include "components/optimization_guide/proto/models.pb.h"
#include "components/prefs/pref_service.h"

namespace optimization_guide {

namespace {

// Key names for the metadata entries.
const char kKeyModelBaseDir[] =;
const char kKeyVersion[] =;
const char kKeyExpiryTime[] =;
const char kKeyKeepBeyondValidDuration[] =;

// Returns the hash of server returned ModelCacheKey for
// |client_model_cache_key| from |local_state|.
std::string GetServerModelCacheKeyHash(
    PrefService* local_state,
    proto::OptimizationTarget optimization_target,
    const proto::ModelCacheKey& client_model_cache_key) {}

std::optional<proto::OptimizationTarget> ParseOptimizationTarget(
    const std::string& optimization_target_str) {}

}  // namespace

// static
std::optional<ModelStoreMetadataEntry>
ModelStoreMetadataEntry::GetModelMetadataEntryIfExists(
    PrefService* local_state,
    proto::OptimizationTarget optimization_target,
    const proto::ModelCacheKey& model_cache_key) {}

// static
std::set<base::FilePath> ModelStoreMetadataEntry::GetValidModelDirs(
    PrefService* local_state) {}

ModelStoreMetadataEntry::ModelStoreMetadataEntry(
    const base::Value::Dict* metadata_entry)
    :{}

ModelStoreMetadataEntry::~ModelStoreMetadataEntry() = default;

std::optional<base::FilePath> ModelStoreMetadataEntry::GetModelBaseDir() const {}

std::optional<int64_t> ModelStoreMetadataEntry::GetVersion() const {}

base::Time ModelStoreMetadataEntry::GetExpiryTime() const {}

bool ModelStoreMetadataEntry::GetKeepBeyondValidDuration() const {}

void ModelStoreMetadataEntry::SetMetadataEntry(
    const base::Value::Dict* metadata_entry) {}

// static
void ModelStoreMetadataEntryUpdater::UpdateModelCacheKeyMapping(
    PrefService* local_state,
    proto::OptimizationTarget optimization_target,
    const proto::ModelCacheKey& client_model_cache_key,
    const proto::ModelCacheKey& server_model_cache_key) {}

ModelStoreMetadataEntryUpdater::ModelStoreMetadataEntryUpdater(
    PrefService* local_state,
    proto::OptimizationTarget optimization_target,
    const proto::ModelCacheKey& model_cache_key)
    :{}

void ModelStoreMetadataEntryUpdater::SetModelBaseDir(
    base::FilePath model_base_dir) {}

void ModelStoreMetadataEntryUpdater::SetVersion(int64_t version) {}

void ModelStoreMetadataEntryUpdater::SetExpiryTime(base::Time expiry_time) {}

void ModelStoreMetadataEntryUpdater::SetKeepBeyondValidDuration(
    bool keep_beyond_valid_duration) {}

void ModelStoreMetadataEntryUpdater::ClearMetadata() {}

std::vector<base::FilePath>
ModelStoreMetadataEntryUpdater::PurgeAllInactiveMetadata(
    PrefService* local_state) {}

}  // namespace optimization_guide