sdbox-storage.h revision f605df8a4c15cc7a11e16fdde994d51473700890
6361N/A#ifndef SDBOX_STORAGE_H
6361N/A#define SDBOX_STORAGE_H
6361N/A
6361N/A#include "index-storage.h"
6361N/A#include "dbox-storage.h"
6361N/A
6361N/A#define SDBOX_STORAGE_NAME "sdbox"
6361N/A#define SDBOX_MAIL_FILE_PREFIX "u."
6361N/A#define SDBOX_MAIL_FILE_FORMAT SDBOX_MAIL_FILE_PREFIX"%u"
6361N/A
6361N/A#define SDBOX_INDEX_HEADER_MIN_SIZE (sizeof(uint32_t))
6361N/Astruct sdbox_index_header {
6361N/A /* increased every time a full mailbox rebuild is done */
6361N/A uint32_t rebuild_count;
6361N/A guid_128_t mailbox_guid;
6361N/A uint8_t flags; /* enum dbox_index_header_flags */
6361N/A uint8_t unused[3];
6361N/A};
6361N/A
6361N/Astruct sdbox_storage {
6361N/A struct dbox_storage storage;
6361N/A};
6361N/A
6361N/Astruct sdbox_mailbox {
6361N/A struct mailbox box;
6361N/A struct sdbox_storage *storage;
6361N/A
6361N/A uint32_t hdr_ext_id;
6361N/A /* if non-zero, storage should be rebuilt (except if rebuild_count
6361N/A has changed from this value) */
6361N/A uint32_t corrupted_rebuild_count;
6361N/A
6361N/A guid_128_t mailbox_guid;
6361N/A};
6361N/A
6361N/Aextern struct mail_vfuncs sdbox_mail_vfuncs;
6361N/A
6361N/Aint sdbox_mail_open(struct dbox_mail *mail, uoff_t *offset_r,
6361N/A struct dbox_file **file_r);
6361N/A
6361N/Aint sdbox_read_header(struct sdbox_mailbox *mbox,
6361N/A struct sdbox_index_header *hdr, bool log_error,
6361N/A bool *need_resize_r);
6361N/Aint sdbox_mailbox_create_indexes(struct mailbox *box,
6361N/A const struct mailbox_update *update,
6361N/A struct mail_index_transaction *trans);
6361N/Avoid sdbox_set_mailbox_corrupted(struct mailbox *box);
6361N/A
6361N/Astruct mail_save_context *
6361N/Asdbox_save_alloc(struct mailbox_transaction_context *_t);
6361N/Aint sdbox_save_begin(struct mail_save_context *ctx, struct istream *input);
6361N/Aint sdbox_save_finish(struct mail_save_context *ctx);
6361N/Avoid sdbox_save_cancel(struct mail_save_context *ctx);
6361N/A
6361N/Astruct dbox_file *
6361N/Asdbox_save_file_get_file(struct mailbox_transaction_context *t, uint32_t seq);
6361N/Avoid sdbox_save_add_file(struct mail_save_context *ctx, struct dbox_file *file);
6361N/A
6361N/Aint sdbox_transaction_save_commit_pre(struct mail_save_context *ctx);
6361N/Avoid sdbox_transaction_save_commit_post(struct mail_save_context *ctx,
6361N/A struct mail_index_transaction_commit_result *result);
6361N/Avoid sdbox_transaction_save_rollback(struct mail_save_context *ctx);
6361N/A
6361N/Aint sdbox_copy(struct mail_save_context *ctx, struct mail *mail);
6361N/A
6361N/A#endif
6361N/A