#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>
int fd;
struct stat st;
+ struct event *event;
};
struct fts_expunge_log_mailbox {
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;
*_log = NULL;
i_close_fd(&log->fd);
i_free(log->path);
+ event_unref(&log->event);
i_free(log);
}
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;
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;
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;
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 *
/* 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);