]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Added min_first_recent_uid to struct mailbox_update.
authorTimo Sirainen <tss@iki.fi>
Wed, 16 Mar 2011 15:42:42 +0000 (17:42 +0200)
committerTimo Sirainen <tss@iki.fi>
Wed, 16 Mar 2011 15:42:42 +0000 (17:42 +0200)
Implemented for dbox. Maildir/mbox needs some more code to make this work
correctly.

src/lib-storage/index/dbox-multi/mdbox-storage.c
src/lib-storage/index/dbox-single/sdbox-storage.c
src/lib-storage/index/index-storage.c
src/lib-storage/mail-storage.h

index 071dae02af1bf2be3ebc106619877670650aa993..60ceef259f36bbcd7f7adaf36ba1e1008bf7d920 100644 (file)
@@ -225,6 +225,16 @@ static int mdbox_write_index_header(struct mailbox *box,
                        offsetof(struct mail_index_header, next_uid),
                        &uid_next, sizeof(uid_next), TRUE);
        }
+       if (update->min_first_recent_uid != 0 &&
+           hdr->first_recent_uid < update->min_first_recent_uid) {
+               uint32_t first_recent_uid = update->min_first_recent_uid;
+
+               i_assert(update->min_next_uid == 0 ||
+                        first_recent_uid < update->min_next_uid);
+               mail_index_update_header(trans,
+                       offsetof(struct mail_index_header, first_recent_uid),
+                       &first_recent_uid, sizeof(first_recent_uid), FALSE);
+       }
        if (update != NULL && update->min_highest_modseq != 0 &&
            mail_index_modseq_get_highest(box->view) <
                                                update->min_highest_modseq) {
index 16806e1b09d9ce065b7e35450812c9787cf0b4af..a4c035b198e2b486e6cfef9d2acdeeb788e509f5 100644 (file)
@@ -159,6 +159,14 @@ static int sdbox_mailbox_create_indexes(struct mailbox *box,
                        offsetof(struct mail_index_header, next_uid),
                        &uid_next, sizeof(uid_next), TRUE);
        }
+       if (update->min_first_recent_uid != 0 &&
+           hdr->first_recent_uid < update->min_first_recent_uid) {
+               uint32_t first_recent_uid = update->min_first_recent_uid;
+
+               mail_index_update_header(trans,
+                       offsetof(struct mail_index_header, first_recent_uid),
+                       &first_recent_uid, sizeof(first_recent_uid), FALSE);
+       }
        if (update != NULL && update->min_highest_modseq != 0 &&
            mail_index_modseq_get_highest(box->view) <
                                                update->min_highest_modseq) {
index 48547a3ee0ce2325ce1931d264b40dd062a02809..70a144f5105bdfdd25376cdac115dadd32f8e1bd 100644 (file)
@@ -389,6 +389,14 @@ int index_storage_mailbox_update(struct mailbox *box,
                        offsetof(struct mail_index_header, next_uid),
                        &next_uid, sizeof(next_uid), FALSE);
        }
+       if (update->min_first_recent_uid != 0 &&
+           hdr->first_recent_uid < update->min_first_recent_uid) {
+               uint32_t first_recent_uid = update->min_first_recent_uid;
+
+               mail_index_update_header(trans,
+                       offsetof(struct mail_index_header, first_recent_uid),
+                       &first_recent_uid, sizeof(first_recent_uid), FALSE);
+       }
        if (update->min_highest_modseq != 0 &&
            mail_index_modseq_get_highest(view) < update->min_highest_modseq) {
                mail_index_modseq_enable(box->index);
index b98dd921f77eae33a534a4978c052e7e5fb4b187..40412d7e57b71fc8d8370fd8d01fe93ffc79dd5f 100644 (file)
@@ -203,6 +203,7 @@ struct mailbox_update {
        uint8_t mailbox_guid[MAIL_GUID_128_SIZE];
        uint32_t uid_validity;
        uint32_t min_next_uid;
+       uint32_t min_first_recent_uid;
        uint64_t min_highest_modseq;
        /* Add these fields to be temporarily cached, if they aren't already. */
        const char *const *cache_fields;