dsync-brain.c revision 707f172cd4e4c91af86ff5bd82a60a873dec6f70
/* Copyright (c) 2012 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "hash.h"
#include "mail-namespace.h"
#include "dsync-mailbox-tree.h"
#include "dsync-ibc.h"
#include "dsync-brain-private.h"
"recv_handshake",
"send_last_common",
"recv_last_common",
"send_mailbox_tree",
"send_mailbox_tree_deletes",
"recv_mailbox_tree",
"recv_mailbox_tree_deletes",
"master_send_mailbox",
"slave_recv_mailbox",
"sync_mails",
"done"
};
static void dsync_brain_run_io(void *context)
{
bool changed, try_pending;
return;
}
try_pending = TRUE;
do {
break;
}
if (changed)
try_pending = TRUE;
else if (try_pending) {
try_pending = FALSE;
}
} while (changed);
}
static struct dsync_brain *
{
struct dsync_brain *brain;
return brain;
}
static void
{
(flags & DSYNC_BRAIN_FLAG_SEND_GUID_REQUESTS) != 0;
(flags & DSYNC_BRAIN_FLAG_MAILS_HAVE_GUIDS) != 0;
(flags & DSYNC_BRAIN_FLAG_SYNC_ALL_NAMESPACES) != 0;
}
struct dsync_brain *
enum dsync_brain_flags flags,
const char *state)
{
struct dsync_ibc_settings ibc_set;
struct dsync_brain *brain;
const char *error;
if (sync_type == DSYNC_BRAIN_SYNC_TYPE_STATE) {
&error) < 0) {
i_error("Saved sync state is invalid, "
"falling back to full sync: %s", error);
} else {
}
}
/* reverse the backup direction for the slave */
if ((flags & DSYNC_BRAIN_FLAG_BACKUP_SEND) != 0)
else if ((flags & DSYNC_BRAIN_FLAG_BACKUP_RECV) != 0)
return brain;
}
struct dsync_brain *
{
struct dsync_brain *brain;
return brain;
}
{
int ret;
return ret;
}
{
const struct dsync_ibc_settings *ibc_set;
return FALSE;
}
else
return TRUE;
}
{
struct dsync_mailbox_state *state;
}
for (;;) {
if (ret == DSYNC_IBC_SEND_RET_FULL)
return;
break;
}
}
const struct dsync_mailbox_state *state)
{
struct dsync_mailbox_state *dupstate;
}
{
struct dsync_mailbox_state state;
enum dsync_ibc_recv_ret ret;
}
if (ret == DSYNC_IBC_RECV_RET_FINISHED) {
}
return changed;
}
{
return FALSE;
}
break;
break;
break;
break;
break;
break;
break;
break;
break;
case DSYNC_STATE_SYNC_MAILS:
break;
case DSYNC_STATE_DONE:
break;
}
i_debug("brain %c: out state=%s changed=%d",
}
}
{
bool ret;
return FALSE;
}
T_BEGIN {
} T_END;
return ret;
}
{
struct hash_iterate_context *iter;
struct dsync_mailbox_node *node;
const struct dsync_mailbox_state *new_state;
struct dsync_mailbox_state *state;
/* update mailbox states */
else
}
/* remove nonexistent mailboxes */
guid);
}
}
{
}