1
#ifndef DSYNC_WORKER_PRIVATE_H
2
#define DSYNC_WORKER_PRIVATE_H
4
#include "dsync-worker.h"
8
struct dsync_worker_vfuncs {
9
void (*deinit)(struct dsync_worker *);
11
bool (*is_output_full)(struct dsync_worker *worker);
12
int (*output_flush)(struct dsync_worker *worker);
14
struct dsync_worker_mailbox_iter *
15
(*mailbox_iter_init)(struct dsync_worker *worker);
16
int (*mailbox_iter_next)(struct dsync_worker_mailbox_iter *iter,
17
struct dsync_mailbox *dsync_box_r);
18
int (*mailbox_iter_deinit)(struct dsync_worker_mailbox_iter *iter);
20
struct dsync_worker_subs_iter *
21
(*subs_iter_init)(struct dsync_worker *worker);
22
int (*subs_iter_next)(struct dsync_worker_subs_iter *iter,
23
struct dsync_worker_subscription *rec_r);
24
int (*subs_iter_next_un)(struct dsync_worker_subs_iter *iter,
25
struct dsync_worker_unsubscription *rec_r);
26
int (*subs_iter_deinit)(struct dsync_worker_subs_iter *iter);
27
void (*set_subscribed)(struct dsync_worker *worker,
28
const char *name, time_t last_change, bool set);
30
struct dsync_worker_msg_iter *
31
(*msg_iter_init)(struct dsync_worker *worker,
32
const mailbox_guid_t mailboxes[],
33
unsigned int mailbox_count);
34
int (*msg_iter_next)(struct dsync_worker_msg_iter *iter,
35
unsigned int *mailbox_idx_r,
36
struct dsync_message *msg_r);
37
int (*msg_iter_deinit)(struct dsync_worker_msg_iter *iter);
39
void (*create_mailbox)(struct dsync_worker *worker,
40
const struct dsync_mailbox *dsync_box);
41
void (*delete_mailbox)(struct dsync_worker *worker,
42
const struct dsync_mailbox *dsync_box);
43
void (*delete_dir)(struct dsync_worker *worker,
44
const struct dsync_mailbox *dsync_box);
45
void (*rename_mailbox)(struct dsync_worker *worker,
46
const mailbox_guid_t *mailbox,
47
const struct dsync_mailbox *dsync_box);
48
void (*update_mailbox)(struct dsync_worker *worker,
49
const struct dsync_mailbox *dsync_box);
51
void (*select_mailbox)(struct dsync_worker *worker,
52
const mailbox_guid_t *mailbox,
53
const ARRAY_TYPE(mailbox_cache_field) *cache_fields);
54
void (*msg_update_metadata)(struct dsync_worker *worker,
55
const struct dsync_message *msg);
56
void (*msg_update_uid)(struct dsync_worker *worker,
57
uint32_t old_uid, uint32_t new_uid);
58
void (*msg_expunge)(struct dsync_worker *worker, uint32_t uid);
59
void (*msg_copy)(struct dsync_worker *worker,
60
const mailbox_guid_t *src_mailbox, uint32_t src_uid,
61
const struct dsync_message *dest_msg,
62
dsync_worker_copy_callback_t *callback, void *context);
63
void (*msg_save)(struct dsync_worker *worker,
64
const struct dsync_message *msg,
65
const struct dsync_msg_static_data *data,
66
dsync_worker_save_callback_t *callback,
68
void (*msg_save_cancel)(struct dsync_worker *worker);
69
void (*msg_get)(struct dsync_worker *worker,
70
const mailbox_guid_t *mailbox, uint32_t uid,
71
dsync_worker_msg_callback_t *callback, void *context);
72
void (*finish)(struct dsync_worker *worker,
73
dsync_worker_finish_callback_t *callback, void *context);
77
struct dsync_worker_vfuncs v;
79
io_callback_t *input_callback, *output_callback;
80
void *input_context, *output_context;
82
unsigned int readonly:1;
83
unsigned int failed:1;
84
unsigned int verbose:1;
85
unsigned int unexpected_changes:1;
88
struct dsync_worker_mailbox_iter {
89
struct dsync_worker *worker;
93
struct dsync_worker_subs_iter {
94
struct dsync_worker *worker;
98
struct dsync_worker_msg_iter {
99
struct dsync_worker *worker;
103
void dsync_worker_set_failure(struct dsync_worker *worker);