]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: Remove "sync lost" callback handlers
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 20 Jan 2021 16:17:27 +0000 (18:17 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Mon, 3 May 2021 13:01:05 +0000 (13:01 +0000)
These were used to invalidate in-memory dovecot.index.cache cache with
mmap_disable=yes. This became unnecessary when cache file became
append-only.

src/lib-index/mail-index-map-read.c
src/lib-index/mail-index-private.h
src/lib-index/mail-index.c

index 52d9e2e80727654cab7805e85ad05d74065f48fe..12500f393d212c73fe79fb7b88956fc235aef159 100644 (file)
@@ -250,16 +250,11 @@ mail_index_try_read_map(struct mail_index_map *map,
 static int mail_index_read_map(struct mail_index_map *map, uoff_t file_size)
 {
        struct mail_index *index = map->index;
-       mail_index_sync_lost_handler_t *const *handlerp;
        struct stat st;
        unsigned int i;
        int ret;
        bool try_retry, retry;
 
-       /* notify all "sync lost" handlers */
-       array_foreach(&index->sync_lost_handlers, handlerp)
-               (**handlerp)(index);
-
        for (i = 0;; i++) {
                try_retry = i < MAIL_INDEX_ESTALE_RETRY_COUNT;
                if (file_size == UOFF_T_MAX) {
index e5f8c7ed68fe906797b32f242e5837aac4018324..2afad9d13f88eb9d5feeace5c4523d81506e7fbc 100644 (file)
@@ -45,7 +45,6 @@ struct mail_index_sync_map_ctx;
 typedef int mail_index_expunge_handler_t(struct mail_index_sync_map_ctx *ctx,
                                         uint32_t seq, const void *data,
                                         void **sync_context, void *context);
-typedef void mail_index_sync_lost_handler_t(struct mail_index *index);
 
 #define MAIL_INDEX_HEADER_SIZE_ALIGN(size) \
        (((size) + 7) & ~7U)
@@ -198,8 +197,6 @@ struct mail_index {
        pool_t extension_pool;
        ARRAY(struct mail_index_registered_ext) extensions;
 
-       ARRAY(mail_index_sync_lost_handler_t *) sync_lost_handlers;
-
        char *filepath;
        int fd;
 
@@ -269,10 +266,6 @@ void mail_index_register_expunge_handler(struct mail_index *index,
                                         void *context);
 void mail_index_unregister_expunge_handler(struct mail_index *index,
                                           uint32_t ext_id);
-void mail_index_register_sync_lost_handler(struct mail_index *index,
-                                          mail_index_sync_lost_handler_t *cb);
-void mail_index_unregister_sync_lost_handler(struct mail_index *index,
-                                       mail_index_sync_lost_handler_t *cb);
 
 int mail_index_create_tmp_file(struct mail_index *index,
                               const char *path_prefix, const char **path_r);
index 026e5790a1323675ad04f7a68c464ed19cef73f3..00e53b0cc6968c6417bb740d2f23caa8f45f1d7d 100644 (file)
@@ -70,7 +70,6 @@ struct mail_index *mail_index_alloc(struct event *parent_event,
        index->extension_pool =
                pool_alloconly_create(MEMPOOL_GROWING"index extension", 1024);
        p_array_init(&index->extensions, index->extension_pool, 5);
-       i_array_init(&index->sync_lost_handlers, 4);
        i_array_init(&index->module_contexts,
                     I_MIN(5, mail_index_module_register.id));
 
@@ -105,7 +104,6 @@ void mail_index_free(struct mail_index **_index)
        pool_unref(&index->extension_pool);
        pool_unref(&index->keywords_pool);
 
-       array_free(&index->sync_lost_handlers);
        array_free(&index->keywords);
        array_free(&index->module_contexts);
 
@@ -334,27 +332,6 @@ void mail_index_unregister_expunge_handler(struct mail_index *index,
        rext->expunge_handler = NULL;
 }
 
-void mail_index_register_sync_lost_handler(struct mail_index *index,
-                                          mail_index_sync_lost_handler_t *cb)
-{
-       array_push_back(&index->sync_lost_handlers, &cb);
-}
-
-void mail_index_unregister_sync_lost_handler(struct mail_index *index,
-                                            mail_index_sync_lost_handler_t *cb)
-{
-       mail_index_sync_lost_handler_t *const *handlers;
-       unsigned int i, count;
-
-       handlers = array_get(&index->sync_lost_handlers, &count);
-       for (i = 0; i < count; i++) {
-               if (handlers[i] == cb) {
-                       array_delete(&index->sync_lost_handlers, i, 1);
-                       break;
-               }
-       }
-}
-
 bool mail_index_keyword_lookup(struct mail_index *index,
                               const char *keyword, unsigned int *idx_r)
 {