index-status.c revision a8c5a86d183db25a57bf193c06b41e092ec2e151
/* Copyright (c) 2002-2014 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "mail-cache.h"
#include "mail-search-build.h"
#include "mail-index-modseq.h"
#include "index-storage.h"
static void
{
const struct mail_index_header *hdr;
struct mail_cache_view *cache_view;
*last_cached_seq_r = 0;
return;
*last_cached_seq_r = seq;
break;
}
}
}
enum mailbox_status_items items,
struct mailbox_status *status_r)
{
if (mailbox_open(box) < 0)
return -1;
return -1;
}
return 0;
}
{
const struct mail_index_record *pvt_rec;
unsigned int unseen_count = 0;
/* we can't trust private index to be up to date. we'll need to go
through the shared index and for each existing mail lookup its
private flags. if a mail doesn't exist in private index then its
flags are 0. */
unseen_count++;
shared_seq++; pvt_seq++;
shared_seq++;
} else {
pvt_seq++;
}
}
return unseen_count;
}
{
const struct mail_index_header *pvt_hdr;
const struct mail_index_record *pvt_rec;
if (pvt_seq == 0)
return shared_seq;
}
/* if shared index has any messages that don't exist in private index,
the first of them is the first unseen message */
&shared_seq, &seq2))
return shared_seq;
return 0;
}
enum mailbox_status_items items,
struct mailbox_status *status_r)
{
const struct mail_index_header *hdr;
/* we can get most of the status items without any trouble */
if ((items & STATUS_RECENT) != 0) {
/* recent flags are set and dropped by the previous
sync while index was locked. if we updated the
recent flags here we'd have a race condition. */
} else {
/* make sure recent count is set, in case we haven't
synced yet */
}
}
if ((items & STATUS_UNSEEN) != 0) {
} else {
}
}
if ((items & STATUS_HIGHESTMODSEQ) != 0) {
if (status_r->highest_modseq == 0) {
/* modseqs not enabled yet, but we can't return 0 */
}
}
if (status_r->highest_pvt_modseq == 0) {
/* modseqs not enabled yet, but we can't return 0 */
}
}
if ((items & STATUS_FIRST_UNSEEN_SEQ) != 0) {
} else {
}
}
if ((items & STATUS_LAST_CACHED_SEQ) != 0)
if ((items & STATUS_KEYWORDS) != 0)
if ((items & STATUS_PERMANENT_FLAGS) != 0) {
if (!mailbox_is_readonly(box)) {
}
}
}
static void
struct mailbox_metadata *metadata_r)
{
const struct mail_cache_field *fields;
enum mail_cache_decision_type dec;
struct mailbox_cache_field *cf;
unsigned int i, count;
box->metadata_pool =
}
for (i = 0; i < count; i++) {
if (dec != MAIL_CACHE_DECISION_NO) {
}
}
}
struct mailbox_metadata *metadata_r)
{
const struct mail_cache_field *fields;
unsigned int i, count;
enum mail_fetch_field cache = 0;
pool_datastack_create(), &count);
for (i = 0; i < count; i++) {
cache |= MAIL_FETCH_GUID;
/* just ignore for now at least.. */
}
}
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 (mailbox_open(box) < 0)
return -1;
}
return -1;
}
if ((items & MAILBOX_METADATA_VIRTUAL_SIZE) != 0) {
return -1;
}
if ((items & MAILBOX_METADATA_CACHE_FIELDS) != 0)
if ((items & MAILBOX_METADATA_PRECACHE_FIELDS) != 0)
if ((items & MAILBOX_METADATA_BACKEND_NAMESPACE) != 0) {
}
return 0;
}