]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: introduce MAIL_LOOKUP_ABORT_NOT_IN_CACHE_START_CACHING
authorMarkus Valentin <markus.valentin@open-xchange.com>
Tue, 3 Sep 2019 12:30:15 +0000 (14:30 +0200)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Tue, 10 Sep 2019 07:02:34 +0000 (10:02 +0300)
In some cases we would like to mark an field as to be cached but still
don't fetch it now. For this occasions this change introduces a new enum
value for mail_lookup_abort which allows to implement such a behaviour.

src/lib-storage/index/cydir/cydir-mail.c
src/lib-storage/index/index-mail-headers.c
src/lib-storage/index/maildir/maildir-mail.c
src/lib-storage/index/raw/raw-mail.c
src/lib-storage/mail-storage.h

index 450d71defc511e1226c0dd5b592b13305deea4f4..08132bb9e8985d9235f6239d448b8d16338e6459 100644 (file)
@@ -21,7 +21,7 @@ static int cydir_mail_stat(struct mail *mail, struct stat *st_r)
 {
        const char *path;
 
-       if (mail->lookup_abort == MAIL_LOOKUP_ABORT_NOT_IN_CACHE) {
+       if (mail->lookup_abort >= MAIL_LOOKUP_ABORT_NOT_IN_CACHE) {
                mail_set_aborted(mail);
                return -1;
        }
index 2efa751957eae45c45add7b7fc1f73d3c00cc006..ed3ba87c5ba72319b81976e11f0cd7fbf1c0511f 100644 (file)
@@ -652,7 +652,7 @@ index_mail_get_raw_headers(struct index_mail *mail, const char *field,
                        /* don't try to parse headers recursively. we're here
                           because message size was wrong and istream-mail
                           wants to log some cached headers. */
-                       i_assert(mail->mail.mail.lookup_abort == MAIL_LOOKUP_ABORT_NOT_IN_CACHE);
+                       i_assert(mail->mail.mail.lookup_abort >= MAIL_LOOKUP_ABORT_NOT_IN_CACHE);
                        mail_set_aborted(&mail->mail.mail);
                        return -1;
                }
index 21688b89afa447486055a40802ddc1f614c69e91..759c717d024b3f7e7b10643d8b8e214d324317ae 100644 (file)
@@ -107,7 +107,7 @@ static int maildir_mail_stat(struct mail *mail, struct stat *st_r)
        const char *path;
        int fd, ret;
 
-       if (mail->lookup_abort == MAIL_LOOKUP_ABORT_NOT_IN_CACHE) {
+       if (mail->lookup_abort >= MAIL_LOOKUP_ABORT_NOT_IN_CACHE) {
                mail_set_aborted(mail);
                return -1;
        }
index 54a0f254d2b648a070b485f94fa61a4291309e82..64b33a91aacef8c601c6cb906dd74a87a95e727c 100644 (file)
@@ -14,7 +14,7 @@ static int raw_mail_stat(struct mail *mail)
        struct raw_mailbox *mbox = RAW_MAILBOX(mail->box);
        const struct stat *st;
 
-       if (mail->lookup_abort == MAIL_LOOKUP_ABORT_NOT_IN_CACHE) {
+       if (mail->lookup_abort >= MAIL_LOOKUP_ABORT_NOT_IN_CACHE) {
                mail_set_aborted(mail);
                return -1;
        }
index 5ca8b4d20c9c7a0f0445aec658be99a60d255ccd..1d4f88f6488ea03d3bcd9c55353daf4b73cb9368 100644 (file)
@@ -379,7 +379,12 @@ enum mail_lookup_abort {
           operations to be performed, such as stat()ing a file. */
        MAIL_LOOKUP_ABORT_READ_MAIL,
        /* Abort if the operation can't be done fully using cache file */
-       MAIL_LOOKUP_ABORT_NOT_IN_CACHE
+       MAIL_LOOKUP_ABORT_NOT_IN_CACHE,
+       /* Abort if the operation can't be done fully using cache file.
+        * During this lookup all cache lookups that have "no" decision
+        * will be changed to "tmp". This way the field will start to be
+        * cached in the future. */
+       MAIL_LOOKUP_ABORT_NOT_IN_CACHE_START_CACHING,
 };
 
 enum mail_access_type {