dsync-transaction-log-scan.c revision 0d439f21c0943108897867afdd52e0ec7e6fb095
/* Copyright (c) 2013 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "hash.h"
#include "mail-index-modseq.h"
#include "mail-storage-private.h"
#include "dsync-mail.h"
#include "dsync-mailbox.h"
#include "dsync-transaction-log-scan.h"
struct dsync_transaction_log_scan {
struct mail_index_view *view;
bool returned_all_changes;
};
static bool ATTR_NOWARN_UNUSED_RESULT
enum dsync_mail_change_type type,
struct dsync_mail_change **change_r)
{
struct dsync_mail_change *change;
const char *orig_guid;
return FALSE;
/* first change for this UID */
} else if (type == DSYNC_MAIL_CHANGE_TYPE_EXPUNGE) {
/* expunge overrides flag changes */
/* already expunged, this change doesn't matter */
return FALSE;
} else {
/* another flag update */
}
return TRUE;
}
static void
const struct mail_transaction_header *hdr)
{
struct dsync_mail_change *change;
/* this is simply a request for expunge */
return;
}
&change);
}
}
}
static bool
{
struct dsync_mail_change *change;
/* this is simply a request for expunge */
return FALSE;
}
&change);
return TRUE;
}
}
return FALSE;
}
static void
const struct mail_transaction_header *hdr)
{
struct dsync_mail_change *change;
bool external;
/* expunge request that hasn't been actually done yet.
we check non-external ones because they might have
the GUID while external ones don't. */
continue;
}
&change) &&
} T_END;
}
}
static bool
{
struct dsync_mail_change *change;
/* we're assuming UID is already known to be expunged */
continue;
&change))
i_unreached();
} T_END;
return TRUE;
}
return FALSE;
}
static void
const struct mail_transaction_header *hdr)
{
struct dsync_mail_change *change;
&change)) {
}
}
}
}
static void
const struct mail_transaction_header *hdr)
{
struct dsync_mail_change *change;
&change))
continue;
}
}
}
static void
{
const char *const *changes;
unsigned int i, count;
for (i = 0; i < count; i++) {
break;
}
}
}
static void
const struct mail_transaction_header *hdr)
{
struct dsync_mail_change *change;
const char *kw_name, *change_str;
unsigned int uids_offset;
if ((uids_offset % 4) != 0)
switch (rec->modify_type) {
case MODIFY_ADD:
break;
case MODIFY_REMOVE:
break;
default:
i_unreached();
}
&change))
continue;
} else {
}
}
}
}
static void
{
struct dsync_mail_change *change;
/* update message's modseq, possibly by creating an empty flag change */
/* highestmodseq update */
continue;
}
&change))
continue;
if (!pvt_scan) {
} else {
}
}
}
static void
{
}
}
static void
const void *data,
const struct mail_transaction_header *hdr,
{
const char *attr_changes = data;
unsigned int i;
}
}
static int
{
bool reset;
int ret;
if (modseq == 0 ||
&log_seq, &log_offset))
ret = 0;
else {
/* scan the view only up to end of the current view.
if there are more changes, we don't care about them until
the next sync. the modseq may however already point to
beyond the current view's end (FIXME: why?) */
}
&reset);
}
if (ret == 0) {
/* return everything we've got */
if (!pvt_scan)
}
return ret < 0 ? -1 : 0;
}
static int
{
struct mail_transaction_log_view *log_view;
const struct mail_transaction_header *hdr;
const void *data;
return -1;
}
/* read the log only up to current position in view */
&file_offset);
&file_offset);
break;
/* ignore changes done by dsync, unless we can get
expunged message's GUID from it */
continue;
}
case MAIL_TRANSACTION_EXPUNGE:
if (!pvt_scan)
break;
if (!pvt_scan)
break;
break;
break;
T_BEGIN {
} T_END;
break;
break;
break;
}
}
if (!pvt_scan) {
}
return 0;
}
static int
const struct dsync_mailbox_attribute *attr2)
{
return -1;
return 1;
}
static unsigned int
{
}
struct mail_index_view *pvt_view,
struct dsync_transaction_log_scan **scan_r)
{
struct dsync_transaction_log_scan *ctx;
10240);
return -1;
return -1;
}
return 0;
}
{
}
{
return scan->attr_changes;
}
bool
{
return scan->returned_all_changes;
}
struct dsync_mail_change *
{
struct mail_transaction_log_view *log_view;
const struct mail_transaction_header *hdr;
const void *data;
&reset) > 0) {
while (!found &&
case MAIL_TRANSACTION_EXPUNGE:
break;
break;
}
}
}
}
{
}