mail-transaction-log-private.h revision 2a6af811ea3de3cf9e2f15e446674dd21b0705f3
#ifndef __MAIL_TRANSACTION_LOG_VIEW_H
#define __MAIL_TRANSACTION_LOG_VIEW_H
#include "file-dotlock.h"
#include "mail-transaction-log.h"
#if 0 // FIXME
/* 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 */
#define MAIL_TRANSACTION_LOG_ROTATE_TIME (30)
#else
/* 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 */
#endif
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_offset is the offset that was last written to transaction log.
max_offset is what should be written to the log the next time a
transaction is written. transaction log handling may update
max_offset automatically by making it skip external transactions
after the last saved offset (to avoid re-reading them unneededly). */
unsigned int locked: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);
struct mail_transaction_log_file **file_r);
#endif