mail-index-sync-update.c revision 31ddc75584c5cde53d2e78a737587f2e7fdcb0d2
/* 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;
}
// FIXME: grow exponentially
count * sizeof(struct mail_index_record);
return -1;
return 0;
}
const struct mail_index_record *appends,
unsigned int count)
{
unsigned int i;
return -1;
}
for (i = 0; i < count; i++) {
/* FIXME: should we rather just update the record?
this can actually happen if append was written to
transaction log but index wasn't updated, then
another sync wrote it again.. */
"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;
int ret;
/* rewind */
if (!mail_index_sync_have_more(sync_ctx)) {
/* nothing to sync */
return 0;
}
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)) {
}
return ret;
}