mail-index-transaction-export.c revision 3403e054eacf125e757bf6c66abf0ea9f086a4b6
/* Copyright (c) 2003-2016 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;
}
static unsigned int
{
unsigned int i;
for (i = hu->alloc_size; i > 0; i--) {
return i;
}
return 0;
}
unsigned int *hdr_size_r)
{
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 {
}
} else {
/* generate a new intro structure */
} else {
}
/* handle increasing header size automatically */
if (array_is_created(&t->ext_hdr_updates) &&
const struct mail_index_transaction_ext_hdr_update *hu;
unsigned int hdr_update_size;
}
}
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,
unsigned int ext_hdr_size)
{
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 {
}
} else {
hdr_size = 0;
}
if (ext_reset.new_reset_id != 0) {
}
T_BEGIN {
hdr_size);
} 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);
}
(t->flags & MAIL_INDEX_TRANSACTION_FLAG_FSYNC) != 0;
}