[dovecot-cvs] dovecot/src/lib-storage/index index-storage.c,1.28,1.29
cras at procontrol.fi
cras at procontrol.fi
Sun Feb 23 23:06:59 EET 2003
Update of /home/cvs/dovecot/src/lib-storage/index
In directory danu:/tmp/cvs-serv1249/src/lib-storage/index
Modified Files:
index-storage.c
Log Message:
Index opening rewrites. We don't try to support .imap.index-<hostname> style
indexes anymore. They just made things more difficult, and it's really not a
good idea to use index files via NFS anyway.
Added support for :INDEX=MEMORY in MAIL env to disable using index files.
Also if we can't open or create index file for any reason, we now fallback
to in-memory indexes. Before we fallbacked only with out of disk space
errors.
If .customflags can't be created, we still work now by not allowing to
create new custom flags.
Index: index-storage.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-storage.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- index-storage.c 14 Feb 2003 10:46:44 -0000 1.28
+++ index-storage.c 23 Feb 2003 21:06:57 -0000 1.29
@@ -226,6 +226,7 @@
int readonly, int fast)
{
struct index_mailbox *ibox;
+ enum mail_index_open_flags flags;
i_assert(name != NULL);
@@ -236,7 +237,6 @@
ibox->box.storage = storage;
ibox->box.name = i_strdup(name);
ibox->box.readonly = readonly;
- ibox->box.allow_custom_flags = TRUE;
ibox->index = index;
@@ -249,13 +249,29 @@
get_default_cache_fields();
index->never_cache_fields =
get_never_cache_fields();
- if (!index->open_or_create(index, !readonly, fast))
+
+ flags = MAIL_INDEX_OPEN_FLAG_CREATE;
+ if (fast)
+ flags |= MAIL_INDEX_OPEN_FLAG_FAST;
+ if (!readonly)
+ flags |= MAIL_INDEX_OPEN_FLAG_UPDATE_RECENT;
+
+ if (!index->open(index, flags))
break;
+
+ if (INDEX_IS_IN_MEMORY(index) &&
+ storage->index_dir != NULL) {
+ storage->callbacks->notify_no(&ibox->box,
+ "Couldn't use index files",
+ storage->callback_context);
+ }
}
if (!ibox->index->set_lock(ibox->index, MAIL_LOCK_SHARED))
break;
+ ibox->box.allow_custom_flags =
+ ibox->index->allow_new_custom_flags;
ibox->synced_messages_count =
mail_index_get_header(index)->messages_count;
More information about the dovecot-cvs
mailing list