[dovecot-cvs] dovecot/src/lib-storage mail-storage-private.h, 1.27, 1.28 mail-storage.c, 1.51, 1.52 mail-storage.h, 1.109, 1.110

tss-movial at dovecot.org tss-movial at dovecot.org
Thu Jun 8 15:49:33 EEST 2006


Update of /var/lib/cvs/dovecot/src/lib-storage
In directory talvi:/tmp/cvs-serv22007/lib-storage

Modified Files:
	mail-storage-private.h mail-storage.c mail-storage.h 
Log Message:
Changed mail-storage API to do the mail sorting internally. Optimized it
internally to keep a 32bit sort_id field in index for each used primary sort
condition. Practically this should mean less disk I/O, memory and CPU usage
when SORT command is used.



Index: mail-storage-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/mail-storage-private.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- mail-storage-private.h	16 May 2006 09:10:27 -0000	1.27
+++ mail-storage-private.h	8 Jun 2006 12:49:31 -0000	1.28
@@ -131,8 +131,6 @@
 				      const char *const headers[]);
 	void (*header_lookup_deinit)(struct mailbox_header_lookup_ctx *ctx);
 
-	int (*search_get_sorting)(struct mailbox *box,
-				  enum mail_sort_type *sort_program);
 	struct mail_search_context *
 	(*search_init)(struct mailbox_transaction_context *t,
 		       const char *charset, struct mail_search_arg *args,

Index: mail-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/mail-storage.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- mail-storage.c	9 May 2006 11:57:36 -0000	1.51
+++ mail-storage.c	8 Jun 2006 12:49:31 -0000	1.52
@@ -444,12 +444,6 @@
 	ctx->box->v.header_lookup_deinit(ctx);
 }
 
-int mailbox_search_get_sorting(struct mailbox *box,
-			       enum mail_sort_type *sort_program)
-{
-	return box->v.search_get_sorting(box, sort_program);
-}
-
 struct mail_search_context *
 mailbox_search_init(struct mailbox_transaction_context *t,
 		    const char *charset, struct mail_search_arg *args,

Index: mail-storage.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/mail-storage.h,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -d -r1.109 -r1.110
--- mail-storage.h	16 May 2006 09:10:27 -0000	1.109
+++ mail-storage.h	8 Jun 2006 12:49:31 -0000	1.110
@@ -86,18 +86,19 @@
 };
 
 enum mail_sort_type {
-/* Maximum size for sort program, 2x for reverse + END */
-#define MAX_SORT_PROGRAM_SIZE (2*7 + 1)
+/* Maximum size for sort program (each one separately + END) */
+#define MAX_SORT_PROGRAM_SIZE (7 + 1)
 
-	MAIL_SORT_ARRIVAL	= 0x0010,
-	MAIL_SORT_CC		= 0x0020,
-	MAIL_SORT_DATE		= 0x0040,
-	MAIL_SORT_FROM		= 0x0080,
-	MAIL_SORT_SIZE		= 0x0100,
-	MAIL_SORT_SUBJECT	= 0x0200,
-	MAIL_SORT_TO		= 0x0400,
+	MAIL_SORT_ARRIVAL	= 0x0001,
+	MAIL_SORT_CC		= 0x0002,
+	MAIL_SORT_DATE		= 0x0004,
+	MAIL_SORT_FROM		= 0x0008,
+	MAIL_SORT_SIZE		= 0x0010,
+	MAIL_SORT_SUBJECT	= 0x0020,
+	MAIL_SORT_TO		= 0x0040,
 
-	MAIL_SORT_REVERSE	= 0x0001, /* reverse the next type */
+	MAIL_SORT_MASK		= 0x0fff,
+	MAIL_SORT_FLAG_REVERSE	= 0x1000, /* reverse this mask type */
 
 	MAIL_SORT_END		= 0x0000 /* ends sort program */
 };
@@ -373,17 +374,9 @@
 mailbox_header_lookup_init(struct mailbox *box, const char *const headers[]);
 void mailbox_header_lookup_deinit(struct mailbox_header_lookup_ctx **ctx);
 
-/* Modify sort_program to specify a sort program acceptable for
-   search_init(). If mailbox supports no sorting, it's simply set to
-   {MAIL_SORT_END}. */
-int mailbox_search_get_sorting(struct mailbox *box,
-			       enum mail_sort_type *sort_program);
-/* Initialize new search request. Search arguments are given so that
-   the storage can optimize the searching as it wants.
-
-   If sort_program is non-NULL, it requests that the returned messages
-   are sorted by the given criteria. sort_program must have gone
-   through search_get_sorting(). */
+/* Initialize new search request. charset specifies the character set used in
+   the search argument strings. If sort_program is non-NULL, the messages are
+   returned in the requested order, otherwise from first to last. */
 struct mail_search_context *
 mailbox_search_init(struct mailbox_transaction_context *t,
 		    const char *charset, struct mail_search_arg *args,



More information about the dovecot-cvs mailing list