index-transaction.c revision 398d66217c5916b14485714954c14cf8af0c8547
c25356d5978632df6203437e1953bcb29e0c736fTimo Sirainen/* Copyright (c) 2003-2009 Dovecot authors, see the included COPYING file */
dd62b77c932d1b518f2a3e4bf80e36542becc256Timo Sirainenvoid index_transaction_init(struct index_transaction_context *t,
87a6b7df39d6822a5a8289a62f32deabff9b75e4Timo Sirainen array_create(&t->mailbox_ctx.module_contexts, default_pool,
87a6b7df39d6822a5a8289a62f32deabff9b75e4Timo Sirainen sizeof(void *), 5);
87a6b7df39d6822a5a8289a62f32deabff9b75e4Timo Sirainen t->trans_view = mail_index_transaction_open_updated_view(t->trans);
7b29ccd796fc75af86f827192d2f8c0e8f0087bbTimo Sirainen t->cache_view = mail_cache_view_open(ibox->cache, t->trans_view);
7b29ccd796fc75af86f827192d2f8c0e8f0087bbTimo Sirainen t->cache_trans = mail_cache_get_transaction(t->cache_view, t->trans);
87a6b7df39d6822a5a8289a62f32deabff9b75e4Timo Sirainenstatic void index_transaction_free(struct index_transaction_context *t)
7b29ccd796fc75af86f827192d2f8c0e8f0087bbTimo Sirainenint index_transaction_finish_commit(struct index_transaction_context *t,
e93184a9055c2530366dfe617e07199603c399ddMartti Rannanjärvi ret = t->super.commit(t->trans, log_file_seq_r, log_file_offset_r);
09801f106cd531a28b4e03ec665e44c421264560Timo Sirainen t->ibox->commit_log_file_seq = *log_file_seq_r;
fe363b433b8038a69b55169da9dca27892ad7d18Timo Sirainen t->ibox->commit_log_file_offset = *log_file_offset_r;
212a34c06ff45952c008ae9eec387ced783de6cfPhil Carmodyvoid index_transaction_finish_rollback(struct index_transaction_context *t)
bdcb00145ad87765e3fd22d4ebc4d2c029a326b9Timo Sirainen struct index_mailbox *ibox = (struct index_mailbox *)box;
f4735bf7ec2019fdc730e9ebdb39e5a4ea580405Timo Sirainen enum mail_index_transaction_flags trans_flags;
8cb72c59d5ea4e9e5f638d7ec840bb853f5a188eTimo Sirainen trans_flags = MAIL_INDEX_TRANSACTION_FLAG_AVOID_FLAG_UPDATES;
8cb72c59d5ea4e9e5f638d7ec840bb853f5a188eTimo Sirainen if ((flags & MAILBOX_TRANSACTION_FLAG_HIDE) != 0)
8cb72c59d5ea4e9e5f638d7ec840bb853f5a188eTimo Sirainen trans_flags |= MAIL_INDEX_TRANSACTION_FLAG_HIDE;
8cb72c59d5ea4e9e5f638d7ec840bb853f5a188eTimo Sirainen if ((flags & MAILBOX_TRANSACTION_FLAG_EXTERNAL) != 0)
8cb72c59d5ea4e9e5f638d7ec840bb853f5a188eTimo Sirainen trans_flags |= MAIL_INDEX_TRANSACTION_FLAG_EXTERNAL;
8cb72c59d5ea4e9e5f638d7ec840bb853f5a188eTimo Sirainen if ((flags & MAILBOX_TRANSACTION_FLAG_REFRESH) != 0)
e2ce8d4a6ac5d82a906178148453e7613fab9ba0Timo Sirainen t = mail_index_transaction_begin(ibox->view, trans_flags);
ecc81625167ed96c04c02aa190a1ea5baa65b474Timo Sirainen i_panic("mail storage transaction context mising for type %s",
a10ed8c47534b4c6b6bf2711ccfe577e720a47b4Timo Sirainenint index_transaction_commit(struct mailbox_transaction_context *_t,
1a0ece3e873e3864269ed7eaed957dc10c56d25fTimo Sirainen struct mail_index_transaction *itrans = t->trans;
5af5137f6dc0c9f358b7813e941e26f7bd735b3aTimo Sirainen return mail_index_transaction_commit(&itrans);
e2ce8d4a6ac5d82a906178148453e7613fab9ba0Timo Sirainenvoid index_transaction_rollback(struct mailbox_transaction_context *_t)
07e4875d250e7a7157cd99132aafc773cf3cdf83Timo Sirainen struct mail_index_transaction *itrans = t->trans;
7662010b03ffe5f2a6ecf4b4eb220d1c65efea76Timo Sirainenvoid index_transaction_set_max_modseq(struct mailbox_transaction_context *_t,