chromium/components/history/core/browser/sync/history_sync_metadata_database.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/history/core/browser/sync/history_sync_metadata_database.h"

#include <memory>

#include "base/logging.h"
#include "base/numerics/byte_conversions.h"
#include "base/time/time.h"
#include "components/sync/model/metadata_batch.h"
#include "components/sync/protocol/entity_metadata.pb.h"
#include "sql/meta_table.h"
#include "sql/statement.h"

namespace history {

namespace {

// Key in sql::MetaTable, the value is a serialization of syner::DataTypeState,
// which tracks the overall sync state of the history datatype. Note that the
// table name uses the legacy name "model type state" as a historic artifact to
// avoid a data migration.
const char kHistoryDataTypeStateKey[] =;

}  // namespace

// Description of database table:
//
// history_sync_metadata
//   storage_key      The visit_time of an entry in the visits table (in
//                    microseconds since the windows epoch, serialized into a
//                    string in big-endian order), used to look up native data
//                    with sync metadata records.
//   value            Serialized sync EntityMetadata, which tracks the sync
//                    state of each history entity.

HistorySyncMetadataDatabase::HistorySyncMetadataDatabase(
    sql::Database* db,
    sql::MetaTable* meta_table)
    :{}

HistorySyncMetadataDatabase::~HistorySyncMetadataDatabase() = default;

bool HistorySyncMetadataDatabase::Init() {}

bool HistorySyncMetadataDatabase::GetAllSyncMetadata(
    syncer::MetadataBatch* metadata_batch) {}

bool HistorySyncMetadataDatabase::ClearAllEntityMetadata() {}

bool HistorySyncMetadataDatabase::UpdateEntityMetadata(
    syncer::DataType data_type,
    const std::string& storage_key,
    const sync_pb::EntityMetadata& metadata) {}

bool HistorySyncMetadataDatabase::ClearEntityMetadata(
    syncer::DataType data_type,
    const std::string& storage_key) {}

bool HistorySyncMetadataDatabase::UpdateDataTypeState(
    syncer::DataType data_type,
    const sync_pb::DataTypeState& data_type_state) {}

bool HistorySyncMetadataDatabase::ClearDataTypeState(
    syncer::DataType data_type) {}

// static
uint64_t HistorySyncMetadataDatabase::StorageKeyToMicrosSinceWindowsEpoch(
    const std::string& storage_key) {}

// static
std::string HistorySyncMetadataDatabase::StorageKeyFromMicrosSinceWindowsEpoch(
    uint64_t micros) {}

// static
base::Time HistorySyncMetadataDatabase::StorageKeyToVisitTime(
    const std::string& storage_key) {}

// static
std::string HistorySyncMetadataDatabase::StorageKeyFromVisitTime(
    base::Time visit_time) {}

bool HistorySyncMetadataDatabase::GetAllEntityMetadata(
    syncer::MetadataBatch* metadata_batch) {}

bool HistorySyncMetadataDatabase::GetDataTypeState(
    sync_pb::DataTypeState* state) {}

}  // namespace history