index-storage.h revision 6246b93fb37890dcb2f4df9896438f3f376ab284
#ifndef __INDEX_STORAGE_H
#define __INDEX_STORAGE_H
#include "file-dotlock.h"
#include "mail-storage-private.h"
#include "mail-index.h"
/* Max. mmap()ed size for a message */
/* Block size when read()ing message. */
#define MAILBOX_FULL_SYNC_INTERVAL 5
enum mailbox_lock_notify_type {
/* Mailbox is locked, will abort in secs_left */
/* Mailbox lock looks stale, will override in secs_left */
};
struct index_storage {
struct mail_storage storage;
const char *dir; /* root directory */
const char *index_dir;
const char *inbox_path; /* INBOX location */
const char *temp_prefix; /* prefix for temporary files */
const char *user; /* name of user accessing the storage */
struct mail_storage_callbacks *callbacks;
void *callback_context;
};
struct index_mailbox {
struct index_storage *storage;
struct mail_index *index;
struct mail_index_view *view;
struct mail_cache *cache;
struct mail_vfuncs *mail_vfuncs;
struct index_notify_file *notify_files;
struct index_notify_io *notify_ios;
unsigned int min_notify_interval;
void *notify_context;
struct mail_cache_field *cache_fields;
unsigned int readonly:1;
unsigned int keep_recent:1;
unsigned int recent_flags_synced:1;
unsigned int sent_diskspace_warning:1;
unsigned int sent_readonly_flags_warning:1;
unsigned int notify_pending:1;
unsigned int mail_read_mmaped:1;
};
struct index_transaction_context {
struct index_mailbox *ibox;
struct mail_index_transaction *trans;
struct mail_index_view *trans_view;
struct mail_cache_view *cache_view;
struct mail_cache_transaction_ctx *cache_trans;
unsigned int cache_trans_failed:1;
};
unsigned int secs_left);
struct mail_index *
const char *prefix);
void index_storage_destroy_unrefed(void);
enum mail_storage_flags flags,
enum mailbox_open_flags flags);
struct mail_keywords *
index_keywords_create(struct mailbox_transaction_context *t,
const char *const keywords[]);
void index_keywords_free(struct mailbox_transaction_context *t,
struct mail_keywords *keywords);
const char *path);
struct mailbox_sync_context *
int failed);
struct mailbox_sync_rec *sync_rec_r);
struct mailbox_status *status_r);
struct mail_storage_callbacks *callbacks,
void *context);
int *syntax_error_r,
int *temporary_error_r);
enum mailbox_status_items items,
struct mailbox_status *status);
enum mailbox_status_items items,
struct mailbox_status *status_r);
struct mailbox_header_lookup_ctx *
enum mail_sort_type *sort_program);
struct mail_search_context *
const enum mail_sort_type *sort_program);
void index_transaction_init(struct index_transaction_context *t,
struct index_mailbox *ibox,
enum mailbox_transaction_flags flags);
int index_transaction_commit(struct mailbox_transaction_context *t);
void index_transaction_rollback(struct mailbox_transaction_context *t);
#endif