entity_metadata.proto 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. // If you change or add any fields in this file, update proto_visitors.h and
  5. // potentially proto_enum_conversions.{h, cc}.
  6. syntax = "proto2";
  7. option java_multiple_files = true;
  8. option java_package = "org.chromium.components.sync.protocol";
  9. option optimize_for = LITE_RUNTIME;
  10. package sync_pb;
  11. import "components/sync/protocol/entity_specifics.proto";
  12. import "components/sync/protocol/unique_position.proto";
  13. // Sync proto to store entity metadata in model type storage.
  14. message EntityMetadata {
  15. // A hash based on the client tag and model type.
  16. // Used for various map lookups. Should always be available.
  17. // Sent to the server as SyncEntity::client_defined_unique_tag.
  18. optional string client_tag_hash = 1;
  19. // The entity's server-assigned ID.
  20. //
  21. // Prior to the item's first commit, we leave this value as an empty string.
  22. // The initial ID for a newly created item has to meet certain uniqueness
  23. // requirements, and we handle those on the sync thread.
  24. optional string server_id = 2;
  25. // Whether or not the entity is deleted.
  26. optional bool is_deleted = 3;
  27. // A version number used to track in-progress commits. Each local change
  28. // increments this number.
  29. optional int64 sequence_number = 4;
  30. // The sequence number of the last item known to be successfully committed.
  31. optional int64 acked_sequence_number = 5;
  32. // The server version on which this item is based.
  33. //
  34. // If there are no local changes, this is the version of the entity as we see
  35. // it here.
  36. //
  37. // If there are local changes, this is the version of the entity on which
  38. // those changes are based.
  39. optional int64 server_version = 6 [default = -1];
  40. // Entity creation and modification timestamps. Assigned by the client and
  41. // synced by the server, though the server usually doesn't bother to inspect
  42. // their values. They are encoded as milliseconds since the Unix epoch.
  43. optional int64 creation_time = 7;
  44. optional int64 modification_time = 8;
  45. // A hash of the current entity specifics value. Used to detect whether
  46. // entity's specifics value has changed without having to keep specifics in
  47. // memory.
  48. optional string specifics_hash = 9;
  49. // A hash of the last specifics known by both the client and server. Used to
  50. // detect when local commits and remote updates are just for encryption. This
  51. // value will be the empty string only in the following cases: the entity is
  52. // in sync with the server, has never been synced, or is deleted.
  53. optional string base_specifics_hash = 10;
  54. // Used for positioning entities among their siblings. Relevant only for data
  55. // types that support positions (e.g bookmarks). Refer to its definition in
  56. // unique_position.proto for more information about its internal
  57. // representation.
  58. optional UniquePosition unique_position = 11;
  59. // Used only for bookmarks. It's analogous to |specifics_hash| but it
  60. // exclusively hashes the content of the favicon image, as represented in
  61. // proto field BookmarkSpecifics.favicon, using base::PersistentHash().
  62. optional fixed32 bookmark_favicon_hash = 12;
  63. // Last specifics known by both the client and server. Used during commits to
  64. // the server in order to prevent data loss caused by older clients dealing
  65. // with unknown proto fields (fields that were introduced later). Datatypes
  66. // (ModelTypeSyncBridge) may implement logic to trim down (or fully clear)
  67. // this proto prior to caching, to avoid the memory and I/O overhead of
  68. // dealing with an extra copy of the data. Introduced in M101.
  69. optional EntitySpecifics possibly_trimmed_base_specifics = 13;
  70. }