index-storage.c revision 5cc772dc8b507be0bc1996b5717943ba13432e08
/* 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;
enum mail_storage_flags flags,
{
}
{
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 */
/* 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_CACHE_FIELD_COUNT; i++) {
*arr) == 0) {
break;
}
}
if (i == MAIL_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 mailbox_open_flags flags,
bool move_to_memory)
{
enum mail_index_lock_method lock_method = 0;
int ret;
if ((flags & MAILBOX_OPEN_FAST) != 0)
#ifndef MMAP_CONFLICTS_WRITE
#endif
switch (storage->lock_method) {
case MAIL_STORAGE_LOCK_FCNTL:
break;
case MAIL_STORAGE_LOCK_FLOCK:
break;
break;
}
ibox->commit_log_file_seq = 0;
MAIL_STORAGE_FLAG_MMAP_MAILS) != 0;
if (ret <= 0 || move_to_memory) {
if (mail_index_move_to_memory(index) < 0) {
/* try opening once more. it should be created
directly into memory now. */
if (ret <= 0) {
return -1;
}
}
}
return 0;
}
{
}
{
}
{
/* FIXME: return FALSE if we're full */
}
{
}
struct mail_storage_callbacks *callbacks,
void *context)
{
}
bool *syntax_error_r,
bool *temporary_error_r)
{
}
{
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)
{
}