index-status.c revision 4b4aabb44db8d395e27265db137eab876f3de6b5
/* Copyright (c) 2002-2011 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "mail-cache.h"
#include "mail-search-build.h"
#include "index-storage.h"
#include "mail-index-modseq.h"
enum mailbox_status_items items,
struct mailbox_status *status_r)
{
const struct mail_index_header *hdr;
if (mailbox_open(box) < 0)
return -1;
if (mailbox_sync(box, 0) < 0)
return -1;
}
/* we can get most of the status items without any trouble */
if ((items & STATUS_RECENT) != 0) {
/* make sure recent count is set, in case syncing hasn't
been done yet */
}
if ((items & STATUS_HIGHESTMODSEQ) != 0) {
if (status_r->highest_modseq == 0) {
/* modseqs not enabled yet, but we can't return 0 */
}
}
if ((items & STATUS_FIRST_UNSEEN_SEQ) != 0) {
}
if ((items & STATUS_KEYWORDS) != 0)
if ((items & STATUS_PERMANENT_FLAGS) != 0) {
if (!mailbox_is_readonly(box)) {
/* FIXME: set to FALSE if we're full */
}
}
return 0;
}
static void
struct mailbox_metadata *metadata_r)
{
const struct mail_cache_field *fields;
enum mail_cache_decision_type dec;
unsigned int i, count;
pool_datastack_create(), &count);
for (i = 0; i < count; i++) {
if (dec != MAIL_CACHE_DECISION_NO)
}
}
static int
struct index_vsize_header *vsize_hdr)
{
const struct mail_index_header *hdr;
struct mailbox_transaction_context *trans;
struct mail_search_context *search_ctx;
struct mail_search_args *search_args;
int ret = 0;
if (vsize_hdr->highest_uid == 0)
seq2 = 0;
seq2 = 0;
"vsize-hdr has invalid message-count (%u < %u)",
} else {
/* some messages have been expunged, rescan */
}
seq2 = 0;
}
continue;
ret = -1;
break;
}
}
if (mailbox_search_deinit(&search_ctx) < 0)
ret = -1;
if (ret == 0) {
/* success, cache all */
} else {
/* search failed, cache only up to highest seen uid */
}
(void)mailbox_transaction_commit(&trans);
return ret;
}
static int
struct mailbox_metadata *metadata_r)
{
struct index_vsize_header vsize_hdr;
struct mailbox_status status;
const void *data;
int ret;
else {
if (size != 0) {
"vsize-hdr has invalid size: %"PRIuSIZE_T,
size);
}
}
/* up to date */
return 0;
}
"vsize-hdr has invalid highest-uid (%u >= %u)",
}
return ret;
}
enum mailbox_metadata_items items,
struct mailbox_metadata *metadata_r)
{
if ((items & MAILBOX_METADATA_CACHE_FIELDS) != 0)
if ((items & MAILBOX_METADATA_VIRTUAL_SIZE) != 0) {
return -1;
}
return 0;
}