dovecot-2.1: lib-index: Added mail_cache_view_update_cache_decis...
dovecot at dovecot.org
dovecot at dovecot.org
Fri Sep 16 16:59:32 EEST 2011
details: http://hg.dovecot.org/dovecot-2.1/rev/efedf0644da8
changeset: 13471:efedf0644da8
user: Timo Sirainen <tss at iki.fi>
date: Tue Aug 30 04:31:00 2011 +0300
description:
lib-index: Added mail_cache_view_update_cache_decisions()
diffstat:
src/lib-index/mail-cache-decisions.c | 5 ++++-
src/lib-index/mail-cache-private.h | 2 ++
src/lib-index/mail-cache.c | 6 ++++++
src/lib-index/mail-cache.h | 5 +++++
4 files changed, 17 insertions(+), 1 deletions(-)
diffs (65 lines):
diff -r e01c9f89b0b0 -r efedf0644da8 src/lib-index/mail-cache-decisions.c
--- a/src/lib-index/mail-cache-decisions.c Mon Aug 29 07:08:04 2011 +0300
+++ b/src/lib-index/mail-cache-decisions.c Tue Aug 30 04:31:00 2011 +0300
@@ -79,6 +79,9 @@
i_assert(field < cache->fields_count);
+ if (view->no_decision_updates)
+ return;
+
mail_index_lookup_uid(view->view, seq, &uid);
hdr = mail_index_get_header(view->view);
@@ -124,7 +127,7 @@
i_assert(field < cache->fields_count);
- if (MAIL_CACHE_IS_UNUSABLE(cache))
+ if (MAIL_CACHE_IS_UNUSABLE(cache) || view->no_decision_updates)
return;
if (cache->fields[field].field.decision != MAIL_CACHE_DECISION_NO) {
diff -r e01c9f89b0b0 -r efedf0644da8 src/lib-index/mail-cache-private.h
--- a/src/lib-index/mail-cache-private.h Mon Aug 29 07:08:04 2011 +0300
+++ b/src/lib-index/mail-cache-private.h Tue Aug 30 04:31:00 2011 +0300
@@ -198,6 +198,8 @@
buffer_t *cached_exists_buf;
uint8_t cached_exists_value;
uint32_t cached_exists_seq;
+
+ unsigned int no_decision_updates:1;
};
struct mail_cache_iterate_field {
diff -r e01c9f89b0b0 -r efedf0644da8 src/lib-index/mail-cache.c
--- a/src/lib-index/mail-cache.c Mon Aug 29 07:08:04 2011 +0300
+++ b/src/lib-index/mail-cache.c Tue Aug 30 04:31:00 2011 +0300
@@ -714,6 +714,12 @@
i_free(view);
}
+void mail_cache_view_update_cache_decisions(struct mail_cache_view *view,
+ bool update)
+{
+ view->no_decision_updates = !update;
+}
+
uint32_t mail_cache_get_first_new_seq(struct mail_index_view *view)
{
const struct mail_index_header *idx_hdr;
diff -r e01c9f89b0b0 -r efedf0644da8 src/lib-index/mail-cache.h
--- a/src/lib-index/mail-cache.h Mon Aug 29 07:08:04 2011 +0300
+++ b/src/lib-index/mail-cache.h Tue Aug 30 04:31:00 2011 +0300
@@ -71,6 +71,11 @@
mail_cache_view_open(struct mail_cache *cache, struct mail_index_view *iview);
void mail_cache_view_close(struct mail_cache_view *view);
+/* Normally cache decisions are updated on lookup/add. Use this function to
+ enable/disable this (useful for precaching data). */
+void mail_cache_view_update_cache_decisions(struct mail_cache_view *view,
+ bool update);
+
/* Get index transaction specific cache transaction. */
struct mail_cache_transaction_ctx *
mail_cache_get_transaction(struct mail_cache_view *view,
More information about the dovecot-cvs
mailing list