dsync-worker.h revision 3fe67ec75ccae1230bb9eb9f16affc48377f6441
#ifndef DSYNC_WORKER_H
#define DSYNC_WORKER_H
#include "ioloop.h"
#include "dsync-data.h"
enum dsync_msg_get_result {
};
struct dsync_worker_subscription {
};
struct dsync_worker_unsubscription {
/* SHA1 sum of the mailbox's storage name, i.e. without namespace
prefix */
const char *ns_prefix;
};
const struct dsync_msg_static_data *data,
void *context);
struct dsync_worker *
/* Set this worker as read-only. All attempted changes are ignored. */
/* If any function returns with "waiting for more data", the given callback
gets called when more data is available. */
/* Returns TRUE if command queue is full and caller should stop sending
more commands. */
/* The given callback gets called when more commands can be queued. */
/* Try to flush command queue. Returns 1 if all flushed, 0 if something is
still in queue, -1 if failed. */
/* Iterate though all mailboxes */
struct dsync_worker_mailbox_iter *
/* Get the next available mailbox. Returns 1 if ok, 0 if waiting for more data,
-1 if there are no more mailboxes. */
struct dsync_mailbox *dsync_box_r);
/* Finish mailbox iteration. Returns 0 if ok, -1 if iteration failed. */
/* Iterate though all subscriptions */
struct dsync_worker_subs_iter *
/* Get the next subscription. Returns 1 if ok, 0 if waiting for more data,
-1 if there are no more subscriptions. */
struct dsync_worker_subscription *rec_r);
/* Like _iter_next(), but list known recent unsubscriptions. */
struct dsync_worker_unsubscription *rec_r);
/* Finish subscription iteration. Returns 0 if ok, -1 if iteration failed. */
/* Subscribe/unsubscribe mailbox */
bool set);
/* Iterate through all messages in given mailboxes. The mailboxes are iterated
in the given order. */
struct dsync_worker_msg_iter *
const mailbox_guid_t mailboxes[],
unsigned int mailbox_count);
/* Get the next available message. Also returns all expunged messages from
the end of mailbox (if next_uid-1 message exists, nothing is returned).
mailbox_idx_r contains the mailbox's index in mailboxes[] array given
to _iter_init(). Returns 1 if ok, 0 if waiting for more data, -1 if there
are no more messages. */
unsigned int *mailbox_idx_r,
struct dsync_message *msg_r);
/* Finish message iteration. Returns 0 if ok, -1 if iteration failed. */
/* Create mailbox with given name, GUID and UIDVALIDITY. */
const struct dsync_mailbox *dsync_box);
const struct dsync_mailbox *dsync_box);
/* Change a mailbox and its childrens' name. The name is taken from the given
dsync_box (applying name_sep if necessary). */
const mailbox_guid_t *mailbox,
const struct dsync_mailbox *dsync_box);
/* Find mailbox with given GUID and make sure its uid_next and
highest_modseq are up to date (but don't shrink them). */
const struct dsync_mailbox *dsync_box);
/* The following message syncing functions access the this selected mailbox. */
const struct dsync_mailbox *box);
/* Update message's metadata (flags, keywords, modseq). */
const struct dsync_message *msg);
/* Change message's UID. */
/* Expunge given message. */
/* Copy given message. */
const struct dsync_message *dest_msg,
void *context);
/* Save given message from the given input stream. The stream is destroyed once
saving is finished. */
const struct dsync_message *msg,
const struct dsync_msg_static_data *data);
/* Cancel any pending saves */
/* Get message data for saving. The callback is called once when the static
data has been received. The whole message may not have been downloaded yet,
so the caller must read the input stream until it returns EOF and then
unreference it. */
/* Call the callback once all the pending commands are finished. */
void *context);
/* Returns TRUE if some commands have failed. */
/* Returns TRUE if some UID or modseq changes didn't get assigned as
requested. */
#endif