mail-storage-private.h revision b99515ba4105f6bfd7fa7590dcc73fabf734dec6
e8490a52a1bc71bc53034e68f464435684ad810fTimo Sirainen/* Default prefix for indexes */
eb64c3586d854cddd693f0b811d897399076a441Timo Sirainen/* Block size when read()ing message header. */
eb64c3586d854cddd693f0b811d897399076a441Timo Sirainen/* Block size when read()ing message (header and) body. */
eb64c3586d854cddd693f0b811d897399076a441Timo Sirainen#define MAIL_READ_FULL_BLOCK_SIZE IO_BLOCK_SIZE
eb64c3586d854cddd693f0b811d897399076a441Timo Sirainen unsigned int id;
eb64c3586d854cddd693f0b811d897399076a441Timo Sirainen unsigned int id;
b337d3b6871b878d6467d7d8ed600433af5da5a1Timo Sirainen const struct setting_parser_info *(*get_setting_parser_info)(void);
60b42c6dfdf9edcca8a96b380ef9a0adc60c2464Timo Sirainen int (*create)(struct mail_storage *storage, struct mail_namespace *ns,
16db188cfddce117500a161302f17ae691b4500eTimo Sirainen const char **error_r);
16db188cfddce117500a161302f17ae691b4500eTimo Sirainen void (*destroy)(struct mail_storage *storage);
16db188cfddce117500a161302f17ae691b4500eTimo Sirainen void (*add_list)(struct mail_storage *storage,
296dca49e4fe6046e0328c67ef1cf4b8077dec9cTimo Sirainen void (*get_list_settings)(const struct mail_namespace *ns,
e8490a52a1bc71bc53034e68f464435684ad810fTimo Sirainen bool (*autodetect)(const struct mail_namespace *ns,
6145bd3b17b9135b77b0b42409a0cc3fa0d1b946Timo Sirainen struct mailbox *(*mailbox_alloc)(struct mail_storage *storage,
67c47dbb3fde79218320fd38a45c33f61bbf3012Timo Sirainen /* Called when mailbox list index corruption has been detected.
e8490a52a1bc71bc53034e68f464435684ad810fTimo Sirainen The callback should add any missing mailboxes to the list index.
e8490a52a1bc71bc53034e68f464435684ad810fTimo Sirainen Returns 0 on success, -1 on temporary failure that didn't properly
af3f857bb3166ed99595e11a9d18e5b5cc670e1aTimo Sirainen fix the index. */
af3f857bb3166ed99595e11a9d18e5b5cc670e1aTimo Sirainen int (*list_index_corrupted)(struct mail_storage *storage);
67c47dbb3fde79218320fd38a45c33f61bbf3012Timo Sirainen /* mailboxes are files, not directories */
c58906589cafc32df4c04ffbef933baadd3f2276Timo Sirainen MAIL_STORAGE_CLASS_FLAG_MAILBOX_IS_FILE = 0x01,
c58906589cafc32df4c04ffbef933baadd3f2276Timo Sirainen /* root_dir points to a unique directory */
a64adf62fa33f2463a86f990217b0c9078531a40Timo Sirainen /* mailbox_open_stream() is supported */
a64adf62fa33f2463a86f990217b0c9078531a40Timo Sirainen /* never use quota for this storage (e.g. virtual mailboxes) */
6145bd3b17b9135b77b0b42409a0cc3fa0d1b946Timo Sirainen /* Storage doesn't need a mail root directory */
e8490a52a1bc71bc53034e68f464435684ad810fTimo Sirainen /* Storage uses one file per message */
d9250ee7e2815bb2116134b58f7c860578148d6cTimo Sirainen /* Messages have GUIDs (always set mailbox_status.have_guids=TRUE) */
a10ed8c47534b4c6b6bf2711ccfe577e720a47b4Timo Sirainen MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_GUIDS = 0x40,
092018b35bb1dc5bd61848a38189fe6ac8f791ddTimo Sirainen /* mailbox_save_set_guid() works (always set
7327394e30c1020b9a2a49c72a7e3d0f7803e680Timo Sirainen mailbox_status.have_save_guids=TRUE) */
7327394e30c1020b9a2a49c72a7e3d0f7803e680Timo Sirainen MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_SAVE_GUIDS = 0x80,
e8490a52a1bc71bc53034e68f464435684ad810fTimo Sirainen /* message content can be unstructured binary data
e8490a52a1bc71bc53034e68f464435684ad810fTimo Sirainen (e.g. zlib plugin is allowed to compress/decompress mails) */
6145bd3b17b9135b77b0b42409a0cc3fa0d1b946Timo Sirainen /* Message GUIDs can only be 128bit (always set
6145bd3b17b9135b77b0b42409a0cc3fa0d1b946Timo Sirainen mailbox_status.have_only_guid128) */
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainen MAIL_STORAGE_CLASS_FLAG_HAVE_MAIL_GUID128 = 0x200,
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainen /* Storage deletes all files internally - mailbox list's
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainen delete_mailbox() shouldn't delete anything itself. */
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainen MAIL_STORAGE_CLASS_FLAG_NO_LIST_DELETES = 0x400,
2615df45a8027948a474abe5e817b34b0499c171Timo Sirainen /* Storage supports stubs (used for caching purposes). */
288d6ef592719f2be3cad9f034e9be05f9839785Timo Sirainen /* Fields that the storage backend can get by other means than parsing
288d6ef592719f2be3cad9f034e9be05f9839785Timo Sirainen the message header/body. For example the imapc backend can lookup
288d6ef592719f2be3cad9f034e9be05f9839785Timo Sirainen MAIL_FETCH_IMAP_BODYSTRUCTURE from the remote server. Adding fields
288d6ef592719f2be3cad9f034e9be05f9839785Timo Sirainen here avoids adding them to index_mail_data.access_part. */
32e1554df9abca74fef0af2ba2e4c37e90a06cd0Timo Sirainen/* private: */
c0a87e5f3316a57e6f915882fa1951d0fbb74a61Timo Sirainen /* counting number of times mail_storage_create() has returned this
a988c3fd9251806e38931a011aaa4006dd081cbdTimo Sirainen same storage. */
a988c3fd9251806e38931a011aaa4006dd081cbdTimo Sirainen /* counting number of objects (e.g. mailbox) that have a pointer
c0a87e5f3316a57e6f915882fa1951d0fbb74a61Timo Sirainen to this storage. */
957d09e495c33ad1180f82152e5e87e6b51ab04bTimo Sirainen /* Linked list of all mailboxes in the storage */
9874ad56b94788297fdac4eae7cba5d651b48222Timo Sirainen /* A "root dir" to enable storage sharing. It is only ever used for
e8490a52a1bc71bc53034e68f464435684ad810fTimo Sirainen * uniqueness checking (via strcmp) and never used as a path. */
957d09e495c33ad1180f82152e5e87e6b51ab04bTimo Sirainen /* Last error set in mail_storage_set_critical(). */
void *callback_context;
struct mail_attachment_part {
struct virtual_mailbox_vfuncs {
bool only_with_msgs);
struct mailbox_vfuncs {
struct mailbox_attribute_iter *
const char *prefix);
struct mailbox_sync_context *
struct mailbox_transaction_context *
struct mail *
struct mail_search_context *
struct mail_save_context *
void (*transaction_save_commit_post)
union mailbox_module_context {
struct mail_msgpart_partial_cache {
struct mailbox_index_vsize {
struct mailbox_index_pop3_uidl {
struct mailbox_index_first_saved {
struct mailbox {
const char *name;
const char *vname;
const char *_path;
const char *_index_path;
const char *reason;
const char *index_prefix;
unsigned int transaction_count;
void *notify_context;
unsigned int generation_sequence;
struct mail_vfuncs {
const char **value_r);
const char *reason);
union mail_module_context {
struct mail_private {
const char *get_stream_reason;
struct mailbox_list_context {
bool failed;
struct mailbox_transaction_stats {
unsigned long open_lookup_count;
unsigned long stat_lookup_count;
unsigned long fstat_lookup_count;
unsigned long files_read_count;
unsigned long long files_read_bytes;
unsigned long cache_hit_count;
struct mail_save_private_changes {
unsigned int mailnum;
struct mailbox_transaction_context {
char *reason;
int mail_ref_count;
unsigned int save_count;
union mail_search_module_context {
struct mail_search_context {
struct mail_save_data {
int received_tz_offset;
unsigned int pop3_order;
struct mail_save_context {
struct mailbox_sync_context {
struct mailbox_header_lookup_ctx {
int refcount;
unsigned int count;
const char *const *name;
unsigned int *idx;
const char **path_r);
int *fd_r);
unsigned int secs);