]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
plugins: fts - Add event to struct fts_expunge_log
authorMarco Bettini <marco.bettini@open-xchange.com>
Thu, 28 Jul 2022 15:38:53 +0000 (15:38 +0000)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Mon, 8 Aug 2022 07:00:49 +0000 (07:00 +0000)
src/plugins/fts/fts-expunge-log.c
src/plugins/fts/fts-expunge-log.h

index 90e99d331b329100b1ee05d60df628e772f1b991..96ea0ea2cc605e1bea118e12a08bc842c7bc1b5b 100644 (file)
@@ -9,6 +9,7 @@
 #include "seq-range-array.h"
 #include "mail-storage.h"
 #include "fts-expunge-log.h"
+#include "fts-api-private.h"
 
 #include <sys/stat.h>
 #include <unistd.h>
@@ -34,6 +35,7 @@ struct fts_expunge_log {
 
        int fd;
        struct stat st;
+       struct event *event;
 };
 
 struct fts_expunge_log_mailbox {
@@ -64,11 +66,14 @@ struct fts_expunge_log_read_ctx {
        bool unlink;
 };
 
-struct fts_expunge_log *fts_expunge_log_init(const char *path)
+struct fts_expunge_log *
+fts_expunge_log_init(const char *path, struct event *event)
 {
        struct fts_expunge_log *log;
 
        log = i_new(struct fts_expunge_log, 1);
+       log->event = event_create(event);
+       event_add_category(log->event, &event_category_fts);
        log->path = i_strdup(path);
        log->fd = -1;
        return log;
@@ -81,6 +86,7 @@ void fts_expunge_log_deinit(struct fts_expunge_log **_log)
        *_log = NULL;
        i_close_fd(&log->fd);
        i_free(log->path);
+       event_unref(&log->event);
        i_free(log);
 }
 
@@ -525,7 +531,7 @@ int fts_expunge_log_read_end(struct fts_expunge_log_read_ctx **_ctx)
        return ret;
 }
 
-int fts_expunge_log_flatten(const char *path,
+int fts_expunge_log_flatten(const char *path, struct event *event,
                            struct fts_expunge_log_append_ctx **flattened_r)
 {
        struct fts_expunge_log *read;
@@ -535,7 +541,7 @@ int fts_expunge_log_flatten(const char *path,
        int ret;
 
        i_assert(path != NULL && flattened_r != NULL);
-       read = fts_expunge_log_init(path);
+       read = fts_expunge_log_init(path, event);
 
        read_ctx = fts_expunge_log_read_begin(read);
        read_ctx->unlink = FALSE;
@@ -598,7 +604,7 @@ int fts_expunge_log_flat_write(const struct fts_expunge_log_append_ctx *read_log
                               const char *path)
 {
        int ret;
-       struct fts_expunge_log *nlog = fts_expunge_log_init(path);
+       struct fts_expunge_log *nlog = fts_expunge_log_init(path, read_log->log->event);
        struct fts_expunge_log_append_ctx *nappend = fts_expunge_log_append_begin(nlog);
 
        struct hash_iterate_context *iter;
index cc15f29a1a69208933a3a382fcbce45918717b54..a51fcee18373f71550cb568a3688bbef5552a052 100644 (file)
@@ -9,7 +9,8 @@ struct fts_expunge_log_read_record {
        ARRAY_TYPE(seq_range) uids;
 };
 
-struct fts_expunge_log *fts_expunge_log_init(const char *path);
+struct fts_expunge_log *fts_expunge_log_init(const char *path,
+                                            struct event *event);
 void fts_expunge_log_deinit(struct fts_expunge_log **log);
 
 struct fts_expunge_log_append_ctx *
@@ -44,7 +45,7 @@ int fts_expunge_log_read_end(struct fts_expunge_log_read_ctx **ctx);
 
 /* Read an entire log file, and flatten it into one hash of arrays.
    The struct it returns cannot be written, as it has no backing store */
-int fts_expunge_log_flatten(const char *path,
+int fts_expunge_log_flatten(const char *path, struct event *event,
                            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);