mdbox-storage.c revision 1460ef7a18c53216ddb4a94bb62fba96076aae8e
/* Copyright (c) 2007-2011 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "ioloop.h"
#include "mkdir-parents.h"
#include "master-service.h"
#include "mail-index-modseq.h"
#include "mail-index-alloc-cache.h"
#include "mailbox-log.h"
#include "mailbox-list-private.h"
#include "dbox-mail.h"
#include "dbox-save.h"
#include "mdbox-map.h"
#include "mdbox-file.h"
#include "mdbox-sync.h"
#include "mdbox-storage-rebuild.h"
#include "mdbox-storage.h"
extern struct mail_storage mdbox_storage;
extern struct mailbox mdbox_mailbox;
extern struct dbox_storage_vfuncs mdbox_dbox_storage_vfuncs;
static struct mail_storage *mdbox_storage_alloc(void)
{
struct mdbox_storage *storage;
}
static int
const char **error_r)
{
const char *dir;
*error_r = "mdbox: MAILBOXDIR must not be empty";
return -1;
}
}
{
}
static struct mailbox *
{
struct mdbox_mailbox *mbox;
struct index_mailbox_context *ibox;
/* dbox can't work without index files */
}
{
if (dbox_mailbox_open(box) < 0)
return -1;
sizeof(struct mdbox_mail_index_record),
sizeof(uint32_t));
mbox->hdr_ext_id =
sizeof(struct mdbox_index_header), 0, 0);
mbox->guid_ext_id =
0, MAIL_GUID_128_SIZE, 1);
return 0;
}
{
(void)mdbox_storage_rebuild(mstorage);
}
struct mdbox_index_header *hdr)
{
const void *data;
if (data_size < MDBOX_INDEX_HEADER_MIN_SIZE &&
"mdbox %s: Invalid dbox header size: %"PRIuSIZE_T,
return -1;
}
return 0;
}
struct mail_index_transaction *trans,
const struct mailbox_update *update)
{
sizeof(new_hdr.mailbox_guid));
}
}
}
const struct mailbox_update *update,
struct mail_index_transaction *trans)
{
const struct mail_index_header *hdr;
return -1;
}
else if (uid_validity == 0) {
/* set uidvalidity */
}
if (hdr->uid_validity != 0) {
/* UIDVALIDITY change requires index to be reset */
}
}
}
}
}
if (mail_index_transaction_commit(&new_trans) < 0) {
return -1;
}
}
return 0;
}
const struct mailbox_update *update,
struct mail_index_transaction *trans)
{
int ret;
return ret;
}
{
/* already set it corrupted (possibly recursing back here) */
return;
}
}
}
static const char *
{
return "";
}
{
}
{
}
static int
{
struct mdbox_index_header hdr;
/* regenerate it */
return -1;
}
return 0;
}
static int
enum mailbox_metadata_items items,
struct mailbox_metadata *metadata_r)
{
if ((items & MAILBOX_METADATA_GUID) != 0) {
return -1;
}
}
static int
{
if (mailbox_open(box) < 0)
return -1;
}
}
{
struct mdbox_map_atomic_context *atomic;
struct mdbox_map_transaction_context *map_trans;
const struct mail_index_header *hdr;
int ret = 0;
&map_uid) < 0) {
ret = -1;
break;
}
ret = -1;
break;
}
}
if (ret == 0)
if (mdbox_map_atomic_finish(&atomic) < 0)
ret = -1;
return ret;
}
{
if (mdbox_mailbox_unref_mails(mbox) < 0)
return -1;
}
return index_storage_mailbox_delete(box);
}
struct mail_storage mdbox_storage = {
.v = {
NULL,
NULL,
}
};
struct mailbox mdbox_mailbox = {
.v = {
NULL,
NULL,
}
};
struct dbox_storage_vfuncs mdbox_dbox_storage_vfuncs = {
};