mail-cache-sync-update.c revision 2219015cc814b18a72d8d37696a5bffc52edd767
a8c5a86d183db25a57bf193c06b41e092ec2e151Timo Sirainen/* Copyright (c) 2004-2014 Dovecot authors, see the included COPYING file */
1b75126c39121b25f0bba048758b56d4b4b9bf1aTimo Sirainenstatic struct mail_cache_sync_context *mail_cache_handler_init(void **context)
1b75126c39121b25f0bba048758b56d4b4b9bf1aTimo Sirainen *context = i_new(struct mail_cache_sync_context, 1);
2219015cc814b18a72d8d37696a5bffc52edd767Timo Sirainenstatic void mail_cache_handler_deinit(struct mail_index_sync_map_ctx *sync_ctx,
2219015cc814b18a72d8d37696a5bffc52edd767Timo Sirainen struct mail_cache *cache = sync_ctx->view->index->cache;
2219015cc814b18a72d8d37696a5bffc52edd767Timo Sirainen /* update the record counts in the cache file's header. these
2219015cc814b18a72d8d37696a5bffc52edd767Timo Sirainen are used to figure out when a cache file should be
2219015cc814b18a72d8d37696a5bffc52edd767Timo Sirainen recreated and the old data dropped. */
2219015cc814b18a72d8d37696a5bffc52edd767Timo Sirainen cache->hdr_copy.deleted_record_count += ctx->expunge_count;
2219015cc814b18a72d8d37696a5bffc52edd767Timo Sirainen if (cache->hdr_copy.record_count >= ctx->expunge_count)
2219015cc814b18a72d8d37696a5bffc52edd767Timo Sirainen cache->hdr_copy.record_count -= ctx->expunge_count;
6a19e109ee8c5a6f688da83a86a7f6abeb71abddTimo Sirainenint mail_cache_expunge_handler(struct mail_index_sync_map_ctx *sync_ctx,
2219015cc814b18a72d8d37696a5bffc52edd767Timo Sirainen void **sync_context, void *context ATTR_UNUSED)