dovecot-2.2: lib-index: Added mail_transaction_log_view_set_all()
dovecot at dovecot.org
dovecot at dovecot.org
Tue May 22 17:05:02 EEST 2012
details: http://hg.dovecot.org/dovecot-2.2/rev/fead3400c379
changeset: 14579:fead3400c379
user: Timo Sirainen <tss at iki.fi>
date: Tue May 22 16:54:55 2012 +0300
description:
lib-index: Added mail_transaction_log_view_set_all()
diffstat:
src/lib-index/mail-transaction-log-view.c | 42 +++++++++++++++++++++++++++++++
src/lib-index/mail-transaction-log.h | 3 ++
2 files changed, 45 insertions(+), 0 deletions(-)
diffs (65 lines):
diff -r ad6aa4e042f5 -r fead3400c379 src/lib-index/mail-transaction-log-view.c
--- a/src/lib-index/mail-transaction-log-view.c Tue May 22 16:54:43 2012 +0300
+++ b/src/lib-index/mail-transaction-log-view.c Tue May 22 16:54:55 2012 +0300
@@ -280,6 +280,48 @@
return 1;
}
+int mail_transaction_log_view_set_all(struct mail_transaction_log_view *view)
+{
+ struct mail_transaction_log_file *file, *first = view->log->files;
+
+ /* make sure .log.2 file is opened */
+ (void)mail_transaction_log_find_file(view->log, 1, FALSE, &file);
+
+ for (file = view->log->files; file != NULL; file = file->next) {
+ if (mail_transaction_log_file_map(file, file->hdr.hdr_size,
+ (uoff_t)-1) < 0)
+ return -1;
+ if (file->hdr.prev_file_seq == 0) {
+ /* this file resets the index. skip the old ones. */
+ first = file;
+ }
+ }
+
+ mail_transaction_log_view_unref_all(view);
+ for (file = first; file != NULL; file = file->next) {
+ array_append(&view->file_refs, &file, 1);
+ file->refcount++;
+ }
+
+ view->tail = first;
+ view->cur = view->tail;
+ view->cur_offset = view->tail->hdr.hdr_size;
+
+ view->prev_file_seq = view->cur->hdr.file_seq;
+ view->prev_file_offset = view->cur_offset;
+
+ view->min_file_seq = view->cur->hdr.file_seq;
+ view->min_file_offset = view->cur_offset;
+ view->max_file_seq = view->head->hdr.file_seq;
+ view->max_file_offset = view->head->sync_offset;
+ view->broken = FALSE;
+
+ if (mail_transaction_log_file_get_highest_modseq_at(view->cur,
+ view->cur_offset, &view->prev_modseq) < 0)
+ return -1;
+ return 0;
+}
+
void mail_transaction_log_view_clear(struct mail_transaction_log_view *view,
uint32_t oldest_file_seq)
{
diff -r ad6aa4e042f5 -r fead3400c379 src/lib-index/mail-transaction-log.h
--- a/src/lib-index/mail-transaction-log.h Tue May 22 16:54:43 2012 +0300
+++ b/src/lib-index/mail-transaction-log.h Tue May 22 16:54:55 2012 +0300
@@ -217,6 +217,9 @@
uint32_t min_file_seq, uoff_t min_file_offset,
uint32_t max_file_seq, uoff_t max_file_offset,
bool *reset_r);
+/* Scan through all of the log files that we can find.
+ Returns -1 if error, 0 if ok. */
+int mail_transaction_log_view_set_all(struct mail_transaction_log_view *view);
/* Clear the view. Keep oldest_file_seq and newer log files referenced so we
don't get desynced. */
void mail_transaction_log_view_clear(struct mail_transaction_log_view *view,
More information about the dovecot-cvs
mailing list