index-storage.c revision 992a13add4eea0810e4db0f042a595dddf85536a
/* Copyright (C) 2002-2003 Timo Sirainen */
#include "lib.h"
#include "buffer.h"
#include "ioloop.h"
#include "mail-index.h"
#include "index-storage.h"
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
/* 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
#define LOCK_NOTIFY_INTERVAL 30
struct index_list {
struct index_list *next;
struct mail_index *index;
char *mailbox_path;
int refcount;
};
static int index_storage_refcount = 0;
{
}
{
if (--index_storage_refcount > 0)
return;
}
{
struct index_list *list;
}
{
}
struct mail_index *
const char *prefix)
{
struct mail_index *index;
int destroy_count;
/* compare index_dir inodes so we don't break even with symlinks.
for in-memory indexes compare just mailbox paths */
}
destroy_count >= INDEX_CACHE_MAX) {
continue;
} else {
}
}
}
}
return index;
}
static void destroy_unrefed(int all)
{
} else {
}
}
}
}
{
}
{
struct index_list *list;
break;
}
}
void index_storage_destroy_unrefed(void)
{
}
static void set_cache_fields(const char *fields,
enum mail_cache_decision_type dec)
{
static enum mail_cache_field field_enums[] = {
};
static const char *field_names[] = {
"sent_date",
"received_date",
"virtual_size",
"body",
"bodystructure",
"messagepart",
};
const char *const *arr;
int i;
return;
for (i = 0; field_names[i] != NULL; i++) {
break;
}
}
if (field_names[i] == NULL) {
i_error("Invalid cache field name '%s', ignoring ",
*arr);
}
}
}
static const enum mail_cache_decision_type *get_default_cache_decisions(void)
{
if (dec_set)
return dec;
return dec;
}
unsigned int secs_left)
{
const char *str;
if ((secs_left % 15) != 0) {
/* update alarm() so that we get back here around the same
time we want the next notify. also try to use somewhat
rounded times. this affects only fcntl() locking, dotlock
and flock() calls should be calling us constantly */
}
/* if notify type changes, print the message immediately */
/* first override notification, show it */
} else {
return;
}
}
switch (notify_type) {
case MAILBOX_LOCK_NOTIFY_NONE:
break;
"%u seconds", secs_left);
break;
"will override in %u seconds", secs_left);
break;
}
}
{
}
struct index_mailbox *
enum mailbox_open_flags flags)
{
struct index_mailbox *ibox;
if ((flags & MAILBOX_OPEN_FAST) != 0)
do {
ibox->commit_log_file_seq = 0;
break;
return ibox;
} while (0);
return NULL;
}
{
}
{
}
{
/* FIXME: return FALSE if we're full */
}
{
}
struct mail_storage_callbacks *callbacks,
void *context)
{
}
int *syntax_error_r)
{
}
{
case MAIL_INDEX_ERROR_NONE:
break;
break;
}
return FALSE;
}
enum mail_flags *flags,
const char *keywords[],
unsigned int keywords_count)
{
/*FIXME:int ret;
ret = mail_keywords_fix_list(ibox->index, flags, keywords,
keywords_count);
switch (ret) {
case 1:
return TRUE;
case 0:
mail_storage_set_error(ibox->box.storage,
"Maximum number of different keywords exceeded");
return FALSE;
default:
return mail_storage_set_index_error(ibox);
}*/
}