Skip to content

Commit

Permalink
lib-storage: Added quick parameter to list_index_has_changed()
Browse files Browse the repository at this point in the history
  • Loading branch information
sirainen committed Jun 21, 2016
1 parent 85c9cf2 commit aa47c9b
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/lib-storage/index/index-storage.h
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/lib-storage/index/index-sync.c
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions src/lib-storage/index/maildir/maildir-sync-index.c
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/lib-storage/index/maildir/maildir-sync.h
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/lib-storage/index/mbox/mbox-sync-list-index.c
Expand Up @@ -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;
Expand All @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/lib-storage/index/mbox/mbox-sync-private.h
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/lib-storage/list/mailbox-list-index-status.c
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions src/lib-storage/mail-storage-private.h
Expand Up @@ -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,
Expand Down

0 comments on commit aa47c9b

Please sign in to comment.