index-transaction.c revision d1fbd2c264368d8b4c7139b96e3b21f45930b857
/* Copyright (c) 2003-2017 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "dict.h"
#include "index-storage.h"
#include "index-sync-private.h"
#include "index-pop3-uidl.h"
#include "index-mail.h"
static void index_transaction_free(struct mailbox_transaction_context *t)
{
mail_index_view_close(&t->view);
if (array_is_created(&t->pvt_saves))
array_free(&t->pvt_saves);
array_free(&t->module_contexts);
i_free(t);
}
static int
{
struct mailbox_transaction_context *t =
const char *error;
int ret = 0;
if (t->nontransactional_changes)
if (t->attr_pvt_trans != NULL) {
"Dict private transaction commit failed: %s", error);
ret = -1;
}
}
if (t->attr_shared_trans != NULL) {
"Dict shared transaction commit failed: %s", error);
ret = -1;
}
}
if (ret < 0) {
ret = -1;
} else {
}
}
if (array_is_created(&t->pvt_saves)) {
ret = -1;
}
i_assert(t->mail_ref_count == 0);
if (ret < 0)
else {
ret = -1;
} else if (result_r->commit_size > 0) {
/* something was written to the transaction log */
}
}
}
if (pvt_sync_ctx != NULL) {
if (index_mailbox_sync_pvt_newmails(pvt_sync_ctx, t) < 0) {
/* failed to add private flags. a bit too late to
return failure though, so just ignore silently */
}
}
return ret;
}
static void
{
struct mailbox_transaction_context *t =
if (t->attr_pvt_trans != NULL)
if (t->attr_shared_trans != NULL)
}
i_assert(t->mail_ref_count == 0);
}
static enum mail_index_transaction_flags
{
if ((flags & MAILBOX_TRANSACTION_FLAG_HIDE) != 0)
if ((flags & MAILBOX_TRANSACTION_FLAG_EXTERNAL) != 0)
if ((flags & MAILBOX_TRANSACTION_FLAG_SYNC) != 0)
return itrans_flags;
}
void index_transaction_init_pvt(struct mailbox_transaction_context *t)
{
return;
}
void index_transaction_init(struct mailbox_transaction_context *t,
{
if ((flags & MAILBOX_TRANSACTION_FLAG_REFRESH) != 0)
sizeof(void *), 5);
if ((flags & MAILBOX_TRANSACTION_FLAG_NO_CACHE_DEC) != 0)
/* set up after mail_cache_get_transaction(), so that we'll still
have the cache_trans available in _index_commit() */
}
struct mailbox_transaction_context *
{
struct mailbox_transaction_context *t;
return t;
}
int index_transaction_commit(struct mailbox_transaction_context *t,
struct mail_transaction_commit_changes *changes_r)
{
int ret = 0;
"transaction changes", 512);
if (t->itrans_pvt != NULL)
ret = -1;
t = NULL;
return ret;
}
void index_transaction_rollback(struct mailbox_transaction_context *t)
{
if (t->itrans_pvt != NULL)
}