chromium/components/sync/model/data_type_store_with_in_memory_cache.h

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

#ifndef COMPONENTS_SYNC_MODEL_DATA_TYPE_STORE_WITH_IN_MEMORY_CACHE_H_
#define COMPONENTS_SYNC_MODEL_DATA_TYPE_STORE_WITH_IN_MEMORY_CACHE_H_

#include <map>
#include <memory>
#include <string>

#include "base/functional/callback_forward.h"
#include "components/sync/base/data_type.h"
#include "components/sync/model/data_type_store.h"
#include "components/sync/model/data_type_store_base.h"
#include "components/sync/model/model_error.h"

namespace syncer {

class MetadataBatch;
class MetadataChangeList;

// A convenience class that wraps around a DataTypeStore, but also maintains a
// cache of all the data (not metadata) in memory. It only implements a subset
// of the full DataTypeStore API, specifically the parts that are usually
// required by commit-only data types (i.e. the ones that need the in-memory
// cache).
// `Entry` is meant to be a proto, since the class performs proto serialization
// and deserialization.
// NOTE: This template class has explicit instantiations for all required entry
// types at the end of the .cc file. If you want to use it with a new entry
// type, add a corresponding specialization there!
template <typename Entry>
class DataTypeStoreWithInMemoryCache {};

}  // namespace syncer

#endif  // COMPONENTS_SYNC_MODEL_DATA_TYPE_STORE_WITH_IN_MEMORY_CACHE_H_