b90c23a9862b91594959b918b035d73f7bc0b265Timo Sirainen#define MDBOX_DELETED_STORAGE_NAME "mdbox_deleted"
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen#define MDBOX_GLOBAL_INDEX_PREFIX "dovecot.map.index"
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen#define MDBOX_MAIL_FILE_FORMAT MDBOX_MAIL_FILE_PREFIX"%u"
04c3ac276103b56185119bcff9a66de7a8bb0e68Timo Sirainen#define MDBOX_CLOSE_UNUSED_FILES_TIMEOUT_SECS 30
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen#define MDBOX_INDEX_HEADER_MIN_SIZE (sizeof(uint32_t))
9865d9e7c5713e41db939222ed9c0225a11fb99eTimo Sirainen uint8_t flags; /* enum dbox_index_header_flags */
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen /* paths for storage directories */
5b62dea2f88165f3f4d87bba9011343f3ff415ffTimo Sirainen /* if non-zero, storage should be rebuilt (except if rebuild_count
5b62dea2f88165f3f4d87bba9011343f3ff415ffTimo Sirainen has changed from this value) */
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen /* UNIX timestamp of when the message was saved/copied to this
b67974c4b89ab6950c2694cce8dfb1b6561cc084Josef 'Jeff' Sipek#define MDBOX_DBOX_STORAGE(s) container_of(s, struct mdbox_storage, storage)
b67974c4b89ab6950c2694cce8dfb1b6561cc084Josef 'Jeff' Sipek#define MDBOX_STORAGE(s) MDBOX_DBOX_STORAGE(DBOX_STORAGE(s))
b67974c4b89ab6950c2694cce8dfb1b6561cc084Josef 'Jeff' Sipek#define MDBOX_MAILBOX(s) container_of(s, struct mdbox_mailbox, box)
b90c23a9862b91594959b918b035d73f7bc0b265Timo Sirainenextern struct dbox_storage_vfuncs mdbox_dbox_storage_vfuncs;
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenint mdbox_mail_open(struct dbox_mail *mail, uoff_t *offset_r,
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainen/* Get map_uid for wanted message. */
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenint mdbox_mail_lookup(struct mdbox_mailbox *mbox, struct mail_index_view *view,
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenuint32_t dbox_get_uidvalidity_next(struct mailbox_list *list);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenint mdbox_read_header(struct mdbox_mailbox *mbox,
9865d9e7c5713e41db939222ed9c0225a11fb99eTimo Sirainen struct mdbox_index_header *hdr, bool *need_resize_r);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenvoid mdbox_update_header(struct mdbox_mailbox *mbox,
a10ed8c47534b4c6b6bf2711ccfe577e720a47b4Timo Sirainen const struct mailbox_update *update) ATTR_NULL(3);
f605df8a4c15cc7a11e16fdde994d51473700890Timo Sirainenint mdbox_mailbox_create_indexes(struct mailbox *box,
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenmdbox_save_alloc(struct mailbox_transaction_context *_t);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenint mdbox_save_begin(struct mail_save_context *ctx, struct istream *input);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenint mdbox_save_finish(struct mail_save_context *ctx);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenvoid mdbox_save_cancel(struct mail_save_context *ctx);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenmdbox_save_file_get_file(struct mailbox_transaction_context *t,
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenint mdbox_transaction_save_commit_pre(struct mail_save_context *ctx);
9f19a50d5966643c4d1c5ca06868ac2ad31bc4d5Timo Sirainenvoid mdbox_transaction_save_commit_post(struct mail_save_context *ctx,
9f19a50d5966643c4d1c5ca06868ac2ad31bc4d5Timo Sirainen struct mail_index_transaction_commit_result *result);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenvoid mdbox_transaction_save_rollback(struct mail_save_context *ctx);
1ac7c8e9040e0d0b7e9f849e45b94bfe919595a9Timo Sirainenint mdbox_copy(struct mail_save_context *ctx, struct mail *mail);
5fb3f13537dffd15a31e997da133a721c0728af8Timo Sirainenvoid mdbox_purge_alt_flag_change(struct mail *mail, bool move_to_alt);
b90c23a9862b91594959b918b035d73f7bc0b265Timo Sirainenint mdbox_storage_create(struct mail_storage *_storage,
b90c23a9862b91594959b918b035d73f7bc0b265Timo Sirainen struct mail_namespace *ns, const char **error_r);
b90c23a9862b91594959b918b035d73f7bc0b265Timo Sirainenvoid mdbox_storage_destroy(struct mail_storage *_storage);
5b62dea2f88165f3f4d87bba9011343f3ff415ffTimo Sirainenvoid mdbox_storage_set_corrupted(struct mdbox_storage *storage);
b90c23a9862b91594959b918b035d73f7bc0b265Timo Sirainenvoid mdbox_set_mailbox_corrupted(struct mailbox *box);