virtual-storage.h revision 4cf5f0934a25f1fd58f2780108f9d6498c455a1f
#ifndef VIRTUAL_STORAGE_H
#define VIRTUAL_STORAGE_H
#include "seq-range-array.h"
#include "index-storage.h"
#include "mailbox-list-private.h"
#define VIRTUAL_STORAGE_NAME "virtual"
#define VIRTUAL_SUBSCRIPTION_FILE_NAME ".virtual-subscriptions"
#define VIRTUAL_CONFIG_FNAME "dovecot-virtual"
#define VIRTUAL_INDEX_PREFIX "dovecot.index"
#define VIRTUAL_CONTEXT(obj) \
struct virtual_save_context;
struct virtual_mail_index_header {
/* Increased by one each time the header is modified */
/* Number of mailbox records following this header. Mailbox names
follow the mailbox records - they have neither NUL terminator nor
padding. */
/* Highest used mailbox ID. IDs are never reused. */
/* CRC32 of all the search parameters. If it changes, the mailbox is
rebuilt. */
};
struct virtual_mail_index_mailbox_record {
/* Unique mailbox ID used as mailbox_id in records. */
/* Length of this mailbox's name. */
/* Synced UID validity value */
/* Next unseen UID */
/* Synced highest modseq value */
};
struct virtual_mail_index_record {
};
struct virtual_storage {
struct mail_storage storage;
/* List of mailboxes while a virtual mailbox is being opened.
Used to track loops. */
};
struct virtual_backend_uidmap {
/* can be 0 temporarily while syncing before the UID is assigned */
};
struct virtual_backend_box {
/* Initially zero, updated by syncing */
const char *name;
unsigned int sync_mailbox_idx;
struct mail_search_args *search_args;
struct mail_search_result *search_result;
/* Messages currently included in the virtual mailbox,
sorted by real_uid */
/* temporary mail used while syncing */
/* pending removed UIDs */
/* another process expunged these UIDs. they need to be removed on
next sync. */
/* name contains a wildcard, this is a glob for it */
struct imap_match_glob *glob;
struct mail_namespace *ns;
unsigned int sync_seen:1;
unsigned int wildcard:1;
unsigned int uids_nonsorted:1;
};
struct virtual_mailbox {
struct index_mailbox ibox;
struct virtual_storage *storage;
char *vseq_lookup_prev_mailbox;
struct virtual_backend_box *vseq_lookup_prev_bbox;
/* Mailboxes this virtual mailbox consists of, sorted by mailbox_id */
/* backend mailbox where to save messages when saving to this mailbox */
struct virtual_backend_box *save_bbox;
unsigned int uids_mapped:1;
unsigned int sync_initialized:1;
unsigned int inconsistent:1;
};
extern struct mail_storage virtual_storage;
extern struct mail_vfuncs virtual_mail_vfuncs;
struct virtual_backend_box *
struct virtual_backend_box *
struct mail_search_context *
virtual_search_init(struct mailbox_transaction_context *t,
struct mail_search_args *args,
const enum mail_sort_type *sort_program);
struct mail *
virtual_mail_alloc(struct mailbox_transaction_context *t,
struct mailbox_header_lookup_ctx *wanted_headers);
struct mail *
struct virtual_backend_box *bbox);
struct mailbox_sync_context *
struct mail_save_context *
virtual_save_alloc(struct mailbox_transaction_context *t);
void virtual_transaction_class_init(void);
void virtual_transaction_class_deinit(void);
#endif