dovecot-2.0: lib-storage: Added min_first_recent_uid to struct m...

dovecot at dovecot.org dovecot at dovecot.org
Wed Mar 16 17:47:29 EET 2011


details:   http://hg.dovecot.org/dovecot-2.0/rev/08e4c5d0dc9b
changeset: 12681:08e4c5d0dc9b
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Mar 16 17:42:42 2011 +0200
description:
lib-storage: Added min_first_recent_uid to struct mailbox_update.
Implemented for dbox. Maildir/mbox needs some more code to make this work
correctly.

diffstat:

 src/lib-storage/index/dbox-multi/mdbox-storage.c  |  10 ++++++++++
 src/lib-storage/index/dbox-single/sdbox-storage.c |   8 ++++++++
 src/lib-storage/index/index-storage.c             |   8 ++++++++
 src/lib-storage/mail-storage.h                    |   1 +
 4 files changed, 27 insertions(+), 0 deletions(-)

diffs (67 lines):

diff -r 4baca6914518 -r 08e4c5d0dc9b src/lib-storage/index/dbox-multi/mdbox-storage.c
--- a/src/lib-storage/index/dbox-multi/mdbox-storage.c	Wed Mar 16 17:42:06 2011 +0200
+++ b/src/lib-storage/index/dbox-multi/mdbox-storage.c	Wed Mar 16 17:42:42 2011 +0200
@@ -225,6 +225,16 @@
 			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) {
diff -r 4baca6914518 -r 08e4c5d0dc9b src/lib-storage/index/dbox-single/sdbox-storage.c
--- a/src/lib-storage/index/dbox-single/sdbox-storage.c	Wed Mar 16 17:42:06 2011 +0200
+++ b/src/lib-storage/index/dbox-single/sdbox-storage.c	Wed Mar 16 17:42:42 2011 +0200
@@ -159,6 +159,14 @@
 			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) {
diff -r 4baca6914518 -r 08e4c5d0dc9b src/lib-storage/index/index-storage.c
--- a/src/lib-storage/index/index-storage.c	Wed Mar 16 17:42:06 2011 +0200
+++ b/src/lib-storage/index/index-storage.c	Wed Mar 16 17:42:42 2011 +0200
@@ -389,6 +389,14 @@
 			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);
diff -r 4baca6914518 -r 08e4c5d0dc9b src/lib-storage/mail-storage.h
--- a/src/lib-storage/mail-storage.h	Wed Mar 16 17:42:06 2011 +0200
+++ b/src/lib-storage/mail-storage.h	Wed Mar 16 17:42:42 2011 +0200
@@ -203,6 +203,7 @@
 	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;


More information about the dovecot-cvs mailing list