dbox-storage.h revision 804fa3f03bd9170272168a5ad214053bbe3160c7
e8762c2b4914db7997fa9eb644a91586952d1876Timo Sirainen#define DBOX_SUBSCRIPTION_FILE_NAME "subscriptions"
b9f564d00b7a115f465ffd6840341c7b8f9bfc8aTimo Sirainen#define DBOX_UIDVALIDITY_FILE_NAME "dovecot-uidvalidity"
b9f564d00b7a115f465ffd6840341c7b8f9bfc8aTimo Sirainen/* Delete temp files having ctime older than this. */
b9f564d00b7a115f465ffd6840341c7b8f9bfc8aTimo Sirainen/* Flag specifies if the message should be in primary or alternative storage */
b9f564d00b7a115f465ffd6840341c7b8f9bfc8aTimo Sirainen#define DBOX_INDEX_FLAG_ALT MAIL_INDEX_MAIL_FLAG_BACKEND
b9f564d00b7a115f465ffd6840341c7b8f9bfc8aTimo Sirainen /* messages' metadata contain POP3 UIDLs */
b9f564d00b7a115f465ffd6840341c7b8f9bfc8aTimo Sirainen DBOX_INDEX_HEADER_FLAG_HAVE_POP3_UIDLS = 0x01,
b9f564d00b7a115f465ffd6840341c7b8f9bfc8aTimo Sirainen /* messages' metadata contain POP3 orders */
b9f564d00b7a115f465ffd6840341c7b8f9bfc8aTimo Sirainen DBOX_INDEX_HEADER_FLAG_HAVE_POP3_ORDERS = 0x02
b9f564d00b7a115f465ffd6840341c7b8f9bfc8aTimo Sirainen /* dbox file has zero references now. it should be either freed or
b9f564d00b7a115f465ffd6840341c7b8f9bfc8aTimo Sirainen left open in case it's accessed again soon */
b9f564d00b7a115f465ffd6840341c7b8f9bfc8aTimo Sirainen /* create a new file using the same permissions as file.
b9f564d00b7a115f465ffd6840341c7b8f9bfc8aTimo Sirainen if parents=TRUE, create the directory if necessary */
b9f564d00b7a115f465ffd6840341c7b8f9bfc8aTimo Sirainen int (*file_create_fd)(struct dbox_file *file, const char *path,
b9f564d00b7a115f465ffd6840341c7b8f9bfc8aTimo Sirainen /* open the mail and return its file/offset */
b9f564d00b7a115f465ffd6840341c7b8f9bfc8aTimo Sirainen int (*mail_open)(struct dbox_mail *mail, uoff_t *offset_r,
b9f564d00b7a115f465ffd6840341c7b8f9bfc8aTimo Sirainen /* create/update mailbox indexes */
b9f564d00b7a115f465ffd6840341c7b8f9bfc8aTimo Sirainen int (*mailbox_create_indexes)(struct mailbox *box,
b9f564d00b7a115f465ffd6840341c7b8f9bfc8aTimo Sirainen /* returns attachment path suffix. mdbox returns "", sdbox returns
b9f564d00b7a115f465ffd6840341c7b8f9bfc8aTimo Sirainen "-<mailbox_guid>-<uid>" */
b9f564d00b7a115f465ffd6840341c7b8f9bfc8aTimo Sirainen const char *(*get_attachment_path_suffix)(struct dbox_file *file);
b9f564d00b7a115f465ffd6840341c7b8f9bfc8aTimo Sirainen /* mark the mailbox corrupted */
b9f564d00b7a115f465ffd6840341c7b8f9bfc8aTimo Sirainen void (*set_mailbox_corrupted)(struct mailbox *box);
b9f564d00b7a115f465ffd6840341c7b8f9bfc8aTimo Sirainen /* mark the file corrupted */
b9f564d00b7a115f465ffd6840341c7b8f9bfc8aTimo Sirainen void (*set_file_corrupted)(struct dbox_file *file);
c59b9c273b41f7bcf51f6803110b67813879ff05Timo Sirainen#define DBOX_STORAGE(s) container_of(s, struct dbox_storage, storage)
c59b9c273b41f7bcf51f6803110b67813879ff05Timo Sirainenvoid dbox_storage_get_list_settings(const struct mail_namespace *ns,
c59b9c273b41f7bcf51f6803110b67813879ff05Timo Sirainenint dbox_storage_create(struct mail_storage *storage,
b9f564d00b7a115f465ffd6840341c7b8f9bfc8aTimo Sirainen const char **error_r);
b9f564d00b7a115f465ffd6840341c7b8f9bfc8aTimo Sirainenvoid dbox_storage_destroy(struct mail_storage *storage);
b9f564d00b7a115f465ffd6840341c7b8f9bfc8aTimo Sirainenuint32_t dbox_get_uidvalidity_next(struct mailbox_list *list);
b9f564d00b7a115f465ffd6840341c7b8f9bfc8aTimo Sirainenint dbox_mailbox_check_existence(struct mailbox *box, time_t *path_ctime_r);
b9f564d00b7a115f465ffd6840341c7b8f9bfc8aTimo Sirainenint dbox_mailbox_open(struct mailbox *box, time_t path_ctime);
c59b9c273b41f7bcf51f6803110b67813879ff05Timo Sirainen const struct mailbox_update *update, bool directory);
b9f564d00b7a115f465ffd6840341c7b8f9bfc8aTimo Sirainenint dbox_mailbox_create_indexes(struct mailbox *box,
b9f564d00b7a115f465ffd6840341c7b8f9bfc8aTimo Sirainenint dbox_verify_alt_storage(struct mailbox_list *list);