dovecot-2.2: lib-storage: Added index_storage_mailbox_delete_pre...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Jun 30 11:37:36 UTC 2014
details: http://hg.dovecot.org/dovecot-2.2/rev/0eee02b75557
changeset: 17540:0eee02b75557
user: Timo Sirainen <tss at iki.fi>
date: Mon Jun 30 14:30:43 2014 +0300
description:
lib-storage: Added index_storage_mailbox_delete_pre/post().
This avoids reimplementing the whole index_storage_mailbox_delete() for
storage backends that need to do more work in the middle.
diffstat:
src/lib-storage/index/index-storage.c | 24 +++++++++++++++++++++---
src/lib-storage/index/index-storage.h | 2 ++
2 files changed, 23 insertions(+), 3 deletions(-)
diffs (62 lines):
diff -r 852bc94983ab -r 0eee02b75557 src/lib-storage/index/index-storage.c
--- a/src/lib-storage/index/index-storage.c Mon Jun 30 14:29:26 2014 +0300
+++ b/src/lib-storage/index/index-storage.c Mon Jun 30 14:30:43 2014 +0300
@@ -670,11 +670,9 @@
return mailbox_transaction_commit(&t);
}
-int index_storage_mailbox_delete(struct mailbox *box)
+int index_storage_mailbox_delete_pre(struct mailbox *box)
{
- struct mailbox_metadata metadata;
struct mailbox_status status;
- int ret_guid;
if (!box->opened) {
/* \noselect mailbox, try deleting only the directory */
@@ -714,6 +712,13 @@
return -1;
}
}
+ return 1;
+}
+
+int index_storage_mailbox_delete_post(struct mailbox *box)
+{
+ struct mailbox_metadata metadata;
+ int ret_guid;
ret_guid = mailbox_get_metadata(box, MAILBOX_METADATA_GUID, &metadata);
@@ -743,6 +748,19 @@
return 0;
}
+int index_storage_mailbox_delete(struct mailbox *box)
+{
+ int ret;
+
+ if ((ret = index_storage_mailbox_delete_pre(box)) <= 0)
+ return ret;
+ /* mails have been now successfully deleted. some mailbox formats may
+ at this point do some other deletion that is required for it.
+ the _post() deletion will close the index and delete the
+ directory. */
+ return index_storage_mailbox_delete_post(box);
+}
+
int index_storage_mailbox_rename(struct mailbox *src, struct mailbox *dest)
{
guid_128_t guid;
diff -r 852bc94983ab -r 0eee02b75557 src/lib-storage/index/index-storage.h
--- a/src/lib-storage/index/index-storage.h Mon Jun 30 14:29:26 2014 +0300
+++ b/src/lib-storage/index/index-storage.h Mon Jun 30 14:30:43 2014 +0300
@@ -74,6 +74,8 @@
int index_storage_mailbox_update_common(struct mailbox *box,
const struct mailbox_update *update);
int index_storage_mailbox_create(struct mailbox *box, bool directory);
+int index_storage_mailbox_delete_pre(struct mailbox *box);
+int index_storage_mailbox_delete_post(struct mailbox *box);
int index_storage_mailbox_delete(struct mailbox *box);
int index_storage_mailbox_delete_dir(struct mailbox *box, bool mailbox_deleted);
int index_storage_mailbox_rename(struct mailbox *src, struct mailbox *dest);
More information about the dovecot-cvs
mailing list