mail-index-view-sync.c revision 5375aa138868dc2c45eb1a4ff37a0b577c2814f8
/* Copyright (C) 2003-2004 Timo Sirainen */
#include "lib.h"
#include "buffer.h"
#include "mail-index-view-private.h"
#include "mail-index-sync-private.h"
#include "mail-transaction-log.h"
#include "mail-transaction-util.h"
struct mail_index_view_sync_ctx {
struct mail_index_view *view;
struct mail_index_map *sync_map;
const struct mail_transaction_header *hdr;
const void *data;
unsigned int skipped:1;
unsigned int last_read:1;
};
static int
{
/* with mask 0 we don't get anything, we'll just read the expunges
while seeking to end */
0) < 0)
return -1;
return -1;
}
return 0;
}
struct mail_index_view_sync_ctx **ctx_r)
{
const struct mail_index_header *hdr;
struct mail_index_view_sync_ctx *ctx;
struct mail_index_map *map;
enum mail_transaction_type mask;
/* We must sync flags as long as view is mmap()ed, as the flags may
have already changed under us. */
return -1;
if ((sync_mask & MAIL_INDEX_SYNC_TYPE_EXPUNGE) != 0) {
/* get list of all expunges first */
return -1;
}
return -1;
}
if (sync_mask == MAIL_INDEX_SYNC_MASK_ALL) {
} else {
}
return 0;
}
{
return 0;
return 1;
}
return 0;
}
{
}
count * sizeof(struct mail_index_record));
return 1;
}
{
map->records_count++;
return 1;
}
static int sync_flag_update(const struct mail_transaction_flag_update *u,
void *context)
{
struct mail_index_record *rec;
unsigned int i, idx;
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)
{
return 1;
}
{
static struct mail_transaction_map_functions map_funcs = {
};
}
{
&skipped);
if (ret <= 0) {
if (ret < 0)
return -1;
return 1;
}
if (skipped)
/* skip flag changes that we committed ourself or have already synced */
return 0;
if (mail_index_view_sync_map(ctx) < 0)
return -1;
}
return 1;
}
static void
struct mail_index_sync_rec *rec)
{
case MAIL_TRANSACTION_APPEND: {
ctx->messages_count +=
break;
}
case MAIL_TRANSACTION_EXPUNGE: {
const struct mail_transaction_expunge *exp =
break;
}
case MAIL_TRANSACTION_FLAG_UPDATE: {
const struct mail_transaction_flag_update *update =
break;
}
default:
i_unreached();
}
}
struct mail_index_sync_rec *sync_rec)
{
int ret;
ctx->data_offset = 0;
do {
&offset);
if (ret < 0)
return -1;
return 0;
}
} while (ret == 0);
offset);
}
}
return 1;
}
const uint32_t *
{
return data;
}
{
/* we didn't sync everything */
}
}
{
}
sizeof(log_file_offset));
}