mail-index-transaction-finish.c revision 3a017aa592823edf0363d77f13458d569637915e
/* Copyright (c) 2003-2009 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "mail-index-private.h"
#include "mail-index-modseq.h"
#include "mail-index-transaction-private.h"
const struct mail_transaction_expunge_guid *e2)
{
return -1;
return 1;
else
return 0;
}
void mail_index_transaction_sort_expunges(struct mail_index_transaction *t)
{
if (!t->expunges_nonsorted)
return;
t->expunges_nonsorted = FALSE;
}
static void
ext_reset_update_atomic(struct mail_index_transaction *t,
{
const struct mail_index_ext *map_ext;
struct mail_transaction_ext_reset *reset;
/* new extension */
reset_id = 1;
} else {
}
if (reset_id != expected_reset_id) {
/* ignore this extension update */
mail_index_ext_set_reset_id(t, ext_id, 0);
return;
}
if (reset_id == 0)
reset_id++;
/* reseting existing data is optional */
if (array_is_created(&t->ext_resets)) {
}
}
static void
{
const uint32_t *expected_reset_ids;
if (!array_is_created(&t->ext_reset_atomic))
return;
if (expected_reset_ids[ext_id] != 0) {
}
}
}
static unsigned int
struct mail_transaction_flag_update update,
unsigned int update_idx,
{
const struct seq_range *keep_range;
unsigned int i, keep_count;
if (keep_count == 1 &&
/* evereything is kept */
return update_idx + 1;
}
/* add back all the updates we want to keep */
for (i = 0; i < keep_count; i++, update_idx++) {
}
return update_idx;
}
static void
{
const struct mail_transaction_flag_update *updates, *u;
const struct mail_index_record *rec;
unsigned int i, count;
if (!t->drop_unnecessary_flag_updates)
return;
for (i = 0; i < count; ) {
/* first get the list of changes to drop */
u = &updates[i];
array_clear(&keeps);
/* keep this change */
}
}
}
if (array_count(&t->updates) == 0)
array_free(&t->updates);
}
static bool
{
if (array_is_created(array)) {
if (array_count(array) == 0)
return TRUE;
}
}
return FALSE;
}
static bool
{
struct mail_index_transaction_keyword_update *kw;
unsigned int i, count;
if (array_is_created(&t->keyword_updates)) {
for (i = 0; i < count; i++) {
seq))
}
if (!have_kw_changes)
array_free(&t->keyword_updates);
}
if (!array_is_created(&t->updates))
return ret;
/* exists */
if (count > 1)
else
array_free(&t->updates);
else {
/* need to split it in two */
tmp_update = updates[i];
}
}
return ret;
}
static void
{
i_assert(t->max_modseq != 0);
/* no conflicts possible */
return;
}
if (t->min_flagupdate_seq == 0) {
/* no flag updates */
return;
}
if (mail_index_update_cancel(t, seq))
}
}
}
static uint32_t
{
const struct mail_index_record *rec;
if (seq >= t->first_new_seq)
else {
}
}
static void
mail_index_convert_to_uids(struct mail_index_transaction *t,
{
unsigned int i, count;
if (!array_is_created(array))
return;
for (i = 0; i < count; i++) {
}
}
static uint32_t
get_nonexpunged_uid2(struct mail_index_transaction *t,
{
seq1++;
seq1++;
uid1++;
}
return uid1;
}
static void
{
unsigned int i, count;
if (!array_is_created(array))
return;
for (i = 0; i < count; i++) {
/* simple conversion */
} else {
/* remove expunged UIDs */
count++;
/* continue the range without the inserted seqs */
}
}
}
static void keyword_updates_convert_to_uids(struct mail_index_transaction *t)
{
unsigned int i, count;
if (!array_is_created(&t->keyword_updates))
return;
for (i = 0; i < count; i++) {
}
}
static void expunges_convert_to_uids(struct mail_index_transaction *t)
{
struct mail_transaction_expunge_guid *expunges;
if (!array_is_created(&t->expunges))
return;
if (count == 0)
return;
/* convert uids and drop duplicates */
dest++;
}
}
}
static void
{
unsigned int i, count;
if (array_is_created(&t->ext_rec_updates)) {
for (i = 0; i < count; i++)
mail_index_convert_to_uids(t, (void *)&updates[i]);
}
if (array_is_created(&t->ext_rec_atomics)) {
for (i = 0; i < count; i++)
mail_index_convert_to_uids(t, (void *)&updates[i]);
}
mail_index_convert_to_uid_ranges(t, (void *)&t->updates);
}
int mail_index_transaction_finish(struct mail_index_transaction *t)
{
if (array_is_created(&t->appends)) {
}
MAIL_INDEX_SYNC_HANDLER_HEAD) <= 0)
return -1;
}
if (array_is_created(&t->ext_reset_atomic))
if (t->max_modseq != 0)
/* finally convert all sequences to UIDs before we write them,
but after we've checked and removed conflicts */
return 0;
}