mdbox-sync.h revision 1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen#ifndef MDBOX_SYNC_H
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen#define MDBOX_SYNC_H
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenstruct mailbox;
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenstruct mdbox_mailbox;
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenenum mdbox_sync_flags {
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen MDBOX_SYNC_FLAG_FORCE = 0x01,
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen MDBOX_SYNC_FLAG_FSYNC = 0x02,
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen MDBOX_SYNC_FLAG_FORCE_REBUILD = 0x04,
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen MDBOX_SYNC_FLAG_NO_PURGE = 0x08
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen};
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenstruct mdbox_sync_context {
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen struct mdbox_mailbox *mbox;
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen struct mail_index_sync_ctx *index_sync_ctx;
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen struct mail_index_view *sync_view;
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen struct mail_index_transaction *trans;
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen enum mdbox_sync_flags flags;
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen ARRAY_TYPE(seq_range) expunged_seqs;
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen /* list of expunged map_uids. the same map_uid may be listed more than
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen once in case message has been copied multiple times to mailbox. */
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen ARRAY_TYPE(uint32_t) expunged_map_uids;
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen unsigned int purge:1;
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen};
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenint mdbox_sync_begin(struct mdbox_mailbox *mbox, enum mdbox_sync_flags flags,
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen struct mdbox_sync_context **ctx_r);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenint mdbox_sync_finish(struct mdbox_sync_context **ctx, bool success);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenint mdbox_sync(struct mdbox_mailbox *mbox, enum mdbox_sync_flags flags);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenint mdbox_sync_purge(struct mail_storage *storage);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenstruct mailbox_sync_context *
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenmdbox_storage_sync_init(struct mailbox *box, enum mailbox_sync_flags flags);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen#endif