mail-index-sync.c revision 287ba82a8da3eaa473b5735d4eeac2fb4c5d8117
/* 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-index-transaction-private.h"
#include "mail-transaction-log-private.h"
#include "mail-transaction-util.h"
#include "mail-cache.h"
#include <stdlib.h>
{
for (i = 0; i < size; i++) {
}
}
{
for (i = 0; i < size; i++) {
if (u[i].add_flags != 0) {
u[i].add_flags);
}
if (u[i].remove_flags != 0) {
u[i].remove_flags);
}
}
}
{
const char *keyword_names[2];
struct mail_keywords *keywords;
uidset_offset = sizeof(*u) + u->name_size;
if ((uidset_offset % 4) != 0)
t_push();
for (i = 0; i < size; i += 2) {
/* FIXME: mail_index_update_keywords_range() */
u->modify_type, keywords);
}
}
t_pop();
}
{
struct mail_keywords *keywords;
for (i = 0; i < size; i++) {
}
}
}
{
}
{
case MAIL_TRANSACTION_EXPUNGE:
break;
break;
break;
break;
case MAIL_TRANSACTION_APPEND:
break;
}
}
{
struct mail_transaction_flag_update update;
const struct mail_index_record *rec;
return -1;
continue;
}
return 0;
}
{
const struct mail_index_record *rec;
int seen_recent = FALSE;
return -1;
seen_recent = TRUE;
}
}
if (!seen_recent) {
/* no recent messages, drop the sync_recent flag so we
don't scan through the message again */
}
return 0;
}
static int
int *seen_external_r)
{
int ret;
*seen_external_r = FALSE;
ctx->sync_dirty) {
/* show dirty flags as flag updates */
if (mail_index_sync_add_dirty_updates(ctx) < 0)
return -1;
}
if (ctx->sync_recent) {
if (mail_index_sync_add_recent_updates(ctx) < 0)
return -1;
}
*seen_external_r = TRUE;
else
}
ctx->expunges_count = 0;
else {
&ctx->expunges_count);
}
ctx->updates_count = 0;
else {
&ctx->updates_count);
}
return ret;
}
{
return 1;
/* already synced */
}
return 1;
}
{
int ret;
NULL)) > 0) {
break;
}
if (ret < 0)
return -1;
if (ret > 0) {
return -1;
return -1;
}
return 0;
}
#define MAIL_INDEX_IS_SYNCS_SAME(index) \
struct mail_index_sync_ctx **ctx_r,
struct mail_index_view **view_r,
int sync_recent, int sync_dirty)
{
struct mail_index_sync_ctx *ctx;
struct mail_index_view *dummy_view;
unsigned int lock_id = 0;
int seen_external;
return -1;
/* make sure we have the latest file mapped */
return -1;
}
/* with mmap_disable the force parameter has somewhat special
file's header. */
return -1;
}
}
return 0;
}
/* synced offset is greater than what we have available.
the log sequences have gotten messed up. */
return -1;
}
MAIL_TRANSACTION_TYPE_MASK) < 0) {
return -1;
}
/* See if there are some external transactions which were
written to transaction log, but weren't yet committed to
index. commit them first to avoid conflicts with another
external sync.
This is mostly needed to make sure there won't be multiple
appends with same UIDs, because those would cause
transaction log to be marked corrupted.
Note that any internal transactions must not be committed
yet. They need to be synced with the real mailbox first. */
return -1;
}
MAIL_TRANSACTION_TYPE_MASK) < 0) {
return -1;
}
}
/* we need to have all the transactions sorted to optimize
caller's mailbox access patterns */
return -1;
}
return 1;
}
void
const struct mail_transaction_expunge *exp)
{
}
void
const struct mail_transaction_flag_update *update)
{
}
struct mail_index_sync_rec *rec)
{
"Broken UID range: %u..%u (type 0x%x)",
return FALSE;
}
break;
break;
}
return TRUE;
}
struct mail_index_sync_rec *sync_rec)
{
const struct mail_transaction_expunge *next_exp;
const struct mail_transaction_flag_update *next_update;
if (next_update != NULL &&
/* it's overlapping with next expunge */
}
/* overlapping with previous expunge */
/* hide this update completely */
ctx->update_idx++;
}
}
ctx->update_idx++;
}
return -1;
ctx->expunge_idx++;
return 1;
}
if (ctx->sync_appends) {
return 1;
}
return 0;
}
{
}
{
}
{
const struct mail_index_header *hdr;
int ret = 0;
ret = -1;
/* we have had the transaction log locked since the beginning of sync,
so only external changes could have been committed. write them to
the index here as well. */
ret = -1;
ret = -1;
}
ret = -1;
else {
/* cache_offsets have changed, sync them */
ret = -1;
ret = -1;
}
}
return ret;
}
{
}
{
}