mail-transaction-log-private.h revision cc833a7a4e2258afdc834ace4bfe6579820a1df3
#ifndef __MAIL_TRANSACTION_LOG_VIEW_H
#define __MAIL_TRANSACTION_LOG_VIEW_H
#include "file-dotlock.h"
#include "mail-transaction-log.h"
/* 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 */
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. */
/* 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). */
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;
};
void
const char *fmt, ...)
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);
#endif