mailbox-list-index.c revision 3d6fdafca17c073606b63745ca8638e035e871f4
/* Copyright (c) 2006-2012 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "ioloop.h"
#include "hash.h"
#include "str.h"
#include "mail-index-view-private.h"
#include "mail-storage-hooks.h"
#include "mail-storage-private.h"
#include "mailbox-list-index.h"
#define MAILBOX_LIST_INDEX_REFRESH_DELAY_MSECS 1000
{
}
{
ilist->highest_name_id = 0;
ilist->sync_log_file_seq = 0;
ilist->sync_log_file_offset = 0;
}
{
unsigned int lock_timeout;
return;
/* try opening once more. it should be created
directly into memory now. */
index_flags) < 0)
i_panic("in-memory index creation failed");
}
}
}
struct mailbox_list_index_node *
const char *name)
{
return node;
}
return NULL;
}
static struct mailbox_list_index_node *
{
const char *const *path;
unsigned int i;
char sep[2];
if (*name == '\0')
for (i = 0;; i++) {
break;
}
return node;
}
struct mailbox_list_index_node *
{
struct mailbox_list_index_node *node;
T_BEGIN {
} T_END;
return node;
}
struct mailbox_list_index_node *
{
}
{
}
}
struct mail_index_view *view)
{
const void *data, *p;
char *name;
if (size == 0)
return 0;
for (i = sizeof(struct mailbox_list_index_header); i < size; ) {
/* get id */
return -1;
i += sizeof(id);
/* allow extra space in the end as long as last id=0 */
return id == 0 ? 0 : -1;
}
/* get name */
if (p == NULL)
return -1;
len = (const char *)p -
(const char *)(CONST_PTR_OFFSET(data, i));
i += len + 1;
/* add id => name to hash table */
}
return 0;
}
struct mail_index_view *view)
{
struct mailbox_list_index_node *node;
const struct mail_index_record *rec;
const struct mailbox_list_index_record *irec;
const void *data;
bool expunged;
struct mailbox_list_index_node, 1);
return -1;
return -1;
if (irec->parent_uid != 0) {
irec->parent_uid);
return -1;
} else {
}
}
return 0;
}
{
const struct mail_index_header *hdr;
int ret;
if (!force &&
/* nothing changed */
return 0;
}
if (ret == 0)
if (ret < 0) {
return -1;
}
return 0;
}
struct mail_index_view *view)
{
const struct mailbox_list_index_header *hdr;
const void *data;
}
{
struct mail_index_view *view;
int ret;
if (ilist->iter_refcount > 0) {
/* someone's already iterating. don't break them. */
return 0;
}
return -1;
}
/* refresh list of mailboxes */
} else {
}
return ret;
}
{
(void)mailbox_list_index_refresh(list);
}
{
struct mailbox_list_index_header new_hdr;
struct mail_index_view *view;
struct mail_index_transaction *trans;
if (mail_index_transaction_commit(&trans) < 0)
}
ilist->to_refresh =
}
}
{
}
static int
{
}
static int
{
}
static int
const char *oldname,
struct mailbox_list *newlist,
const char *newname)
{
}
static int
{
struct mail_index_view *view;
struct mail_index_transaction *trans;
const void *data;
return -1;
is to trigger NOTIFY watcher to handle SubscriptionChange events */
else {
}
(void)mail_index_transaction_commit(&trans);
return 0;
}
{
struct mailbox_list_index *ilist;
const char *dir;
/* reserve the module context anyway, so syncing code knows
that the index is disabled */
return;
}
if (*dir == '\0') {
/* in-memory indexes */
their indexes may be shared between multiple users,
each of which may have different ACLs */
}
sizeof(struct mailbox_list_index_header),
sizeof(struct mailbox_list_index_record),
sizeof(uint32_t));
sizeof(uint32_t), 0,
sizeof(uint32_t));
}
static struct mail_storage_hooks mailbox_list_index_hooks = {
};
void mailbox_list_index_init(void); /* called in mailbox-list-register.c */
void mailbox_list_index_init(void)
{
}