mail-transaction-log-private.h revision 95a1a5195d56f3cf5d1e529aad668f87ad3b979b
d80f37f025593d959bdfa9c378915e4322f4f504Timo Sirainen/* Synchronization can take a while sometimes, especially when copying lots of
d80f37f025593d959bdfa9c378915e4322f4f504Timo Sirainen#define MAIL_TRANSCATION_LOG_LOCK_TIMEOUT (3*60)
d80f37f025593d959bdfa9c378915e4322f4f504Timo Sirainen#define MAIL_TRANSCATION_LOG_LOCK_CHANGE_TIMEOUT (3*60)
d80f37f025593d959bdfa9c378915e4322f4f504Timo Sirainen/* Rotate when log is older than ROTATE_TIME and larger than MIN_SIZE */
d80f37f025593d959bdfa9c378915e4322f4f504Timo Sirainen#define MAIL_TRANSACTION_LOG_ROTATE_MIN_SIZE (1024*32)
d80f37f025593d959bdfa9c378915e4322f4f504Timo Sirainen/* If log is larger than MAX_SIZE, rotate regardless of the time */
d80f37f025593d959bdfa9c378915e4322f4f504Timo Sirainen#define MAIL_TRANSACTION_LOG_ROTATE_MAX_SIZE (1024*1024)
d80f37f025593d959bdfa9c378915e4322f4f504Timo Sirainen#define MAIL_TRANSACTION_LOG_ROTATE_TIME (60*5)
d80f37f025593d959bdfa9c378915e4322f4f504Timo Sirainen/* Delete .log.2 files older than this many seconds */
d80f37f025593d959bdfa9c378915e4322f4f504Timo Sirainen#define MAIL_TRANSACTION_LOG2_STALE_SECS (60*30)
d80f37f025593d959bdfa9c378915e4322f4f504Timo Sirainen#define MAIL_TRANSACTION_LOG_FILE_IN_MEMORY(file) ((file)->fd == -1)
d80f37f025593d959bdfa9c378915e4322f4f504Timo Sirainen /* refcount=0 is a valid state. files start that way, and they're
d80f37f025593d959bdfa9c378915e4322f4f504Timo Sirainen freed only when mail_transaction_logs_clean() is called. */
4654f788834c9d7920a351306b89cf5d1c21772eTimo Sirainen /* points to the next uncommitted transaction. usually same as EOF. */
4654f788834c9d7920a351306b89cf5d1c21772eTimo Sirainen /* highest modseq at sync_offset */
4654f788834c9d7920a351306b89cf5d1c21772eTimo Sirainen /* saved_tail_offset is the offset that was last written to transaction
4654f788834c9d7920a351306b89cf5d1c21772eTimo Sirainen log. max_tail_offset is what should be written to the log the next
4654f788834c9d7920a351306b89cf5d1c21772eTimo Sirainen time a transaction is written. transaction log handling may update
4654f788834c9d7920a351306b89cf5d1c21772eTimo Sirainen max_tail_offset automatically by making it skip external transactions
4654f788834c9d7920a351306b89cf5d1c21772eTimo Sirainen after the last saved offset (to avoid re-reading them unneededly). */
3398d5e2b883812de5d569721c8294b581e1d9e6Timo Sirainen struct modseq_cache modseq_cache[LOG_FILE_MODSEQ_CACHE_SIZE];
96f2533c48ce5def0004931606a2fdf275578880Timo Sirainen /* files is a linked list of all the opened log files. the list is
96f2533c48ce5def0004931606a2fdf275578880Timo Sirainen sorted by the log file sequence, so that transaction views can use
96f2533c48ce5def0004931606a2fdf275578880Timo Sirainen them easily. head contains a pointer to the newest log file. */
96f2533c48ce5def0004931606a2fdf275578880Timo Sirainen struct mail_transaction_log_file *files, *head;
96f2533c48ce5def0004931606a2fdf275578880Timo Sirainen /* open_file is used temporarily while opening the log file.
96f2533c48ce5def0004931606a2fdf275578880Timo Sirainen if _open() failed, it's left there for _create(). */
96f2533c48ce5def0004931606a2fdf275578880Timo Sirainen struct dotlock_settings dotlock_settings, new_dotlock_settings;
96f2533c48ce5def0004931606a2fdf275578880Timo Sirainenmail_transaction_log_file_set_corrupted(struct mail_transaction_log_file *file,
96f2533c48ce5def0004931606a2fdf275578880Timo Sirainen const char *fmt, ...)
struct mail_transaction_log_file *
struct mail_transaction_log_file *
const char *path);
bool check_existing);
bool reset);
*file);