mail-index-sync-update.c revision b7b81543899e306c71e6152516d8698416162bcb
/* Copyright (C) 2004 Timo Sirainen */
#include "lib.h"
#include "buffer.h"
#include "file-set-size.h"
#include "mmap-util.h"
#include "mail-index-view-private.h"
#include "mail-index-sync-private.h"
#include "mail-transaction-log.h"
struct mail_index_update_ctx {
struct mail_index *index;
struct mail_index_header hdr;
struct mail_transaction_log_view *log_view;
};
{
/* different seen-flag */
else
}
/* different deleted-flag */
if ((old_flags & MAIL_DELETED) == 0)
else
}
}
const struct mail_index_record *rec)
{
}
{
struct mail_index_record *rec;
}
struct mail_index_sync_rec *syncrec)
{
int i, update_custom;
for (i = 0; i < INDEX_CUSTOM_FLAGS_BYTE_COUNT; i++) {
if (syncrec->add_custom_flags[i] != 0)
if (syncrec->remove_custom_flags[i] != 0)
}
if (update_custom) {
for (i = 0; i < INDEX_CUSTOM_FLAGS_BYTE_COUNT; i++) {
rec->custom_flags[i] =
syncrec->add_custom_flags[i];
}
}
}
}
{
unsigned int records_count;
if (MAIL_INDEX_MAP_IS_IN_MEMORY(map)) {
count * sizeof(struct mail_index_record));
return 0;
}
return 0;
/* when we grow fast, do it exponentially */
return -1;
return 0;
}
const struct mail_index_record *appends,
unsigned int count)
{
unsigned int i;
return -1;
for (i = 0; i < count; i++) {
"Append with UID %u, but next_uid = %u",
return -1;
}
}
return 0;
}
{
struct mail_index_update_ctx ctx;
struct mail_index_sync_rec rec;
const struct mail_index_record *appends;
unsigned int append_count;
unsigned int lock_id;
/* rewind */
/* see if we need to update sync headers */
}
}
if (!changed) {
/* nothing to sync */
return 0;
}
return -1;
break;
if (src_idx == 0) {
/* expunges have to be atomic. so we'll have
to copy the mapping, do the changes there
and then finally replace the whole index
file. to avoid extra disk I/O we copy the
index into memory rather than to temporary
file */
} else {
}
break;
break;
}
}
if (src_idx != 0) {
}
ret = 0;
if (append_count > 0)
if (!MAIL_INDEX_MAP_IS_IN_MEMORY(map)) {
ret = -1;
}
} else {
}
return ret;
}