Home | History | Annotate | Download | only in syncable

Lines Matching defs:Entry

65 // Max number of milliseconds to spend checking syncable entry invariants
96 // A ScopedIndexUpdater temporarily removes an entry from an index,
109 EntryKernel* entry,
111 : entry_(entry),
126 // The entry that was temporarily removed from the index.
134 void InitializeIndexEntry(EntryKernel* entry,
136 if (Indexer::ShouldInclude(entry)) {
137 index->insert(entry);
366 EntryKernel* entry = *it;
367 InitializeIndexEntry<ParentIdAndHandleIndexer>(entry,
369 InitializeIndexEntry<IdIndexer>(entry, kernel_->ids_index);
370 InitializeIndexEntry<ClientTagIndexer>(entry, kernel_->client_tag_index);
371 if (entry->ref(IS_UNSYNCED))
372 kernel_->unsynced_metahandles->insert(entry->ref(META_HANDLE));
373 if (entry->ref(IS_UNAPPLIED_UPDATE))
374 kernel_->unapplied_update_metahandles->insert(entry->ref(META_HANDLE));
375 DCHECK(!entry->is_dirty());
504 void ZeroFields(EntryKernel* entry, int first_field) {
509 entry->put(static_cast<Int64Field>(i), 0);
511 entry->mutable_ref(static_cast<IdField>(i)).Clear();
513 entry->put(static_cast<BitField>(i), false);
516 entry
519 void Directory::InsertEntry(EntryKernel* entry) {
521 InsertEntry(entry, &lock);
524 void Directory::InsertEntry(EntryKernel* entry, ScopedKernelLock* lock) {
526 CHECK(NULL != entry);
527 static const char error[] = "Entry already in memory index.";
528 CHECK(kernel_->metahandles_index->insert(entry).second) << error;
530 if (!entry->ref(IS_DEL)) {
531 CHECK(kernel_->parent_id_child_index->insert(entry).second) << error;
533 CHECK(kernel_->ids_index->insert(entry).second) << error;
536 CHECK(entry->ref(UNIQUE_CLIENT_TAG).empty());
539 bool Directory::ReindexId(EntryKernel* const entry, const Id& new_id) {
546 ScopedIndexUpdater<IdIndexer> updater_a(lock, entry, kernel_->ids_index);
547 ScopedIndexUpdater<ParentIdAndHandleIndexer> updater_b(lock, entry,
549 entry->put(ID, new_id);
554 void Directory::ReindexParentId(EntryKernel* const entry,
560 ScopedIndexUpdater<ParentIdAndHandleIndexer> index_updater(lock, entry,
562 entry->put(PARENT_ID, new_parent_id);
571 bool Directory::SafeToPurgeFromMemory(const EntryKernel* const entry) const {
572 bool safe = entry->ref(IS_DEL) && !entry->is_dirty() &&
573 !entry->ref(SYNCING) && !entry->ref(IS_UNAPPLIED_UPDATE) &&
574 !entry->ref(IS_UNSYNCED);
577 int64 handle = entry->ref(META_HANDLE);
595 EntryKernel* entry = GetEntryByHandle(*i, &lock);
596 if (!entry)
599 if (!entry->is_dirty())
601 snapshot->dirty_metas.insert(snapshot->dirty_metas.end(), *entry);
605 entry->clear_dirty(NULL);
655 EntryKernel* entry = (found == kernel_->metahandles_index->end() ?
657 if (entry && SafeToPurgeFromMemory(entry)) {
661 int64 handle = entry->ref(META_HANDLE);
663 num_erased = kernel_->ids_index->erase(entry);
665 num_erased = kernel_->metahandles_index->erase(entry);
669 num_erased = kernel_->client_tag_index->erase(entry);
670 DCHECK_EQ(entry->ref(UNIQUE_CLIENT_TAG).empty(), !num_erased);
671 CHECK(!kernel_->parent_id_child_index->count(entry));
672 delete entry;
705 EntryKernel* entry = *it;
706 num_erased = kernel_->ids_index->erase(entry);
708 num_erased = kernel_->client_tag_index->erase(entry);
709 DCHECK_EQ(entry->ref(UNIQUE_CLIENT_TAG).empty(), !num_erased);
711 DCHECK_EQ(entry->ref(IS_UNSYNCED), num_erased > 0);
713 DCHECK_EQ(entry->ref(IS_UNAPPLIED_UPDATE), num_erased > 0);
714 num_erased = kernel_->parent_id_child_index->erase(entry);
715 DCHECK_EQ(entry->ref(IS_DEL), !num_erased);
717 delete entry;
969 Entry e(trans, GET_BY_HANDLE, i->ref(META_HANDLE));
982 // syncable entry. Need to redesign this.
992 Entry e(trans, GET_BY_HANDLE, *i);
1010 Entry e(trans, GET_BY_HANDLE, metahandle);
1030 Entry parent(trans, GET_BY_ID, parentid);
1232 void WriteTransaction::SaveOriginal(EntryKernel* entry) {
1233 if (NULL == entry)
1235 OriginalEntries::iterator i = originals_->lower_bound(*entry);
1237 i->ref(META_HANDLE) != entry->ref(META_HANDLE)) {
1238 originals_->insert(i, *entry);
1255 // Entry
1257 Entry::Entry(BaseTransaction* trans, GetById, const Id& id)
1262 Entry::Entry(BaseTransaction* trans, GetByClientTag, const string& tag)
1267 Entry::Entry(BaseTransaction* trans, GetByServerTag, const string& tag)
1272 Entry::Entry(BaseTransaction* trans, GetByHandle, int64 metahandle)
1277 Directory* Entry::dir() const {
1281 Id Entry::ComputePrevIdFromServerPosition(const Id& parent_id) const {
1285 DictionaryValue* Entry::ToValue() const {
1303 const string& Entry::Get(StringField field) const {
1308 syncable::ModelType Entry::GetServerModelType() const {
1325 syncable::ModelType Entry::GetServerModelTypeHelper() const {
1339 syncable::ModelType Entry::GetModelType() const {
1358 : Entry(trans),
1379 // Because this entry is new, it was originally deleted.
1387 : Entry(trans), write_transaction_(trans) {
1388 Entry same_id(trans, GET_BY_ID, id);
1406 : Entry(trans, GET_BY_ID, id), write_transaction_(trans) {
1412 : Entry(trans, GET_BY_HANDLE, metahandle), write_transaction_(trans) {
1418 : Entry(trans, GET_BY_CLIENT_TAG, tag), write_transaction_(trans) {
1424 : Entry(trans, GET_BY_SERVER_TAG, tag), write_transaction_(trans) {
1595 void Directory::UnlinkEntryFromOrder(EntryKernel* entry,
1599 Id old_previous = entry->ref(PREV_ID);
1600 Id old_next = entry->ref(NEXT_ID);
1602 entry->put(NEXT_ID, entry->ref(ID));
1603 entry->put(PREV_ID, entry->ref(ID));
1604 entry->mark_dirty(kernel_->dirty_metahandles);
1611 CHECK((old_next == entry->ref(ID)) || !old_next.ServerKnows());
1716 EntryKernel* entry = *candidate;
1719 if (entry->ref(PREV_ID).IsRoot() ||
1720 entry->ref(PREV_ID) != entry->ref(NEXT_ID)) {
1724 while (!entry->ref(PREV_ID).IsRoot()) {
1725 entry = GetEntryById(entry->ref(PREV_ID), &lock);
1727 return entry->ref(ID);
1747 EntryKernel* entry = *candidate;
1751 if (entry->ref(NEXT_ID).IsRoot() ||
1752 entry->ref(NEXT_ID) != entry->ref(PREV_ID)) {
1756 while (!entry->ref(NEXT_ID).IsRoot())
1757 entry = GetEntryById(entry->ref(NEXT_ID), &lock);
1758 return entry->ref(ID);
1766 const EntryKernel* entry,
1773 parent_id, entry->ref(SERVER_POSITION_IN_PARENT), entry->ref(ID));
1782 DCHECK_NE(candidate->ref(META_HANDLE), entry->ref(META_HANDLE));
1814 // we have to ensure that the entry is not an ancestor of the new parent.
1819 Entry new_parent(trans, GET_BY_ID, ancestor_id);
1826 // This function sets only the flags needed to get this entry to sync.
1834 std::ostream& operator<<(std::ostream& os, const Entry& entry) {
1836 EntryKernel* const kernel = entry.kernel_;