mail-index-alloc-cache.c revision 04dff721d2a63566a4dbe1c856f8218b6550aa3e
/* Copyright (c) 2010 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "ioloop.h"
#include "module-context.h"
#include "eacces-error.h"
#include "mail-index-private.h"
#include "mail-index-alloc-cache.h"
#define MAIL_INDEX_ALLOC_CACHE_CONTEXT(obj) \
/* How many seconds to keep index opened for reuse after it's been closed */
#define INDEX_CACHE_TIMEOUT 10
/* How many closed indexes to keep */
#define INDEX_CACHE_MAX 3
struct mail_index_alloc_cache_list {
struct mail_index_alloc_cache_list *next;
struct mail_index *index;
char *mailbox_path;
int refcount;
};
static struct mail_index_alloc_cache_list *
{
struct mail_index_alloc_cache_list *list;
return list;
}
static void
{
}
struct mail_index *
mail_index_alloc_cache_get(const char *mailbox_path,
{
unsigned int destroy_count;
/* compare index_dir inodes so we don't break even with symlinks.
if index_dir doesn't exist yet or if using in-memory indexes, just
compare mailbox paths */
/* in-memory indexes */
/* it'll be created later */
} else {
}
}
/* already found the index. we're just going through
the rest of them to drop 0 refcounts */
/* index is already closed. don't even try to
reuse it. */
/* make sure the directory still exists.
it might have been renamed and we're trying
to access it via its new path now. */
rec->destroy_time = 0;
else
}
} else {
}
destroy_count >= INDEX_CACHE_MAX) {
continue;
} else {
}
}
}
} else {
}
}
static void destroy_unrefed(bool all)
{
} else {
}
}
}
{
}
{
break;
}
}
/* index was already closed. don't even try to cache it. */
}
}
void mail_index_alloc_cache_destroy_unrefed(void)
{
}
{
struct mail_index_alloc_cache_list *list =
/* newly created index directory. update its stat. */
}
}
}