blocking_model_type_store.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright 2018 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_SYNC_MODEL_BLOCKING_MODEL_TYPE_STORE_H_
  5. #define COMPONENTS_SYNC_MODEL_BLOCKING_MODEL_TYPE_STORE_H_
  6. #include <memory>
  7. #include "components/sync/base/model_type.h"
  8. #include "components/sync/model/model_error.h"
  9. #include "components/sync/model/model_type_store_base.h"
  10. #include "third_party/abseil-cpp/absl/types/optional.h"
  11. namespace syncer {
  12. class MetadataBatch;
  13. // BlockingModelTypeStore represents a synchronous API for a leveldb-based
  14. // persistence layer, with support for metadata.
  15. class BlockingModelTypeStore : public ModelTypeStoreBase {
  16. public:
  17. virtual absl::optional<ModelError> ReadData(const IdList& id_list,
  18. RecordList* data_records,
  19. IdList* missing_id_list) = 0;
  20. virtual absl::optional<ModelError> ReadAllData(RecordList* data_records) = 0;
  21. virtual absl::optional<ModelError> ReadAllMetadata(
  22. MetadataBatch* metadata_batch) = 0;
  23. virtual std::unique_ptr<WriteBatch> CreateWriteBatch() = 0;
  24. virtual absl::optional<ModelError> CommitWriteBatch(
  25. std::unique_ptr<WriteBatch> write_batch) = 0;
  26. virtual absl::optional<ModelError> DeleteAllDataAndMetadata() = 0;
  27. };
  28. } // namespace syncer
  29. #endif // COMPONENTS_SYNC_MODEL_BLOCKING_MODEL_TYPE_STORE_H_