dovecot-2.2: plugins/fts: expunge-log - query function to lookup...

dovecot at dovecot.org dovecot at dovecot.org
Tue Jan 20 23:55:14 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/91b00535e1f9
changeset: 18195:91b00535e1f9
user:      Phil Carmody <phil at dovecot.fi>
date:      Wed Jan 21 01:52:59 2015 +0200
description:
plugins/fts: expunge-log - query function to lookup GUID/UID
Constant time hash lookup for GUID. Log time lookup in seq_range array.

Signed-off-by: Phil Carmody <phil at dovecot.fi>

diffstat:

 src/plugins/fts/fts-expunge-log.c |  11 +++++++++++
 src/plugins/fts/fts-expunge-log.h |   3 +++
 2 files changed, 14 insertions(+), 0 deletions(-)

diffs (29 lines):

diff -r e1b50803e5d4 -r 91b00535e1f9 src/plugins/fts/fts-expunge-log.c
--- a/src/plugins/fts/fts-expunge-log.c	Wed Jan 21 01:51:46 2015 +0200
+++ b/src/plugins/fts/fts-expunge-log.c	Wed Jan 21 01:52:59 2015 +0200
@@ -532,3 +532,14 @@
 
 	return ret;
 }
+bool fts_expunge_log_contains(const struct fts_expunge_log_append_ctx *ctx,
+			      const guid_128_t mailbox_guid, uint32_t uid)
+{
+	const struct fts_expunge_log_mailbox *mailbox;
+	const uint8_t *guid_p = mailbox_guid;
+
+	mailbox = hash_table_lookup(ctx->mailboxes, guid_p);
+	if (mailbox == NULL)
+		return FALSE;
+	return seq_range_exists(&mailbox->uids, uid);	
+}
diff -r e1b50803e5d4 -r 91b00535e1f9 src/plugins/fts/fts-expunge-log.h
--- a/src/plugins/fts/fts-expunge-log.h	Wed Jan 21 01:51:46 2015 +0200
+++ b/src/plugins/fts/fts-expunge-log.h	Wed Jan 21 01:52:59 2015 +0200
@@ -41,4 +41,7 @@
    The struct it returns cannot be written, as it has no backing store */
 int fts_expunge_log_flatten(const char *path,
 			    struct fts_expunge_log_append_ctx **flattened_r);
+bool fts_expunge_log_contains(const struct fts_expunge_log_append_ctx *ctx,
+			      const guid_128_t mailbox_guid, uint32_t uid);
+
 #endif


More information about the dovecot-cvs mailing list