metadata_change_list.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // Copyright 2015 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_METADATA_CHANGE_LIST_H_
  5. #define COMPONENTS_SYNC_MODEL_METADATA_CHANGE_LIST_H_
  6. #include <string>
  7. namespace sync_pb {
  8. class EntityMetadata;
  9. class ModelTypeState;
  10. } // namespace sync_pb
  11. namespace syncer {
  12. // Interface used by the processor and service to communicate about metadata.
  13. // The purpose of the interface is to record changes to data type global and
  14. // per entity metadata for the purpose of propagating changes to the datatype
  15. // specific storage implementation.
  16. // The implementation of the interface is supposed to keep the record of all
  17. // updated / deleted metadata records and provide a mechanism to enumerate
  18. // them. If there are multiple UpdateMetadata / ClearMetadata calls made for the
  19. // same metadata record the last one is supposed to win.
  20. class MetadataChangeList {
  21. public:
  22. MetadataChangeList() {}
  23. virtual ~MetadataChangeList() {}
  24. // Requests ModelTypeState to be updated in the storage.
  25. virtual void UpdateModelTypeState(
  26. const sync_pb::ModelTypeState& model_type_state) = 0;
  27. // Requests ModelTypeState to be cleared from the storage.
  28. virtual void ClearModelTypeState() = 0;
  29. // Requests metadata entry to be updated in the storage.
  30. // Please note that the update might contain a deleted entry if
  31. // metadata.is_deleted() is true (as opposed to clearing the entry from the
  32. // storage completely by calling the Clear method).
  33. virtual void UpdateMetadata(const std::string& storage_key,
  34. const sync_pb::EntityMetadata& metadata) = 0;
  35. // Requests metadata entry to be cleared from the storage.
  36. virtual void ClearMetadata(const std::string& storage_key) = 0;
  37. };
  38. } // namespace syncer
  39. #endif // COMPONENTS_SYNC_MODEL_METADATA_CHANGE_LIST_H_