mail-transaction-log-private.h revision bdd7a96c363346f7c38f389791be1487ca08775b
#ifndef MAIL_TRANSACTION_LOG_VIEW_H
#define MAIL_TRANSACTION_LOG_VIEW_H
#include "buffer.h"
#include "mail-transaction-log.h"
struct dotlock_settings;
/* Synchronization can take a while sometimes, especially when copying lots of
mails. */
/* Rotate when log is older than ROTATE_TIME and larger than MIN_SIZE */
/* If log is larger than MAX_SIZE, rotate regardless of the time */
/* Delete .log.2 files older than this many seconds */
#define LOG_FILE_MODSEQ_CACHE_SIZE 10
struct modseq_cache {
};
struct mail_transaction_log_file {
struct mail_transaction_log *log;
struct mail_transaction_log_file *next;
/* refcount=0 is a valid state. files start that way, and they're
freed only when mail_transaction_logs_clean() is called. */
int refcount;
char *filepath;
int fd;
struct mail_transaction_log_header hdr;
void *mmap_base;
/* points to the next uncommitted transaction. usually same as EOF. */
/* highest modseq at sync_offset */
/* saved_tail_offset is the offset that was last written to transaction
log. max_tail_offset is what should be written to the log the next
time a transaction is written. transaction log handling may update
max_tail_offset automatically by making it skip external transactions
after the last saved offset (to avoid re-reading them unneededly). */
/* don't give warnings about saved_tail_offset shrinking if
sync_offset is less than this. */
/* if we've seen _INDEX_[UN9DELETED transaction in this file,
this is the offset. otherwise (uoff_t)-1 */
unsigned int locked:1;
unsigned int corrupted:1;
};
struct mail_transaction_log {
struct mail_index *index;
struct mail_transaction_log_view *views;
/* files is a linked list of all the opened log files. the list is
sorted by the log file sequence, so that transaction views can use
them easily. head contains a pointer to the newest log file. */
/* open_file is used temporarily while opening the log file.
if _open() failed, it's left there for _create(). */
struct mail_transaction_log_file *open_file;
unsigned int dotlock_count;
unsigned int nfs_flush:1;
};
void
const char *fmt, ...)
struct dotlock_settings *set_r);
struct mail_transaction_log_file *
struct mail_transaction_log_file *
const char *path);
bool check_existing);
bool reset);
struct mail_transaction_log_file **file_r);
/* Returns 1 if ok, 0 if file is corrupted or offset range is invalid,
-1 if I/O error */
*file);
struct mail_transaction_log_file *file,
struct mail_transaction_log_file *file,
#endif