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) {
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)
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;
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->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));
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);
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)
{