dsync-brain.c revision 3fe67ec75ccae1230bb9eb9f16affc48377f6441
/* Copyright (c) 2009 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "hash.h"
#include "master-service.h"
#include "dsync-worker.h"
#include "dsync-brain-private.h"
static void
static void
struct dsync_brain *
struct dsync_worker *dest_worker,
{
struct dsync_brain *brain;
return brain;
}
{
}
{
ret = -1;
if (ret < 0) {
/* make sure we unreference save input streams before workers
are deinitialized, so they can destroy the streams */
}
return ret;
}
{
return;
/* both lists are finished */
}
static void dsync_worker_mailbox_input(void *context)
{
int ret;
&dsync_box)) > 0) {
continue;
else
}
if (ret < 0) {
/* finished listing mailboxes */
}
}
static struct dsync_brain_mailbox_list *
struct dsync_worker *worker)
{
struct dsync_brain_mailbox_list *list;
list);
return list;
}
static void
{
}
{
return;
/* both lists are finished */
}
static int
const struct dsync_worker_subscription *s2)
{
}
static int
const struct dsync_worker_unsubscription *u2)
{
int ret;
}
static void dsync_worker_subs_input(void *context)
{
struct dsync_worker_subscription subs;
struct dsync_worker_unsubscription unsubs;
int ret;
}
if (ret == 0)
return;
&unsubs)) > 0) {
}
if (ret < 0) {
/* finished listing subscriptions */
}
}
static struct dsync_brain_subs_list *
struct dsync_worker *worker)
{
struct dsync_brain_subs_list *list;
return list;
}
static void
{
}
{
bool src_deleted, dest_deleted;
int ret;
GUID, so we can do this quickly. */
dest_boxes[dest]);
if (ret < 0) {
/* exists only in source */
if (!src_deleted) {
new_box.highest_modseq = 0;
&new_box);
}
src++;
} else if (ret > 0) {
/* exists only in dest */
if (!dest_deleted) {
new_box.highest_modseq = 0;
&new_box);
}
dest++;
} else if (src_deleted) {
/* delete from dest too */
if (!dest_deleted) {
}
} else if (dest_deleted) {
/* delete from src too */
dest_boxes[dest]);
} else {
}
}
continue;
new_box.highest_modseq = 0;
}
continue;
new_box.highest_modseq = 0;
}
}
static bool
const struct dsync_worker_subscription *subs,
{
const struct dsync_worker_unsubscription *unsubs;
struct dsync_worker_unsubscription lookup;
*last_change_r = 0;
return FALSE;
return FALSE;
} else {
return TRUE;
}
}
{
int ret;
/* subscriptions are sorted by name. */
if (dest == dest_count)
break;
ret = 1;
} else if (dest == dest_count) {
ret = -1;
} else {
if (ret == 0) {
continue;
}
}
if (ret < 0) {
/* subscribed only in source */
&last_change)) {
last_change, FALSE);
} else {
last_change, TRUE);
}
src++;
} else {
/* subscribed only in dest */
&last_change)) {
last_change, FALSE);
} else {
last_change, TRUE);
}
dest++;
}
}
}
const struct dsync_mailbox *box1,
const struct dsync_mailbox *box2)
{
}
return TRUE;
}
}
return TRUE;
}
(unsigned long long)box1->highest_modseq,
(unsigned long long)box2->highest_modseq);
}
return TRUE;
}
return FALSE;
}
const struct dsync_mailbox *box1,
const struct dsync_mailbox *box2)
{
return TRUE;
}
static void
bool full_sync)
{
struct dsync_brain_mailbox *brain_box;
bool src_deleted, dest_deleted;
int ret;
if (ret == 0) {
if ((full_sync ||
dest_boxes[dest])) &&
!src_deleted && !dest_deleted) {
}
} else if (ret < 0) {
/* exists only in source */
if (!src_deleted) {
i_info("%s: only in source",
}
}
src++;
} else {
/* exists only in dest */
if (!dest_deleted) {
i_info("%s: only in dest",
}
}
dest++;
}
}
continue;
}
continue;
}
}
{
pool_unref(&pool);
}
static void
const struct dsync_brain_mailbox *mailbox)
{
} else {
}
}
static void
{
const struct dsync_brain_mailbox *mailbox;
}
}
{
if (!success)
}
{
break;
break;
/* fall through */
/* fall through */
case DSYNC_STATE_SYNC_MSGS:
break;
/* wait until all saves are done, so we don't try to close
the mailbox too early */
break;
break;
/* fall through */
case DSYNC_STATE_SYNC_FLUSH:
break;
case DSYNC_STATE_SYNC_FLUSH2:
break;
case DSYNC_STATE_SYNC_END:
break;
default:
i_unreached();
}
}
{
enum dsync_state old_state;
}
}
{
}