chromium/components/history_embeddings/sql_database.cc

// Copyright 2024 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_embeddings/sql_database.h"

#include <algorithm>

#include "base/check.h"
#include "base/files/file_path.h"
#include "base/metrics/histogram_functions.h"
#include "base/sequence_checker.h"
#include "components/history_embeddings/history_embeddings_features.h"
#include "components/history_embeddings/passages_util.h"
#include "components/history_embeddings/proto/history_embeddings.pb.h"
#include "components/os_crypt/async/common/encryptor.h"
#include "sql/init_status.h"
#include "sql/meta_table.h"
#include "sql/transaction.h"

namespace history_embeddings {

// These database versions should roll together unless we develop migrations.
constexpr int kLowestSupportedDatabaseVersion =;
constexpr int kCurrentDatabaseVersion =;

namespace {

[[nodiscard]] bool InitSchema(sql::Database& db) {}

}  // namespace

SqlDatabase::SqlDatabase(const base::FilePath& storage_dir)
    :{}

SqlDatabase::~SqlDatabase() = default;

void SqlDatabase::SetEmbedderMetadata(EmbedderMetadata embedder_metadata,
                                      os_crypt_async::Encryptor encryptor) {}

bool SqlDatabase::LazyInit(bool force_init_for_deletion) {}

sql::InitStatus SqlDatabase::InitInternal(const base::FilePath& storage_dir,
                                          bool force_init_for_deletion) {}

void SqlDatabase::Close() {}

bool SqlDatabase::InsertOrReplacePassages(const UrlPassages& url_passages) {}

bool SqlDatabase::InsertOrReplaceEmbeddings(
    const UrlEmbeddings& url_embeddings) {}

// Gets the passages associated with `url_id`. Returns nullopt if there's
// nothing available.
std::optional<proto::PassagesValue> SqlDatabase::GetPassages(
    history::URLID url_id) {}

std::optional<UrlPassagesEmbeddings> SqlDatabase::GetUrlData(
    history::URLID url_id) {}

std::vector<UrlPassages> SqlDatabase::GetUrlPassagesWithoutEmbeddings() {}

size_t SqlDatabase::GetEmbeddingDimensions() const {}

bool SqlDatabase::AddUrlData(UrlPassagesEmbeddings url_data) {}

constexpr char kSqlSelectPassagesAndEmbeddings[] =;
constexpr char kSqlSelectPassagesAndEmbeddingsWithinTimeRange[] =;

std::unique_ptr<VectorDatabase::UrlDataIterator>
SqlDatabase::MakeUrlDataIterator(std::optional<base::Time> time_range_start) {}

bool SqlDatabase::DeleteDataForUrlId(history::URLID url_id) {}

bool SqlDatabase::DeleteDataForVisitId(history::VisitID visit_id) {}

bool SqlDatabase::DeleteAllData(bool delete_passages, bool delete_embeddings) {}

void SqlDatabase::DatabaseErrorCallback(int extended_error,
                                        sql::Statement* statement) {}

}  // namespace history_embeddings