mail-index-view-sync.c revision bbe90c4805e7032fdcefde3df125df0ca8be1bef
/* Note that all the sequences are actually still UIDs at this point */ /* src[] must be sorted. */ /* we can/must merge with next record */ /* continue previous record */ /* the view begins from the first non-synced transaction */ /* FIXME: use the new index to get needed changes */ "Transaction log got desynced for index %s",
/* get a list of expunge transactions. there may be some that we have already synced, but it doesn't matter because they'll get dropped out when converting to sequences */ /* this is simply a request for expunge */ "Corrupted expunge record");
/* convert UIDs to sequences */ /* Keep message count the same. */ /* Keep the old message flag counts also, although they may be somewhat stale already. We just don't want them to be more than our old messages_count. */ /* Keep log position so we know where to continue syncing */ /* get list of all expunges first */ /* only flags, appends and expunges can be left to be synced later */ /* since we're syncing everything, the counters get fixed */ /* keep the old mapping without expunges until we're /* We need a private copy of the map if we don't want to If view's map is the head map, it means that it contains already all the latest changes and there's no need for us to apply any changes to it. This can only happen if there hadn't been any expunges. */ /* Using non-head mapping. We have to apply transactions to it to get latest changes into it. */ /* Unless map was synced at the exact same position as view, the message flags can't be reliably used to update flag counters. note that map->hdr may contain old information if another process updated the /* Copy only the mails that we see currently, since we're going to append the new ones when we see /* Start the sync using our old view's header. The old view->hdr may differ from map->hdr if another view sharing the map with us had synced /* Syncing the view invalidates all previous looked up records. Unreference the mappings this view keeps because of them. */ for (i = 0; i <
count; i++) {
/* expunge request. this will be ignored */ /* visible record that we want to skip */ /* Get the next transaction from log. */ /* This is a visible record that we don't want to /* We haven't skipped anything while syncing this view. Update this view's synced log offset. */ /* skip everything we've already synced */ /* We've been skipping some transactions, which means we'll go through these same transactions again later. Since we're syncing this one, we don't want /* if we started from a map that we didn't create ourself, some of the external transactions may already be synced. at the end of view sync we'll update the ext_offset in the header so that this check always becomes FALSE for /* Apply transaction to view's mapping if needed (meaning we didn't just re-map the view to head mapping). */ /* non-visible change that we just wanted to update /* skip changes committed by hidden transactions (eg. in IMAP /* data contains the appended records, but we don't care */ /* this is simply a request for expunge */ /* data contains mail_transaction_expunge[] */ /* data contains mail_transaction_flag_update[] */ /* skip internal flag changes */ /* data contains mail_transaction_keyword_update header, the keyword name and an array of { uint32_t uid1, uid2; } */ /* skip over the header and name */ /* data contains mail_transaction_keyword_reset[] */ /* Nothing skipped. Clean it up the quick way. */ /* Clean up until view's current syncing position */ for (i = 0; i <
count; i++) {
/* we didn't sync everything */ /* set log view to empty range so unneeded memory gets freed */