comparison src/lib-index/mail-index-sync.c @ 1956:d6941cd8afdc HEAD

Added support for setting dirty flags for messages (TODO: undirty..) s/mail_index_record_flag/mail_cache_record_flag/
author Timo Sirainen <tss@iki.fi>
date Sun, 02 May 2004 22:24:35 +0300
parents 2f6e137cdc44
children d77a2a1e9278
comparison
equal deleted inserted replaced
1955:0f0128b4af5d 1956:d6941cd8afdc
395 return (ctx->update_idx != ctx->updates_count) || 395 return (ctx->update_idx != ctx->updates_count) ||
396 (ctx->expunge_idx != ctx->expunges_count) || 396 (ctx->expunge_idx != ctx->expunges_count) ||
397 ctx->sync_appends; 397 ctx->sync_appends;
398 } 398 }
399 399
400 int mail_index_sync_set_dirty(struct mail_index_sync_ctx *ctx, uint32_t seq)
401 {
402 if (ctx->dirty_lock_id == 0) {
403 if (mail_index_lock_exclusive(ctx->index,
404 &ctx->dirty_lock_id) < 0)
405 return -1;
406 }
407
408 i_assert(seq <= ctx->view->map->records_count);
409 ctx->view->map->records[seq-1].flags |= MAIL_INDEX_MAIL_FLAG_DIRTY;
410 ctx->have_dirty = TRUE;
411 return 0;
412 }
413
400 int mail_index_sync_end(struct mail_index_sync_ctx *ctx, 414 int mail_index_sync_end(struct mail_index_sync_ctx *ctx,
401 uint32_t sync_stamp, uint64_t sync_size) 415 uint32_t sync_stamp, uint64_t sync_size)
402 { 416 {
403 const struct mail_index_header *hdr; 417 const struct mail_index_header *hdr;
404 uint32_t seq; 418 uint32_t seq;
419 ret = -1; 433 ret = -1;
420 } 434 }
421 435
422 if (ret == 0) { 436 if (ret == 0) {
423 mail_index_sync_read_and_sort(ctx, TRUE); 437 mail_index_sync_read_and_sort(ctx, TRUE);
438
424 if (mail_index_sync_update_index(ctx, sync_stamp, 439 if (mail_index_sync_update_index(ctx, sync_stamp,
425 sync_size) < 0) 440 sync_size) < 0)
426 ret = -1; 441 ret = -1;
427 } 442 }
443
444 if (ctx->dirty_lock_id == 0)
445 mail_index_unlock(ctx->index, ctx->dirty_lock_id);
428 446
429 mail_index_unlock(ctx->index, ctx->lock_id); 447 mail_index_unlock(ctx->index, ctx->lock_id);
430 mail_transaction_log_sync_unlock(ctx->index->log); 448 mail_transaction_log_sync_unlock(ctx->index->log);
431 mail_index_view_close(ctx->view); 449 mail_index_view_close(ctx->view);
432 450