This documentation is for Dovecot v1.x, see wiki2 for v2.x documentation.

Mailbox Transactions

Before you can read any mails or do any changes to mails, you need to create a transaction with mailbox_transaction_begin(). It has a few flags:

Changes for a transaction are kept in memory until the transaction is committed. If you want to cancel the changes, you can call mailbox_transaction_rollback(). Transaction can be commited with mailbox_transaction_commit(). If you want to know a bit more about the results of the transaction, use mailbox_transaction_commit_get_changes() instead. It returns a change structure:

Once you're done with reading the change structure, be sure to free the memory used by it with pool_unref(&changes->pool).

mailbox_transaction_set_max_modseq() can be used to implement atomic conditional flag changes. If message's modseq is higher than the given max_modseq while transaction is being committed, the change isn't done and the message's sequence number is added to the given array.

None: Design/Storage/Mailbox/Transaction (last edited 2009-12-17 00:58:57 by TimoSirainen)