replicator-brain.c revision 447e086422f1ab7cc16833583ed70a4af7a84bc5
/* Copyright (c) 2012 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "ioloop.h"
#include "doveadm-connection.h"
#include "replicator-settings.h"
#include "replicator-queue.h"
#include "replicator-brain.h"
struct replicator_sync_context {
struct replicator_brain *brain;
struct replicator_user *user;
};
struct replicator_brain {
struct replicator_queue *queue;
const struct replicator_settings *set;
};
static void replicator_brain_queue_changed(void *context)
{
}
struct replicator_brain *
const struct replicator_settings *set)
{
struct replicator_brain *brain;
return brain;
}
{
struct doveadm_connection **connp;
}
static struct doveadm_connection *
{
if (!doveadm_connection_is_busy(*connp))
return *connp;
}
return NULL;
return conn;
}
{
if (reply == DOVEADM_REPLY_NOUSER) {
/* user no longer exists, remove from replication */
} else {
}
}
static bool
{
struct replicator_sync_context *ctx;
struct doveadm_connection *conn;
bool full;
return FALSE;
/* update the sync times immediately. if the replication fails we still
wouldn't want it to be retried immediately. */
if (full)
/* reset priority also. if more updates arrive during replication
we'll do another replication to make sure nothing gets lost */
return TRUE;
}
{
}
{
struct replicator_user *user;
unsigned int next_secs;
/* nothing more to do */
return FALSE;
}
/* all connections were full, put the user back to queue */
return FALSE;
}
/* replication started for the user */
return TRUE;
}
{
while (replicator_brain_fill_next(brain)) ;
}