index-storage.c revision 8887bf3757d51d73887dd20b1db3334d867d3817
/* Copyright (C) 2002-2003 Timo Sirainen */
#include "lib.h"
#include "array.h"
#include "buffer.h"
#include "ioloop.h"
#include "mail-index-private.h"
#include "index-storage.h"
#include "index-mail.h"
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#define DEFAULT_CACHE_FIELDS "flags"
#define DEFAULT_NEVER_CACHE_FIELDS "imap.envelope"
/* 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;
struct mailbox_list *list,
enum mail_storage_flags flags,
enum file_lock_method lock_method)
{
}
{
if (--index_storage_refcount > 0)
return;
}
{
struct index_list *list;
}
{
}
struct mail_index *
const char *prefix)
{
struct mail_index *index;
int destroy_count;
if (*index_dir == '\0')
}
/* compare index_dir inodes so we don't break even with symlinks.
for in-memory indexes compare just mailbox paths */
/* 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 {
}
}
}
}
return index;
}
static void destroy_unrefed(bool all)
{
} else {
}
}
}
{
}
{
struct index_list *list;
break;
}
}
void index_storage_destroy_unrefed(void)
{
}
enum mail_cache_decision_type dec)
{
const char *const *arr;
int i;
return;
for (i = 0; i < MAIL_INDEX_CACHE_FIELD_COUNT; i++) {
*arr) == 0) {
break;
}
}
if (i == MAIL_INDEX_CACHE_FIELD_COUNT) {
i_error("%s: Invalid cache field name '%s', ignoring ",
}
}
}
{
static bool initialized = FALSE;
if (!initialized) {
initialized = TRUE;
}
sizeof(global_cache_fields));
}
unsigned int secs_left)
{
const char *str;
/* if notify type changes, print the message immediately */
/* first override notification, show it */
} else {
return;
}
}
switch (notify_type) {
case MAILBOX_LOCK_NOTIFY_NONE:
break;
break;
"%u seconds", secs_left);
break;
break;
"will override in %u seconds", secs_left);
break;
}
}
{
}
{
enum mail_index_open_flags index_flags = 0;
int ret;
}
if (!ibox->move_to_memory)
#ifndef MMAP_CONFLICTS_WRITE
#endif
/* try opening once more. it should be created
directly into memory now. */
if (ret <= 0)
i_panic("in-memory index creation failed");
}
}
}
enum mailbox_open_flags flags,
bool move_to_memory)
{
ibox->commit_log_file_seq = 0;
if ((flags & MAILBOX_OPEN_FAST) == 0)
}
{
}
{
}
{
/* FIXME: return FALSE if we're full */
}
{
}
struct mail_storage_callbacks *callbacks,
void *context)
{
}
bool *syntax_error_r,
bool *temporary_error_r)
{
/* We get here only in error situations, so we have to return some
error. If storage->error is NULL, it means we forgot to set it at
some point.. */
}
{
case MAIL_INDEX_ERROR_NONE:
break;
break;
}
}
struct mail_keywords *
const char *const keywords[])
{
struct index_transaction_context *t =
(struct index_transaction_context *)_t;
}
struct mail_keywords *keywords)
{
}