c5794838af9995f50bfecb06a3cd4f9a0ac77858Timo SirainenARRAY_DEFINE_TYPE(seq_array_array, ARRAY_TYPE(seq_array));
81a5d8714c566ce50c4a2409f59e82e716d576d2Timo Sirainen /* mask is in bytes, not bits */
5e40ed3f0a2c2acddc9b8eab59670c7a850114c5Timo Sirainen void (*reset)(struct mail_index_transaction *t);
d6badc27cd6e8d3398877b6766cb0aaeef3a7800Timo Sirainen int (*commit)(struct mail_index_transaction *t,
9f19a50d5966643c4d1c5ca06868ac2ad31bc4d5Timo Sirainen struct mail_index_transaction_commit_result *result_r);
d6badc27cd6e8d3398877b6766cb0aaeef3a7800Timo Sirainen void (*rollback)(struct mail_index_transaction *t);
ae8817f05005f57bba32479a610b52d083e2b6ebTimo Sirainen /* NOTE: If you add anything new, remember to update
0c909e3461607eadcd66f4eac69b7f34e37fccf1Timo Sirainen mail_index_transaction_reset_v() to reset it. */
48270badadd82279bfe50ae3d187aea8b0b2b30eTimo Sirainen /* lowest/highest sequence that updates flags/keywords */
48270badadd82279bfe50ae3d187aea8b0b2b30eTimo Sirainen uint32_t min_flagupdate_seq, max_flagupdate_seq;
4ee00532a265bdfb38539d811fcd12d51210ac35Timo Sirainen ARRAY(struct mail_transaction_modseq_update) modseq_updates;
4ee00532a265bdfb38539d811fcd12d51210ac35Timo Sirainen ARRAY(struct mail_transaction_expunge_guid) expunges;
aa38d1a0945f0bc13a225d043f53fad2eec666b1Timo Sirainen unsigned char pre_hdr_change[sizeof(struct mail_index_header)];
aa38d1a0945f0bc13a225d043f53fad2eec666b1Timo Sirainen unsigned char pre_hdr_mask[sizeof(struct mail_index_header)];
aa38d1a0945f0bc13a225d043f53fad2eec666b1Timo Sirainen unsigned char post_hdr_change[sizeof(struct mail_index_header)];
aa38d1a0945f0bc13a225d043f53fad2eec666b1Timo Sirainen unsigned char post_hdr_mask[sizeof(struct mail_index_header)];
4ee00532a265bdfb38539d811fcd12d51210ac35Timo Sirainen ARRAY(struct mail_index_transaction_ext_hdr_update) ext_hdr_updates;
4ee00532a265bdfb38539d811fcd12d51210ac35Timo Sirainen ARRAY(struct mail_transaction_ext_intro) ext_resizes;
4ee00532a265bdfb38539d811fcd12d51210ac35Timo Sirainen ARRAY(struct mail_transaction_ext_reset) ext_resets;
4ee00532a265bdfb38539d811fcd12d51210ac35Timo Sirainen ARRAY(struct mail_index_transaction_keyword_update) keyword_updates;
fee561b9d9162b130e662914fcebc9dd99b5c320Timo Sirainen buffer_t *attribute_updates; /* [+-][ps]key\0.. */
238812433b4f7965fd662dce0f4efccb092630a8Timo Sirainen buffer_t *attribute_updates_suffix; /* <timestamp>[<value len>].. */
46c31f64b9f0949f00b7819f45b22f2d64b2ea27Timo Sirainen /* Module-specific contexts. */
4ee00532a265bdfb38539d811fcd12d51210ac35Timo Sirainen ARRAY(union mail_index_transaction_module_context *) module_contexts;
a022088674a5ae72ed29ae001834cbad62a4f19fTimo Sirainen /* non-extension updates. flag updates don't change this because
a022088674a5ae72ed29ae001834cbad62a4f19fTimo Sirainen they may be added and removed, so be sure to check that the updates
a022088674a5ae72ed29ae001834cbad62a4f19fTimo Sirainen array is non-empty also. */
a2cbf1d392ee983520451bc9b849a490f28ac298Timo Sirainen /* extension updates */
1279090ba03f9c176976a69ab7718f0ed77b19afTimo Sirainen#define MAIL_INDEX_TRANSACTION_HAS_CHANGES(t) \
1279090ba03f9c176976a69ab7718f0ed77b19afTimo Sirainen ((t)->log_updates || (t)->log_ext_updates || \
8872e5c991430f96138a46e36b7f3c2c40d8e5c2Timo Sirainen (array_is_created(&(t)->updates) && array_count(&(t)->updates) > 0) || \
2b8ff102f5117f917248f98ccbdc8e6a6af83c87Aki Tuomitypedef void hook_mail_index_transaction_created_t(struct mail_index_transaction *t);
a102d189881a35d72ac3106a9e7e00577ae69310Aki Tuomivoid mail_index_transaction_hook_register(hook_mail_index_transaction_created_t *hook);
a102d189881a35d72ac3106a9e7e00577ae69310Aki Tuomivoid mail_index_transaction_hook_unregister(hook_mail_index_transaction_created_t *hook);
24fc71a693331ffe77e2b6d81c70aca6fa055e47Timo Sirainenmail_index_transaction_lookup(struct mail_index_transaction *t, uint32_t seq);
09c3a491f4f6ccebe290c7709bdc0d79a187610bTimo Sirainenvoid mail_index_transaction_ref(struct mail_index_transaction *t);
d5cebe7f98e63d4e2822863ef2faa4971e8b3a5dTimo Sirainenvoid mail_index_transaction_unref(struct mail_index_transaction **t);
b346610430690398b8c840006004a2df4aa8ce92Timo Sirainenvoid mail_index_transaction_reset_v(struct mail_index_transaction *t);
985fa802913c96ce6f2e25bbc788ee39c416a7e0Timo Sirainenvoid mail_index_transaction_sort_appends(struct mail_index_transaction *t);
0c909e3461607eadcd66f4eac69b7f34e37fccf1Timo Sirainenvoid mail_index_transaction_sort_expunges(struct mail_index_transaction *t);
1d3f7c1278168d5b1cbfa9a2cc9929a0909056b4Timo Sirainenuint32_t mail_index_transaction_get_next_uid(struct mail_index_transaction *t);
1279090ba03f9c176976a69ab7718f0ed77b19afTimo Sirainenvoid mail_index_transaction_set_log_updates(struct mail_index_transaction *t);
d97f939b1c09e9f90b01b6f81bfb1c05da990148Timo Sirainenvoid mail_index_update_day_headers(struct mail_index_transaction *t, time_t day_stamp);
3fe9483b2b412a14493e3120751b0e99ecfe9388Timo Sirainenmail_index_transaction_get_flag_update_pos(struct mail_index_transaction *t,
515f81466f673c1b4f72e053f1a9686e6fca6b61Timo Sirainenvoid mail_index_transaction_lookup_latest_keywords(struct mail_index_transaction *t,
02bb8313a711dfe50c7f01e8132e13ca93ecfb42Timo Sirainenbool mail_index_cancel_flag_updates(struct mail_index_transaction *t,
02bb8313a711dfe50c7f01e8132e13ca93ecfb42Timo Sirainenbool mail_index_cancel_keyword_updates(struct mail_index_transaction *t,
9e6d83a3ef6abb393eeebca423cfd0d8cb08d430Timo Sirainen/* As input the array's each element starts with struct seq_range where
9e6d83a3ef6abb393eeebca423cfd0d8cb08d430Timo Sirainen uid1..uid2 are actually sequences within the transaction view. This function
9e6d83a3ef6abb393eeebca423cfd0d8cb08d430Timo Sirainen changes the sequences into UIDs. If the transaction has any appends, they
9e6d83a3ef6abb393eeebca423cfd0d8cb08d430Timo Sirainen must have already been assigned UIDs. */
9e6d83a3ef6abb393eeebca423cfd0d8cb08d430Timo Sirainenvoid mail_index_transaction_seq_range_to_uid(struct mail_index_transaction *t,
a42d489d99bcf7d18cfd0352fdf0c9348cb224fcTimo Sirainenvoid mail_index_transaction_finish_so_far(struct mail_index_transaction *t);
5e88e4624aa6d482b5b195acd2f4e02aeb385f20Timo Sirainenvoid mail_index_transaction_finish(struct mail_index_transaction *t);
1279090ba03f9c176976a69ab7718f0ed77b19afTimo Sirainenvoid mail_index_transaction_export(struct mail_index_transaction *t,
6a0855a04d75bce3c0a2f68517d02f86ae72087fTimo Sirainen struct mail_transaction_log_append_ctx *append_ctx,
6a0855a04d75bce3c0a2f68517d02f86ae72087fTimo Sirainen enum mail_index_transaction_change *changes_r);
0c909e3461607eadcd66f4eac69b7f34e37fccf1Timo Sirainenint mail_transaction_expunge_guid_cmp(const struct mail_transaction_expunge_guid *e1,
0c909e3461607eadcd66f4eac69b7f34e37fccf1Timo Sirainen const struct mail_transaction_expunge_guid *e2);
b346610430690398b8c840006004a2df4aa8ce92Timo Sirainenmail_index_transaction_get_flag_update_pos(struct mail_index_transaction *t,