Home | History | Annotate | Download | only in syncable

Lines Matching refs:entry

15 #include "sync/syncable/entry.h"
126 EntryKernel* entry = it->second;
127 if (ParentChildIndex::ShouldInclude(entry))
128 kernel_->parent_child_index.Insert(entry);
129 const int64 metahandle = entry->ref(META_HANDLE);
130 if (entry->ref(IS_UNSYNCED))
132 if (entry->ref(IS_UNAPPLIED_UPDATE)) {
133 const ModelType type = entry->GetServerModelType();
136 if (!entry->ref(UNIQUE_SERVER_TAG).empty()) {
137 DCHECK(kernel_->server_tags_map.find(entry->ref(UNIQUE_SERVER_TAG)) ==
140 kernel_->server_tags_map[entry->ref(UNIQUE_SERVER_TAG)] = entry;
142 if (!entry->ref(UNIQUE_CLIENT_TAG).empty()) {
143 DCHECK(kernel_->server_tags_map.find(entry->ref(UNIQUE_SERVER_TAG)) ==
146 kernel_->client_tags_map[entry->ref(UNIQUE_CLIENT_TAG)] = entry;
148 DCHECK(kernel_->ids_map.find(entry->ref(ID).value()) ==
150 kernel_->ids_map[entry->ref(ID).value()] = entry;
151 DCHECK(!entry->is_dirty());
346 bool Directory::InsertEntry(WriteTransaction* trans, EntryKernel* entry) {
348 return InsertEntry(trans, entry, &lock);
352 EntryKernel* entry,
355 if (!SyncAssert(NULL != entry, FROM_HERE, "Entry is null", trans))
358 static const char error[] = "Entry already in memory index.";
362 std::make_pair(entry->ref(META_HANDLE), entry)).second,
370 std::make_pair(entry->ref(ID).value(), entry)).second,
376 if (ParentChildIndex::ShouldInclude(entry)) {
377 if (!SyncAssert(kernel_->parent_child_index.Insert(entry),
386 if (!SyncAssert(entry->ref(UNIQUE_SERVER_TAG).empty(), FROM_HERE,
390 if (!SyncAssert(entry->ref(UNIQUE_CLIENT_TAG).empty(), FROM_HERE,
398 EntryKernel* const entry,
406 ScopedParentChildIndexUpdater updater_b(lock, entry,
408 size_t num_erased = kernel_->ids_map.erase(entry->ref(ID).value());
410 entry->put(ID, new_id);
411 kernel_->ids_map[entry->ref(ID).value()] = entry;
417 EntryKernel* const entry,
423 ScopedParentChildIndexUpdater index_updater(lock, entry,
425 entry->put(PARENT_ID, new_parent_id);
441 const EntryKernel* const entry) const {
442 bool safe = entry->ref(IS_DEL) && !entry->is_dirty() &&
443 !entry->ref(SYNCING) && !entry->ref(IS_UNAPPLIED_UPDATE) &&
444 !entry->ref(IS_UNSYNCED);
447 int64 handle = entry->ref(META_HANDLE);
448 const ModelType type = entry->GetServerModelType();
481 EntryKernel* entry = GetEntryByHandle(*i, &lock);
482 if (!entry)
485 if (!entry->is_dirty())
488 new EntryKernel(*entry));
492 entry->clear_dirty(NULL);
545 EntryKernel* entry = (found == kernel_->metahandles_map.end() ?
547 if (entry && SafeToPurgeFromMemory(&trans, entry)) {
551 num_erased = kernel_->metahandles_map.erase(entry->ref(META_HANDLE));
553 num_erased = kernel_->ids_map.erase(entry->ref(ID).value());
555 if (!entry->ref(UNIQUE_SERVER_TAG).empty()) {
557 kernel_->server_tags_map.erase(entry->ref(UNIQUE_SERVER_TAG));
560 if (!entry->ref(UNIQUE_CLIENT_TAG).empty()) {
562 kernel_->client_tags_map.erase(entry->ref(UNIQUE_CLIENT_TAG));
565 if (!SyncAssert(!kernel_->parent_child_index.Contains(entry),
567 "Deleted entry still present",
570 delete entry;
578 void Directory::UnapplyEntry(EntryKernel* entry) {
579 int64 handle = entry->ref(META_HANDLE);
581 entry->ref(SERVER_SPECIFICS));
589 ModelTypeToRootTag(server_type) == entry->ref(UNIQUE_SERVER_TAG)) {
594 if (IsRealDataType(server_type) && !entry->ref(IS_UNAPPLIED_UPDATE)) {
595 entry->put(IS_UNAPPLIED_UPDATE, true);
597 entry->mark_dirty(&kernel_->dirty_metahandles);
601 if (entry->ref(IS_UNSYNCED)) {
603 entry->put(IS_UNSYNCED, false);
604 entry->mark_dirty(&kernel_->dirty_metahandles);
609 if (!entry->ref(IS_DEL)) {
610 kernel_->parent_child_index.Remove(entry);
611 entry->put(IS_DEL, true);
612 entry->mark_dirty(&kernel_->dirty_metahandles);
616 if (entry->ref(BASE_VERSION) != CHANGES_VERSION) {
617 entry->put(BASE_VERSION, CHANGES_VERSION);
618 entry->mark_dirty(&kernel_->dirty_metahandles);
628 EntryKernel* entry,
630 int64 handle = entry->ref(META_HANDLE);
632 entry->ref(SERVER_SPECIFICS));
637 num_erased = kernel_->metahandles_map.erase(entry->ref(META_HANDLE));
639 num_erased = kernel_->ids_map.erase(entry->ref(ID).value());
642 DCHECK_EQ(entry->ref(IS_UNSYNCED), num_erased > 0);
645 DCHECK_EQ(entry->ref(IS_UNAPPLIED_UPDATE), num_erased > 0);
646 if (kernel_->parent_child_index.Contains(entry))
647 kernel_->parent_child_index.Remove(entry);
649 if (!entry->ref(UNIQUE_CLIENT_TAG).empty()) {
651 kernel_->client_tags_map.erase(entry->ref(UNIQUE_CLIENT_TAG));
654 if (!entry->ref(UNIQUE_SERVER_TAG).empty()) {
656 kernel_->server_tags_map.erase(entry->ref(UNIQUE_SERVER_TAG));
661 entries_to_journal->insert(entry);
663 delete entry;
708 EntryKernel* entry = *it;
719 UnapplyEntry(entry);
726 DeleteEntry(save_to_journal, entry, &entries_to_journal);
833 syncable::Entry entry(trans,
836 return entry.good() && entry.Get(syncable::BASE_VERSION) != CHANGES_VERSION;
950 EntryKernel* entry = it->second;
951 const ModelType type = GetModelTypeFromSpecifics(entry->ref(SPECIFICS));
953 if (entry->ref(IS_DEL))
993 Entry e(trans, GET_BY_HANDLE, metahandle);
994 if (!SyncAssert(e.good(), FROM_HERE, "Entry is bad", trans))
1001 "Entry should be a directory",
1005 "Entry should be root",
1009 "Entry should be sycned",
1026 Entry parent(trans, GET_BY_ID, parentid);
1028 "Parent entry is not valid.",
1062 "The entry should not have been deleted.",