chromium/components/sync/model/data_type_store_impl.cc

// Copyright 2015 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/sync/model/data_type_store_impl.h"

#include <map>
#include <optional>
#include <utility>

#include "base/check_op.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/location.h"
#include "base/task/sequenced_task_runner.h"
#include "base/trace_event/trace_event.h"
#include "components/sync/model/blocking_data_type_store_impl.h"
#include "components/sync/model/metadata_batch.h"
#include "components/sync/model/model_error.h"

namespace syncer {

namespace {

std::optional<ModelError> ReadAllDataAndPreprocessOnBackendSequence(
    BlockingDataTypeStoreImpl* blocking_store,
    DataTypeStore::PreprocessCallback preprocess_on_backend_sequence_callback) {}

}  // namespace

DataTypeStoreImpl::DataTypeStoreImpl(
    DataType data_type,
    StorageType storage_type,
    std::unique_ptr<BlockingDataTypeStoreImpl, base::OnTaskRunnerDeleter>
        backend_store,
    scoped_refptr<base::SequencedTaskRunner> backend_task_runner)
    :{}

DataTypeStoreImpl::~DataTypeStoreImpl() {}

// Note on pattern for communicating with backend:
//  - API function (e.g. ReadData) allocates lists for output.
//  - API function prepares two callbacks: task that will be posted on backend
//    thread and reply which will be posted on data type thread once task
//    finishes.
//  - Task for backend thread takes raw pointers to output lists while reply
//    takes ownership of those lists. This allows backend interface to be simple
//    while ensuring proper objects' lifetime.
//  - Function bound by reply calls consumer's callback and passes ownership of
//    output lists to it.

void DataTypeStoreImpl::ReadData(const IdList& id_list,
                                 ReadDataCallback callback) {}

void DataTypeStoreImpl::ReadDataDone(ReadDataCallback callback,
                                     std::unique_ptr<RecordList> record_list,
                                     std::unique_ptr<IdList> missing_id_list,
                                     const std::optional<ModelError>& error) {}

void DataTypeStoreImpl::ReadAllData(ReadAllDataCallback callback) {}

void DataTypeStoreImpl::ReadAllDataDone(
    ReadAllDataCallback callback,
    std::unique_ptr<RecordList> record_list,
    const std::optional<ModelError>& error) {}

void DataTypeStoreImpl::ReadAllMetadata(ReadMetadataCallback callback) {}

void DataTypeStoreImpl::ReadAllMetadataDone(
    ReadMetadataCallback callback,
    std::unique_ptr<MetadataBatch> metadata_batch,
    const std::optional<ModelError>& error) {}

void DataTypeStoreImpl::ReadAllDataAndMetadata(
    ReadAllDataAndMetadataCallback callback) {}

void DataTypeStoreImpl::ReadMetadataAfterReadAllDataDone(
    ReadAllDataAndMetadataCallback callback,
    const std::optional<ModelError>& error,
    std::unique_ptr<RecordList> record_list) {}

void DataTypeStoreImpl::ReadAllDataAndMetadataDone(
    ReadAllDataAndMetadataCallback callback,
    std::unique_ptr<RecordList> record_list,
    const std::optional<ModelError>& error,
    std::unique_ptr<MetadataBatch> metadata_batch) {}

void DataTypeStoreImpl::ReadAllDataAndPreprocess(
    PreprocessCallback preprocess_on_backend_sequence_callback,
    CallbackWithResult completion_on_frontend_sequence_callback) {}

void DataTypeStoreImpl::ReadAllDataAndPreprocessDone(
    CallbackWithResult callback,
    const std::optional<ModelError>& error) {}

void DataTypeStoreImpl::DeleteAllDataAndMetadata(CallbackWithResult callback) {}

std::unique_ptr<DataTypeStore::WriteBatch>
DataTypeStoreImpl::CreateWriteBatch() {}

void DataTypeStoreImpl::CommitWriteBatch(
    std::unique_ptr<WriteBatch> write_batch,
    CallbackWithResult callback) {}

void DataTypeStoreImpl::WriteModificationsDone(
    CallbackWithResult callback,
    const std::optional<ModelError>& error) {}

}  // namespace syncer