Mercurial > dovecot > original-hg > dovecot-1.2
diff src/lib-index/mail-transaction-log.h @ 5689:c2362f144f15 HEAD
Initial commit for major index file code cleanup.
- dovecot.index file isn't anymore required to be updated when syncing.
- Getting the latest index file mapping is now done always by reading
dovecot.index and then reading the latest changes from dovecot.index.log.
- mmap()ing dovecot.index file is slower than reading it, so it's not
currently done unless the file is at 256kB. This may change though.
- Some things are still broken.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 11 Jun 2007 14:50:10 +0300 |
parents | 1273ce0585b3 |
children | dcf5dbb6a76a |
line wrap: on
line diff
--- a/src/lib-index/mail-transaction-log.h Mon Jun 11 06:28:07 2007 +0300 +++ b/src/lib-index/mail-transaction-log.h Mon Jun 11 14:50:10 2007 +0300 @@ -106,12 +106,31 @@ }; struct mail_transaction_log * -mail_transaction_log_open_or_create(struct mail_index *index); -struct mail_transaction_log * -mail_transaction_log_create(struct mail_index *index); -void mail_transaction_log_close(struct mail_transaction_log **log); +mail_transaction_log_alloc(struct mail_index *index); +void mail_transaction_log_free(struct mail_transaction_log **log); + +/* Open the transaction log. Returns 1 if ok, 0 if file doesn't exist or it's + is corrupted, -1 if there was some I/O error. */ +int mail_transaction_log_open(struct mail_transaction_log *log); +/* Create, or recreate, the transaction log. Returns 0 if ok, -1 if error. */ +int mail_transaction_log_create(struct mail_transaction_log *log); +/* Close all the open transactions log files. */ +void mail_transaction_log_close(struct mail_transaction_log *log); -int mail_transaction_log_move_to_memory(struct mail_transaction_log *log); +/* Returns the file seq/offset where the mailbox is currently synced at. + Since the log is rotated only when mailbox is fully synced, the sequence + points always to the latest file. This function doesn't actually find the + latest sync position, so you'll need to use eg. log_view_set() before + calling this. */ +void mail_transaction_log_get_mailbox_sync_pos(struct mail_transaction_log *log, + uint32_t *file_seq_r, + uoff_t *file_offset_r); +/* Set the current mailbox sync position. file_seq must always be the latest + log file's sequence. The offset written automatically to the log when + other transactions are being written. */ +void mail_transaction_log_set_mailbox_sync_pos(struct mail_transaction_log *log, + uint32_t file_seq, + uoff_t file_offset); struct mail_transaction_log_view * mail_transaction_log_view_open(struct mail_transaction_log *log); @@ -172,4 +191,8 @@ bool mail_transaction_log_is_head_prev(struct mail_transaction_log *log, uint32_t file_seq, uoff_t file_offset); +/* Move currently opened log files to memory (called by + mail_index_move_to_memory()) */ +int mail_transaction_log_move_to_memory(struct mail_transaction_log *log); + #endif