]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Added quick parameter to list_index_has_changed()
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 21 Jun 2016 18:21:03 +0000 (21:21 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 21 Jun 2016 18:21:03 +0000 (21:21 +0300)
src/lib-storage/index/index-storage.h
src/lib-storage/index/index-sync.c
src/lib-storage/index/maildir/maildir-sync-index.c
src/lib-storage/index/maildir/maildir-sync.h
src/lib-storage/index/mbox/mbox-sync-list-index.c
src/lib-storage/index/mbox/mbox-sync-private.h
src/lib-storage/list/mailbox-list-index-status.c
src/lib-storage/mail-storage-private.h

index 277cef094bdd544402bbb86e3eb6db1cefc69080..ab1575ebd6fc328531bf5fa1cebe8ddf7ac6e796 100644 (file)
@@ -164,7 +164,7 @@ bool index_keyword_array_cmp(const ARRAY_TYPE(keyword_indexes) *k1,
 
 int index_storage_list_index_has_changed(struct mailbox *box,
                                         struct mail_index_view *list_view,
-                                        uint32_t seq);
+                                        uint32_t seq, bool quick);
 enum index_storage_list_change
 index_storage_list_index_has_changed_full(struct mailbox *box,
                                          struct mail_index_view *list_view,
index 6721d162ad9d59d8fa80ad5406379b5fb71ecd57..ba965ef8cc49674dc103794cd54ee892ebd63b71 100644 (file)
@@ -459,7 +459,7 @@ index_storage_list_index_has_changed_full(struct mailbox *box,
 
 int index_storage_list_index_has_changed(struct mailbox *box,
                                         struct mail_index_view *list_view,
-                                        uint32_t seq)
+                                        uint32_t seq, bool quick ATTR_UNUSED)
 {
        switch (index_storage_list_index_has_changed_full(box, list_view, seq)) {
        case INDEX_STORAGE_LIST_CHANGE_ERROR:
index 01ae4909b49cac6b3ef4a00762683f2bc002e3a6..4a318f8bffc89660cacd6eb80270835fab122cb1 100644 (file)
@@ -702,7 +702,7 @@ maildir_list_get_ext_id(struct maildir_mailbox *mbox,
 
 int maildir_list_index_has_changed(struct mailbox *box,
                                   struct mail_index_view *list_view,
-                                  uint32_t seq)
+                                  uint32_t seq, bool quick)
 {
        struct maildir_mailbox *mbox = (struct maildir_mailbox *)box;
        const struct maildir_list_index_record *rec;
@@ -713,7 +713,7 @@ int maildir_list_index_has_changed(struct mailbox *box,
        bool expunged;
        int ret;
 
-       ret = index_storage_list_index_has_changed(box, list_view, seq);
+       ret = index_storage_list_index_has_changed(box, list_view, seq, quick);
        if (ret != 0 || box->storage->set->mailbox_list_index_very_dirty_syncs)
                return ret;
        if (mbox->storage->set->maildir_very_dirty_syncs) {
index 5ec0ee48e4dca75dd94378712c6d8ccbabb7c1d1..b059fbd659dd7f37a5a0a0c222432b5e86053a1d 100644 (file)
@@ -50,7 +50,7 @@ int maildir_sync_lookup(struct maildir_mailbox *mbox, uint32_t uid,
 
 int maildir_list_index_has_changed(struct mailbox *box,
                                   struct mail_index_view *list_view,
-                                  uint32_t seq);
+                                  uint32_t seq, bool quick);
 void maildir_list_index_update_sync(struct mailbox *box,
                                    struct mail_index_transaction *trans,
                                    uint32_t seq);
index 5524733fdb9100353d6646919fb339e95ff678c5..c11f1a605579f301c3d91c0054e9b07a2e134511 100644 (file)
@@ -20,7 +20,7 @@ mbox_list_get_ext_id(struct mbox_mailbox *mbox,
 
 int mbox_list_index_has_changed(struct mailbox *box,
                                struct mail_index_view *list_view,
-                               uint32_t seq)
+                               uint32_t seq, bool quick)
 {
        struct mbox_mailbox *mbox = (struct mbox_mailbox *)box;
        const struct mbox_list_index_record *rec;
@@ -31,7 +31,7 @@ int mbox_list_index_has_changed(struct mailbox *box,
        bool expunged;
        int ret;
 
-       ret = index_storage_list_index_has_changed(box, list_view, seq);
+       ret = index_storage_list_index_has_changed(box, list_view, seq, quick);
        if (ret != 0 || box->storage->set->mailbox_list_index_very_dirty_syncs)
                return ret;
 
index 9d991acf01cbe4742bfeae02e1e0ab8c892a8269..e25f26975dce04e70f795eb6c5861d47959cc956 100644 (file)
@@ -185,7 +185,7 @@ int mbox_sync_get_guid(struct mbox_mailbox *mbox);
 
 int mbox_list_index_has_changed(struct mailbox *box,
                                struct mail_index_view *list_view,
-                               uint32_t seq);
+                               uint32_t seq, bool quick);
 void mbox_list_index_update_sync(struct mailbox *box,
                                 struct mail_index_transaction *trans,
                                 uint32_t seq);
index 66d553cbb8e49df85395cd5f27bf7c27cc04e339..eab57a36258221a9e07eae346c64fc3947f98b0a 100644 (file)
@@ -60,7 +60,7 @@ index_list_open_view(struct mailbox *box, struct mail_index_view **view_r,
                ret = 1;
        } else T_BEGIN {
                ret = box->v.list_index_has_changed == NULL ? 0 :
-                       box->v.list_index_has_changed(box, view, seq);
+                       box->v.list_index_has_changed(box, view, seq, FALSE);
        } T_END;
 
        if (ret != 0) {
@@ -787,7 +787,7 @@ void mailbox_list_index_status_set_info_flags(struct mailbox *box, uint32_t uid,
                ret = 1;
        } else T_BEGIN {
                ret = box->v.list_index_has_changed == NULL ? 0 :
-                       box->v.list_index_has_changed(box, view, seq);
+                       box->v.list_index_has_changed(box, view, seq, TRUE);
        } T_END;
 
        if (ret != 0) {
index b32e7222673bd410fb8b094a99d6c73a924b24ce..f330798db671fdd1234299444067d07e7d95c35f 100644 (file)
@@ -206,10 +206,11 @@ struct mailbox_vfuncs {
        int (*attribute_iter_deinit)(struct mailbox_attribute_iter *iter);
 
        /* Lookup sync extension record and figure out if it mailbox has
-          changed since. Returns 1 = yes, 0 = no, -1 = error. */
+          changed since. Returns 1 = yes, 0 = no, -1 = error. if quick==TRUE,
+          return 1 if it's too costly to find out exactly. */
        int (*list_index_has_changed)(struct mailbox *box,
                                      struct mail_index_view *list_view,
-                                     uint32_t seq);
+                                     uint32_t seq, bool quick);
        /* Update the sync extension record. */
        void (*list_index_update_sync)(struct mailbox *box,
                                       struct mail_index_transaction *trans,