mail-index-transaction-export.c revision 930d6db2ee2bbafd3c7cdaa39855ddccb999522f
/* Copyright (c) 2003-2013 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "mail-index-private.h"
#include "mail-index-modseq.h"
#include "mail-transaction-log-private.h"
#include "mail-index-transaction-private.h"
struct mail_index_export_context {
struct mail_index_transaction *trans;
};
static void
{
}
struct mail_index_transaction *t)
{
const struct mail_index_flag_update *updates;
struct mail_transaction_flag_update *log_update;
unsigned int i, count;
if (count == 0)
return;
for (i = 0; i < count; i++) {
}
}
static const buffer_t *
{
struct mail_transaction_header_update u;
int state = 0;
memset(&u, 0, sizeof(u));
if (state == 0) {
state++;
}
} else {
if (state > 0) {
buffer_append(buf, &u, sizeof(u));
state = 0;
}
}
}
return buf;
}
{
const struct mail_index_registered_ext *rext;
const struct mail_index_ext *ext;
unsigned int count;
if (t->reset ||
/* new extension */
}
if (!array_is_created(&t->ext_resizes)) {
count = 0;
} else {
}
/* we're resizing the extension. use the resize struct. */
} else {
/* generate a new intro structure */
} else {
}
}
if (reset_id != 0) {
/* we're going to reset this extension in this transaction */
/* use the existing reset_id */
const struct mail_index_ext *map_ext =
} else {
/* new extension, reset_id defaults to 0 */
}
/* modseq tracking started */
}
}
static void
const struct mail_index_transaction_ext_hdr_update *hdr)
{
struct mail_transaction_ext_hdr_update u;
struct mail_transaction_ext_hdr_update32 u32;
memset(&u, 0, sizeof(u));
if (!started) {
}
} else {
if (started) {
if (use_32)
else {
buffer_append(buf, &u, sizeof(u));
}
}
}
}
}
static void
{
const struct mail_transaction_ext_intro *resize;
const struct mail_index_transaction_ext_hdr_update *hdrs;
struct mail_transaction_ext_reset ext_reset;
unsigned int resize_count, ext_count = 0;
const struct mail_transaction_ext_reset *reset;
if (!array_is_created(&t->ext_resizes)) {
resize_count = 0;
} else {
if (ext_count < resize_count)
}
if (!array_is_created(&t->ext_reset_ids)) {
reset_id_count = 0;
} else {
}
if (!array_is_created(&t->ext_resets)) {
reset_count = 0;
} else {
if (ext_count < reset_count)
}
if (!array_is_created(&t->ext_hdr_updates)) {
hdrs_count = 0;
} else {
if (ext_count < hdrs_count)
}
if (ext_id < reset_count)
else
ext_reset.new_reset_id = 0;
ext_reset.new_reset_id != 0 ||
if (ext_reset.new_reset_id != 0) {
/* we're going to reset this extension
immediately after the intro */
reset_id = 0;
} else {
}
}
if (ext_reset.new_reset_id != 0) {
}
T_BEGIN {
} T_END;
}
}
}
enum mail_transaction_type type)
{
if (!array_is_created(&t->ext_reset_ids)) {
reset_id_count = 0;
} else {
}
continue;
}
}
static void
{
}
static enum mail_index_fsync_mask
{
const struct mail_index_transaction_keyword_update *updates;
const char *const *keywords;
enum mail_index_fsync_mask change_mask = 0;
unsigned int i, count, keywords_count;
for (i = 0; i < count; i++) {
MODIFY_ADD, keywords[i],
}
MODIFY_REMOVE, keywords[i],
}
}
return change_mask;
}
void mail_index_transaction_export(struct mail_index_transaction *t,
{
enum mail_index_fsync_mask change_mask = 0;
struct mail_index_export_context ctx;
if (t->index_undeleted) {
i_assert(!t->index_deleted);
}
/* send all extension introductions and resizes before appends
to avoid resize overhead as much as possible */
if (t->pre_hdr_changed) {
}
if (t->attribute_updates != NULL) {
/* need to have 32bit alignment */
}
/* append the timestamp and value lengths */
t->attribute_updates_suffix->used);
}
if (array_is_created(&t->appends)) {
}
if (array_is_created(&t->updates)) {
log_append_flag_updates(&ctx, t);
}
if (array_is_created(&t->ext_rec_updates)) {
}
if (array_is_created(&t->ext_rec_atomics)) {
}
if (array_is_created(&t->keyword_updates))
/* keep modseq updates almost last */
if (array_is_created(&t->modseq_updates)) {
}
if (array_is_created(&t->expunges)) {
/* non-external expunges are only requests, ignore them when
checking fsync_mask */
if ((t->flags & MAIL_INDEX_TRANSACTION_FLAG_EXTERNAL) != 0)
}
if (t->post_hdr_changed) {
}
if (t->index_deleted) {
i_assert(!t->index_undeleted);
&null4, 4);
}
/* Update the tail offsets only when committing the sync transaction.
Other transactions may not know the latest tail offset and might
end up shrinking it. (Alternatively the shrinking tail offsets could
just be ignored, which would probably work fine too.) */
(t->flags & MAIL_INDEX_TRANSACTION_FLAG_FSYNC) != 0;
}