27635b9f23752d67a965a266b3de53637a79457eTimo Sirainen#ifndef INDEX_REBUILD_H
27635b9f23752d67a965a266b3de53637a79457eTimo Sirainen#define INDEX_REBUILD_H
27635b9f23752d67a965a266b3de53637a79457eTimo Sirainen
27635b9f23752d67a965a266b3de53637a79457eTimo Sirainenstruct mailbox_list;
27635b9f23752d67a965a266b3de53637a79457eTimo Sirainen
27635b9f23752d67a965a266b3de53637a79457eTimo Sirainenstruct index_rebuild_context {
27635b9f23752d67a965a266b3de53637a79457eTimo Sirainen struct mailbox *box;
27635b9f23752d67a965a266b3de53637a79457eTimo Sirainen
27635b9f23752d67a965a266b3de53637a79457eTimo Sirainen struct mail_index_view *view;
27635b9f23752d67a965a266b3de53637a79457eTimo Sirainen struct mail_index_transaction *trans;
27635b9f23752d67a965a266b3de53637a79457eTimo Sirainen uint32_t cache_ext_id;
27635b9f23752d67a965a266b3de53637a79457eTimo Sirainen uint32_t cache_reset_id;
27635b9f23752d67a965a266b3de53637a79457eTimo Sirainen
27635b9f23752d67a965a266b3de53637a79457eTimo Sirainen struct mail_index *backup_index;
27635b9f23752d67a965a266b3de53637a79457eTimo Sirainen struct mail_index_view *backup_view;
27635b9f23752d67a965a266b3de53637a79457eTimo Sirainen
0dffa25d211be541ee3c953b23566a1a990789dfTimo Sirainen bool cache_used:1;
27635b9f23752d67a965a266b3de53637a79457eTimo Sirainen};
27635b9f23752d67a965a266b3de53637a79457eTimo Sirainen
27635b9f23752d67a965a266b3de53637a79457eTimo Sirainentypedef unsigned int
27635b9f23752d67a965a266b3de53637a79457eTimo Sirainenindex_rebuild_generate_uidvalidity_t(struct mailbox_list *list);
27635b9f23752d67a965a266b3de53637a79457eTimo Sirainen
27635b9f23752d67a965a266b3de53637a79457eTimo Sirainenstruct index_rebuild_context *
27635b9f23752d67a965a266b3de53637a79457eTimo Sirainenindex_index_rebuild_init(struct mailbox *box, struct mail_index_view *view,
27635b9f23752d67a965a266b3de53637a79457eTimo Sirainen struct mail_index_transaction *trans);
27635b9f23752d67a965a266b3de53637a79457eTimo Sirainenvoid index_index_rebuild_deinit(struct index_rebuild_context **ctx,
27635b9f23752d67a965a266b3de53637a79457eTimo Sirainen index_rebuild_generate_uidvalidity_t *cb);
27635b9f23752d67a965a266b3de53637a79457eTimo Sirainen
27635b9f23752d67a965a266b3de53637a79457eTimo Sirainenvoid index_rebuild_index_metadata(struct index_rebuild_context *ctx,
27635b9f23752d67a965a266b3de53637a79457eTimo Sirainen uint32_t new_seq, uint32_t uid);
27635b9f23752d67a965a266b3de53637a79457eTimo Sirainen
27635b9f23752d67a965a266b3de53637a79457eTimo Sirainen#endif