mail-index-sync-update.c revision 024815ea2ffdda9ea79919f18e865663977f73ea
/* 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"
#include "mail-transaction-util.h"
static void
{
/* different recent-flag */
if ((old_flags & MAIL_RECENT) == 0)
else if (--hdr->recent_messages_count == 0)
}
/* different seen-flag */
}
/* different deleted-flag */
if ((old_flags & MAIL_DELETED) == 0)
else if (--hdr->deleted_messages_count == 0)
}
}
static void
const struct mail_index_record *rec)
{
}
const struct mail_transaction_expunge *e)
{
struct mail_index_record *rec;
int ret;
if (seq1 == 0)
return;
}
/* @UNSAFE */
}
}
{
return 1;
}
{
"Append with UID %u, but next_uid = %u",
return -1;
}
if (MAIL_INDEX_MAP_IS_IN_MEMORY(map)) {
} else {
}
view->messages_count++;
map->records_count++;
return 1;
}
static int sync_flag_update(const struct mail_transaction_flag_update *u,
void *context)
{
struct mail_index_record *rec;
struct mail_index_header *hdr;
int update_keywords, ret;
if (seq1 == 0)
return 1;
if ((u->add_flags & MAIL_INDEX_MAIL_FLAG_DIRTY) != 0)
for (i = 0; i < INDEX_KEYWORDS_BYTE_COUNT; i++) {
if (u->add_keywords[i] != 0 ||
u->remove_keywords[i] != 0)
keyword_mask[i] = ~u->remove_keywords[i];
}
flag_mask = ~u->remove_flags;
if (update_keywords) {
for (i = 0; i < INDEX_KEYWORDS_BYTE_COUNT; i++) {
}
}
}
return 1;
}
static int sync_cache_update(const struct mail_transaction_cache_update *u,
void *context)
{
int ret;
if (seq != 0) {
cache_offset = u->cache_offset;
}
return 1;
}
static int sync_header_update(const struct mail_transaction_header_update *u,
void *context)
{
void *data;
return 1;
}
static int
const struct mail_transaction_extra_rec_update *u,
void *context)
{
struct mail_index_record *rec;
int ret;
/* FIXME: do data_id mapping conversion */
if (seq != 0) {
}
return 1;
}
unsigned int count)
{
return 0;
return 0;
/* when we grow fast, do it exponentially */
if (count < MAIL_INDEX_MAX_POWER_GROW)
return -1;
return 0;
}
{
struct mail_index_map *map;
const struct mail_transaction_header *hdr;
const void *data;
return -1;
/* NOTE: locking may change index->map so make sure assignment
after locking */
if (had_dirty)
!map->write_to_disk) {
/* 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 */
}
return -1;
}
view) < 0) {
ret = -1;
break;
}
}
if (ret < 0)
return -1;
had_dirty) {
/* do we have dirty flags anymore? */
const struct mail_index_record *rec;
for (i = 0; i < map->records_count; i++) {
break;
}
}
}
if (!MAIL_INDEX_MAP_IS_IN_MEMORY(map)) {
ret = -1;
}
}
return ret;
}
};