sdbox-storage.h revision 9865d9e7c5713e41db939222ed9c0225a11fb99e
2ronwalf#ifndef SDBOX_STORAGE_H
2ronwalf#define SDBOX_STORAGE_H
2ronwalf
2ronwalf#include "index-storage.h"
2ronwalf#include "dbox-storage.h"
2ronwalf
2ronwalf#define SDBOX_STORAGE_NAME "sdbox"
2ronwalf#define SDBOX_MAIL_FILE_PREFIX "u."
2ronwalf#define SDBOX_MAIL_FILE_FORMAT SDBOX_MAIL_FILE_PREFIX"%u"
2ronwalf
2ronwalf#define SDBOX_INDEX_HEADER_MIN_SIZE (sizeof(uint32_t))
2ronwalfstruct sdbox_index_header {
2ronwalf /* increased every time a full mailbox rebuild is done */
2ronwalf uint32_t rebuild_count;
2ronwalf guid_128_t mailbox_guid;
2ronwalf uint8_t flags; /* enum dbox_index_header_flags */
2ronwalf uint8_t unused[3];
2ronwalf};
2ronwalf
2ronwalfstruct sdbox_storage {
2ronwalf struct dbox_storage storage;
2ronwalf};
2ronwalf
2ronwalfstruct sdbox_mailbox {
2ronwalf struct mailbox box;
2ronwalf struct sdbox_storage *storage;
2ronwalf
2ronwalf uint32_t hdr_ext_id;
2ronwalf /* if non-zero, storage should be rebuilt (except if rebuild_count
2ronwalf has changed from this value) */
2ronwalf uint32_t corrupted_rebuild_count;
2ronwalf
2ronwalf guid_128_t mailbox_guid;
2ronwalf};
2ronwalf
2ronwalfextern struct mail_vfuncs sdbox_mail_vfuncs;
2ronwalf
2ronwalfint sdbox_mail_open(struct dbox_mail *mail, uoff_t *offset_r,
2ronwalf struct dbox_file **file_r);
2ronwalf
2ronwalfint sdbox_read_header(struct sdbox_mailbox *mbox,
2ronwalf struct sdbox_index_header *hdr, bool log_error,
2ronwalf bool *need_resize_r);
2ronwalfvoid sdbox_set_mailbox_corrupted(struct mailbox *box);
2ronwalf
2ronwalfstruct mail_save_context *
2ronwalfsdbox_save_alloc(struct mailbox_transaction_context *_t);
2ronwalfint sdbox_save_begin(struct mail_save_context *ctx, struct istream *input);
2ronwalfint sdbox_save_finish(struct mail_save_context *ctx);
2ronwalfvoid sdbox_save_cancel(struct mail_save_context *ctx);
2ronwalf
2ronwalfstruct dbox_file *
2ronwalfsdbox_save_file_get_file(struct mailbox_transaction_context *t, uint32_t seq);
2ronwalfvoid sdbox_save_add_file(struct mail_save_context *ctx, struct dbox_file *file);
2ronwalf
2ronwalfint sdbox_transaction_save_commit_pre(struct mail_save_context *ctx);
2ronwalfvoid sdbox_transaction_save_commit_post(struct mail_save_context *ctx,
2ronwalf struct mail_index_transaction_commit_result *result);
2ronwalfvoid sdbox_transaction_save_rollback(struct mail_save_context *ctx);
2ronwalf
2ronwalfint sdbox_copy(struct mail_save_context *ctx, struct mail *mail);
2ronwalf
7daenzerorama#endif
8daenzerorama