dovecot-2.0: lib-storage: Added mail_is_cached()
dovecot at dovecot.org
dovecot at dovecot.org
Thu May 5 19:14:20 EEST 2011
details: http://hg.dovecot.org/dovecot-2.0/rev/55ff92050bd7
changeset: 12772:55ff92050bd7
user: Timo Sirainen <tss at iki.fi>
date: Thu May 05 17:48:55 2011 +0200
description:
lib-storage: Added mail_is_cached()
diffstat:
src/lib-storage/index/index-transaction.c | 3 +++
src/lib-storage/mail-storage-private.h | 3 +++
src/lib-storage/mail-storage.h | 3 +++
src/lib-storage/mail.c | 7 +++++++
4 files changed, 16 insertions(+), 0 deletions(-)
diffs (63 lines):
diff -r 45f6d523b1a1 -r 55ff92050bd7 src/lib-storage/index/index-transaction.c
--- a/src/lib-storage/index/index-transaction.c Thu May 05 17:47:58 2011 +0200
+++ b/src/lib-storage/index/index-transaction.c Thu May 05 17:48:55 2011 +0200
@@ -88,6 +88,9 @@
it->cache_view = mail_cache_view_open(box->cache, t->view);
it->cache_trans = mail_cache_get_transaction(it->cache_view, t->itrans);
+ t->cache_view = it->cache_view;
+ t->cache_trans = it->cache_trans;
+
/* set up after mail_cache_get_transaction(), so that we'll still
have the cache_trans available in _index_commit() */
it->super = t->itrans->v;
diff -r 45f6d523b1a1 -r 55ff92050bd7 src/lib-storage/mail-storage-private.h
--- a/src/lib-storage/mail-storage-private.h Thu May 05 17:47:58 2011 +0200
+++ b/src/lib-storage/mail-storage-private.h Thu May 05 17:48:55 2011 +0200
@@ -390,6 +390,9 @@
/* view contains all changes done within this transaction */
struct mail_index_view *view;
+ struct mail_cache_view *cache_view;
+ struct mail_cache_transaction_ctx *cache_trans;
+
struct mail_transaction_commit_changes *changes;
ARRAY_DEFINE(module_contexts,
union mailbox_transaction_module_context *);
diff -r 45f6d523b1a1 -r 55ff92050bd7 src/lib-storage/mail-storage.h
--- a/src/lib-storage/mail-storage.h Thu May 05 17:47:58 2011 +0200
+++ b/src/lib-storage/mail-storage.h Thu May 05 17:48:55 2011 +0200
@@ -701,6 +701,9 @@
void mail_update_pop3_uidl(struct mail *mail, const char *uidl);
/* Expunge this message. Sequence numbers don't change until commit. */
void mail_expunge(struct mail *mail);
+
+/* Returns TRUE if anything is cached for the mail, FALSE if not. */
+bool mail_is_cached(struct mail *mail);
/* Mark a cached field corrupted and have it recalculated. */
void mail_set_cache_corrupted(struct mail *mail, enum mail_fetch_field field);
diff -r 45f6d523b1a1 -r 55ff92050bd7 src/lib-storage/mail.c
--- a/src/lib-storage/mail.c Thu May 05 17:47:58 2011 +0200
+++ b/src/lib-storage/mail.c Thu May 05 17:48:55 2011 +0200
@@ -7,6 +7,7 @@
#include "crc32.h"
#include "sha1.h"
#include "hostpid.h"
+#include "mail-cache.h"
#include "mail-storage-private.h"
#include <time.h>
@@ -239,6 +240,12 @@
mail->expunged = TRUE;
}
+bool mail_is_cached(struct mail *mail)
+{
+ return mail_cache_field_exists_any(mail->transaction->cache_view,
+ mail->seq);
+}
+
void mail_set_cache_corrupted(struct mail *mail, enum mail_fetch_field field)
{
struct mail_private *p = (struct mail_private *)mail;
More information about the dovecot-cvs
mailing list