return 0;
}
+static struct mailbox_sync_context *
+index_list_mailbox_sync_init(struct mailbox *box,
+ enum mailbox_sync_flags flags)
+{
+ struct index_list_mailbox *ibox = INDEX_LIST_STORAGE_CONTEXT(box);
+ struct mailbox_list_index *ilist = INDEX_LIST_CONTEXT(box->list);
+
+ if ((flags & MAILBOX_SYNC_FLAG_FORCE_RESYNC) != 0 &&
+ !ilist->force_resynced) {
+ box->storage->list_index_rebuild_reason =
+ MAIL_STORAGE_LIST_INDEX_REBUILD_REASON_FORCE_RESYNC;
+ if (box->storage->v.list_index_corrupted(box->storage) < 0)
+ ilist->force_resync_failed = TRUE;
+ /* try to rebuild list index only once - even if it failed */
+ ilist->force_resynced = TRUE;
+ }
+ return ibox->module_ctx.super.sync_init(box, flags);
+}
+
+static int
+index_list_mailbox_sync_deinit(struct mailbox_sync_context *ctx,
+ struct mailbox_sync_status *status_r)
+{
+ struct index_list_mailbox *ibox = INDEX_LIST_STORAGE_CONTEXT(ctx->box);
+ struct mailbox_list_index *ilist = INDEX_LIST_CONTEXT(ctx->box->list);
+
+ if (ibox->module_ctx.super.sync_deinit(ctx, status_r) < 0)
+ return -1;
+ if (ilist->force_resync_failed) {
+ /* fail this only once */
+ ilist->force_resync_failed = FALSE;
+ return -1;
+ }
+ return 0;
+}
+
static void
index_list_try_delete(struct mailbox_list *_list, const char *name,
enum mailbox_list_path_type type)
v->update_box = index_list_mailbox_update;
v->exists = index_list_mailbox_exists;
v->open = index_list_mailbox_open;
+ v->sync_init = index_list_mailbox_sync_init;
+ v->sync_deinit = index_list_mailbox_sync_deinit;
}
this is called in non-error conditions, the callback shouldn't log
any errors or warnings if it didn't find any missing mailboxes. */
MAIL_STORAGE_LIST_INDEX_REBUILD_REASON_NO_INBOX,
+ /* MAILBOX_SYNC_FLAG_FORCE_RESYNC is run. This is called only once
+ per list, so that doveadm force-resync '*' won't cause it to run for
+ every mailbox. */
+ MAIL_STORAGE_LIST_INDEX_REBUILD_REASON_FORCE_RESYNC,
};
struct mail_storage_module_register {