mdbox-sync.h revision f71c2d4e6b802bf8e622bcd5df29286262d05d5a
e59faf65ce864fe95dc00f5d52b8323cdbd0608aTimo Sirainen#ifndef MDBOX_SYNC_H
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen#define MDBOX_SYNC_H
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo Sirainenstruct mailbox;
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainenstruct mdbox_mailbox;
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainenenum mdbox_sync_flags {
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen MDBOX_SYNC_FLAG_FORCE = 0x01,
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen MDBOX_SYNC_FLAG_FSYNC = 0x02,
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo Sirainen MDBOX_SYNC_FLAG_FORCE_REBUILD = 0x04,
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo Sirainen MDBOX_SYNC_FLAG_NO_PURGE = 0x08,
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo Sirainen MDBOX_SYNC_FLAG_NO_REBUILD = 0x10
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen};
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainenstruct mdbox_sync_context {
73bfdbe28c2ce6d143eadf0bab8ccfbe4cab0faeTimo Sirainen struct mdbox_mailbox *mbox;
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen struct mail_index_sync_ctx *index_sync_ctx;
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo Sirainen struct mail_index_view *sync_view;
0cb5a9bfbf40b3b323956792aa13d342a459585eTimo Sirainen struct mail_index_transaction *trans;
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo Sirainen struct mdbox_map_transaction_context *map_trans;
0cb5a9bfbf40b3b323956792aa13d342a459585eTimo Sirainen struct mdbox_map_atomic_context *atomic;
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo Sirainen enum mdbox_sync_flags flags;
63b70dd3e4b4d68a02b1bf7d78e92076210e3e1aTimo Sirainen
a272994d43de80a306a8ed1f2983960d1f3102d0Timo Sirainen ARRAY_TYPE(seq_range) expunged_seqs;
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo Sirainen};
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo Sirainen
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo Sirainenint mdbox_sync_begin(struct mdbox_mailbox *mbox, enum mdbox_sync_flags flags,
2a90d8a14b0e7cc1508814bc87d3dfa598ef46a8Timo Sirainen struct mdbox_map_atomic_context *atomic,
d1414c09cf0d58ac983054e2f4e1a1f329272dcfTimo Sirainen struct mdbox_sync_context **ctx_r);
d1414c09cf0d58ac983054e2f4e1a1f329272dcfTimo Sirainenint mdbox_sync_finish(struct mdbox_sync_context **ctx, bool success);
73bfdbe28c2ce6d143eadf0bab8ccfbe4cab0faeTimo Sirainenint mdbox_sync(struct mdbox_mailbox *mbox, enum mdbox_sync_flags flags);
73bfdbe28c2ce6d143eadf0bab8ccfbe4cab0faeTimo Sirainen
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo Sirainenstruct mailbox_sync_context *
d1414c09cf0d58ac983054e2f4e1a1f329272dcfTimo Sirainenmdbox_storage_sync_init(struct mailbox *box, enum mailbox_sync_flags flags);
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo Sirainen
73bfdbe28c2ce6d143eadf0bab8ccfbe4cab0faeTimo Sirainen#endif
9137c55411aa39d41c1e705ddc34d5bd26c65021Timo Sirainen