#ifndef REPLICATOR_QUEUE_H
#define REPLICATOR_QUEUE_H
#include "priorityq.h"
#include "replication-common.h"
struct replicator_user {
char *username;
/* dsync state for incremental syncing */
char *state;
/* last time this user's state was updated */
/* last_fast_sync is always >= last_full_sync. */
int refcount;
/* User isn't currently in replication queue */
/* Last replication sync failed */
/* Force a full sync on the next replication */
};
struct replicator_queue *
replicator_queue_init(unsigned int full_sync_interval,
unsigned int failure_resync_interval);
void *context);
/* Reference the user */
/* Unreference the user. Returns TRUE if refcount is still >0. */
/* Lookup an existing user */
struct replicator_user *
/* Add a user to queue and return it. If the user already exists, it's updated
only if the new priority is higher. */
struct replicator_user *
enum replication_priority priority);
const char *username,
void *context);
/* Remove user from replication queue and free it. */
struct replicator_user **user);
/* Return the next user from replication queue, and remove it from the queue.
If there's nothing to be replicated currently, returns NULL and sets
next_secs_r to when there should be more work to do. */
struct replicator_user *
unsigned int *next_secs_r);
/* Add user back to queue. */
struct replicator_user *user);
/* Returns TRUE if user replication can be started now, FALSE if not. When
returning FALSE, next_secs_r is set to user's next replication time. */
struct replicator_user *user,
unsigned int *next_secs_r);
/* Iterate through all users in the queue. */
struct replicator_queue_iter *
struct replicator_user *
const char *auth_socket_path,
#endif