Lines Matching refs:entry
84 def GetEntryType(entry): argument
95 if entry.server_defined_unique_tag == TOP_LEVEL_FOLDER_TAG:
97 entry_types = GetEntryTypesFromSpecifics(entry.specifics)
283 def _SaveEntry(self, entry): argument
296 entry.version = self._version
297 entry.sync_timestamp = self._version
301 base_entry = self._entries.get(entry.id_string)
303 entry.originator_cache_guid = base_entry.originator_cache_guid
304 entry.originator_client_item_id = base_entry.originator_client_item_id
306 self._entries[entry.id_string] = DeepCopyOfProto(entry)
355 def _WritePosition(self, entry, parent_id, prev_id=None): argument
379 if current_limit_entry.id_string == entry.id_string:
388 if prev_id == entry.id_string:
392 entry.position_in_parent = 0
395 entry.position_in_parent = ExtendRange(siblings[0], -1)
401 elif successor.id_string == entry.id_string:
403 entry.position_in_parent = successor.position_in_parent
407 entry.position_in_parent = (item.position_in_parent * 7 +
412 entry.position_in_parent = ExtendRange(siblings[-1], +1)
414 entry.parent_id_string = parent_id
415 entry.ClearField('insert_after_item_id')
433 entry = sync_pb2.SyncEntity()
434 entry.id_string = id_string
435 entry.non_unique_name = spec.name
436 entry.name = spec.name
437 entry.server_defined_unique_tag = spec.tag
438 entry.folder = True
439 entry.deleted = False
440 entry.specifics.CopyFrom(GetDefaultEntitySpecifics(spec.sync_type))
441 self._WritePosition(entry, self._ServerTagToId(spec.parent_tag))
442 self._SaveEntry(entry)
494 def _CopyOverImmutableFields(self, entry): argument
500 if entry.id_string in self._entries:
501 if self._entries[entry.id_string].HasField(
503 entry.server_defined_unique_tag = (
504 self._entries[entry.id_string].server_defined_unique_tag)
506 def _CheckVersionForCommit(self, entry): argument
519 if entry.id_string in self._entries:
521 return (self._entries[entry.id_string].version == entry.version or
522 self._entries[entry.id_string].deleted)
525 return entry.version == 0
527 def _CheckParentIdForCommit(self, entry): argument
537 if entry.parent_id_string == ROOT_ID:
540 if entry.parent_id_string not in self._entries:
543 if entry.parent_id_string == entry.id_string:
546 if self._entries[entry.parent_id_string].deleted:
549 if not self._entries[entry.parent_id_string].folder:
554 def _RewriteIdsAsServerIds(self, entry, cache_guid, commit_session): argument
570 if entry.version == 0:
571 if entry.HasField('client_defined_unique_tag'):
573 new_id = self._ClientTagToId(entry.client_defined_unique_tag)
575 new_id = self._ClientIdToId(cache_guid, entry.id_string)
576 entry.originator_cache_guid = cache_guid
577 entry.originator_client_item_id = entry.id_string
578 commit_session[entry.id_string] = new_id # Remember the remapping.
579 entry.id_string = new_id
580 if entry.parent_id_string in commit_session:
581 entry.parent_id_string = commit_session[entry.parent_id_string]
582 if entry.insert_after_item_id in commit_session:
583 entry.insert_after_item_id = commit_session[entry.insert_after_item_id]
585 def CommitEntry(self, entry, cache_guid, commit_session): argument
600 entry = DeepCopyOfProto(entry)
605 self._RewriteIdsAsServerIds(entry, cache_guid, commit_session)
610 if not self._CheckVersionForCommit(entry):
615 if not self._CheckParentIdForCommit(entry):
618 self._CopyOverImmutableFields(entry);
625 if entry.deleted:
654 if self._entries[child_id].parent_id_string == entry.id_string:
667 entry = MakeTombstone(entry.id_string)
678 if entry.HasField('insert_after_item_id'):
679 self._WritePosition(entry, entry.parent_id_string,
680 entry.insert_after_item_id)
682 self._WritePosition(entry, entry.parent_id_string)
686 base_entry = self._entries.get(entry.id_string)
687 if base_entry and not entry.HasField('originator_cache_guid'):
688 entry.originator_cache_guid = base_entry.originator_cache_guid
689 entry.originator_client_item_id = base_entry.originator_client_item_id
692 self._SaveEntry(entry)
693 return entry
783 for entry in commit_message.entries:
787 server_entry = self.account.CommitEntry(entry, guid, session)
809 reply.version = entry.version + 1
825 for entry in entries:
827 reply.CopyFrom(entry)