7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen#ifndef DSYNC_TRANSACTION_LOG_SCAN_H
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen#define DSYNC_TRANSACTION_LOG_SCAN_H
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen
678d0463849ba777106eb7875f27db07a5d8e3dfTimo SirainenHASH_TABLE_DEFINE_TYPE(dsync_uid_mail_change,
a75d470c9223a75801418fcdda258885c36317e0Timo Sirainen void *, struct dsync_mail_change *);
55d33f807765482eb47374aaaced1fe714e0b256Timo SirainenHASH_TABLE_DEFINE_TYPE(dsync_attr_change,
55d33f807765482eb47374aaaced1fe714e0b256Timo Sirainen struct dsync_mailbox_attribute *,
55d33f807765482eb47374aaaced1fe714e0b256Timo Sirainen struct dsync_mailbox_attribute *);
678d0463849ba777106eb7875f27db07a5d8e3dfTimo Sirainen
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainenstruct mail_index_view;
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainenstruct dsync_transaction_log_scan;
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainenint dsync_transaction_log_scan_init(struct mail_index_view *view,
6abf66a3731d52889517bd644595c540e3a9b3ecTimo Sirainen struct mail_index_view *pvt_view,
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen uint32_t highest_wanted_uid,
6abf66a3731d52889517bd644595c540e3a9b3ecTimo Sirainen uint64_t modseq, uint64_t pvt_modseq,
70058d29cf8c77501741ddbc39178cfc87ca459eTimo Sirainen struct dsync_transaction_log_scan **scan_r,
70058d29cf8c77501741ddbc39178cfc87ca459eTimo Sirainen bool *pvt_too_old_r);
08e9fec5ba9e1a26e658c4224207d666b6ced27dTimo SirainenHASH_TABLE_TYPE(dsync_uid_mail_change)
08e9fec5ba9e1a26e658c4224207d666b6ced27dTimo Sirainendsync_transaction_log_scan_get_hash(struct dsync_transaction_log_scan *scan);
55d33f807765482eb47374aaaced1fe714e0b256Timo SirainenHASH_TABLE_TYPE(dsync_attr_change)
55d33f807765482eb47374aaaced1fe714e0b256Timo Sirainendsync_transaction_log_scan_get_attr_hash(struct dsync_transaction_log_scan *scan);
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen/* Returns TRUE if the entire transaction log was scanned */
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainenbool dsync_transaction_log_scan_has_all_changes(struct dsync_transaction_log_scan *scan);
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen/* If the given UID has been expunged after the initial log scan, create/update
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen a change record for it and return it. */
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainenstruct dsync_mail_change *
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainendsync_transaction_log_scan_find_new_expunge(struct dsync_transaction_log_scan *scan,
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen uint32_t uid);
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainenvoid dsync_transaction_log_scan_deinit(struct dsync_transaction_log_scan **scan);
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen
7bd5b1c64cc987715bdaf8cc4907c3c37d5d7b29Timo Sirainen#endif