annotate src/lib-index/mail-transaction-log.h @ 5278:d569caa88a66 HEAD

If we run out of disk space, move to in-memory indexes.
author Timo Sirainen <tss@iki.fi>
date Sun, 11 Mar 2007 18:10:41 +0200
parents c1ef15c1a1fa
children 1273ce0585b3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
1 #ifndef __MAIL_TRANSACTION_LOG_H
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
2 #define __MAIL_TRANSACTION_LOG_H
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
3
3169
ec17099a6490 Added versioning to transaction log header. Added create_stamp to its
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
4 #define MAIL_TRANSACTION_LOG_MAJOR_VERSION 1
ec17099a6490 Added versioning to transaction log header. Added create_stamp to its
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
5 #define MAIL_TRANSACTION_LOG_MINOR_VERSION 0
ec17099a6490 Added versioning to transaction log header. Added create_stamp to its
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
6 #define MAIL_TRANSACTION_LOG_HEADER_MIN_SIZE 24
ec17099a6490 Added versioning to transaction log header. Added create_stamp to its
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
7
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
8 struct mail_transaction_log_header {
3169
ec17099a6490 Added versioning to transaction log header. Added create_stamp to its
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
9 uint8_t major_version;
ec17099a6490 Added versioning to transaction log header. Added create_stamp to its
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
10 uint8_t minor_version;
ec17099a6490 Added versioning to transaction log header. Added create_stamp to its
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
11 uint16_t hdr_size;
ec17099a6490 Added versioning to transaction log header. Added create_stamp to its
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
12
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
13 uint32_t indexid;
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
14 uint32_t file_seq;
1940
Timo Sirainen <tss@iki.fi>
parents: 1935
diff changeset
15 uint32_t prev_file_seq;
1935
ec4d5ff99f6e Don't modify index file when creating new transaction log.
Timo Sirainen <tss@iki.fi>
parents: 1915
diff changeset
16 uint32_t prev_file_offset;
3169
ec17099a6490 Added versioning to transaction log header. Added create_stamp to its
Timo Sirainen <tss@iki.fi>
parents: 3138
diff changeset
17 uint32_t create_stamp;
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
18 };
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
19
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
20 enum mail_transaction_type {
2115
f720b3f15333 Modifying extra_records should work now.
Timo Sirainen <tss@iki.fi>
parents: 2074
diff changeset
21 MAIL_TRANSACTION_EXPUNGE = 0x00000001,
f720b3f15333 Modifying extra_records should work now.
Timo Sirainen <tss@iki.fi>
parents: 2074
diff changeset
22 MAIL_TRANSACTION_APPEND = 0x00000002,
f720b3f15333 Modifying extra_records should work now.
Timo Sirainen <tss@iki.fi>
parents: 2074
diff changeset
23 MAIL_TRANSACTION_FLAG_UPDATE = 0x00000004,
2201
7bdef5ea4591 Several fixes and cleanups to cache file code, still badly broken
Timo Sirainen <tss@iki.fi>
parents: 2115
diff changeset
24 MAIL_TRANSACTION_HEADER_UPDATE = 0x00000020,
2671
3b70ddb51771 Renamed "extra record info" and variations of it to "extension" or "ext" in
Timo Sirainen <tss@iki.fi>
parents: 2563
diff changeset
25 MAIL_TRANSACTION_EXT_INTRO = 0x00000040,
3b70ddb51771 Renamed "extra record info" and variations of it to "extension" or "ext" in
Timo Sirainen <tss@iki.fi>
parents: 2563
diff changeset
26 MAIL_TRANSACTION_EXT_RESET = 0x00000080,
3b70ddb51771 Renamed "extra record info" and variations of it to "extension" or "ext" in
Timo Sirainen <tss@iki.fi>
parents: 2563
diff changeset
27 MAIL_TRANSACTION_EXT_HDR_UPDATE = 0x00000100,
3b70ddb51771 Renamed "extra record info" and variations of it to "extension" or "ext" in
Timo Sirainen <tss@iki.fi>
parents: 2563
diff changeset
28 MAIL_TRANSACTION_EXT_REC_UPDATE = 0x00000200,
3016
61c8d205d887 Initial support for keywords. Syncing to mbox/maildir doesn't work yet.
Timo Sirainen <tss@iki.fi>
parents: 2853
diff changeset
29 MAIL_TRANSACTION_KEYWORD_UPDATE = 0x00000400,
3138
fbe844061fe2 Internal changes in how keywords are handled. struct mail_keywords isn't
Timo Sirainen <tss@iki.fi>
parents: 3111
diff changeset
30 MAIL_TRANSACTION_KEYWORD_RESET = 0x00000800,
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
31
2115
f720b3f15333 Modifying extra_records should work now.
Timo Sirainen <tss@iki.fi>
parents: 2074
diff changeset
32 MAIL_TRANSACTION_TYPE_MASK = 0x0000ffff,
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
33
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
34 /* since we'll expunge mails based on data read from transaction log,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
35 try to avoid the possibility of corrupted transaction log expunging
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
36 messages. this value is ORed to the actual MAIL_TRANSACTION_EXPUNGE
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
37 flag. if it's not present, assume corrupted log. */
2115
f720b3f15333 Modifying extra_records should work now.
Timo Sirainen <tss@iki.fi>
parents: 2074
diff changeset
38 MAIL_TRANSACTION_EXPUNGE_PROT = 0x0000cd90,
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
39
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
40 /* Mailbox synchronization noticed this change. */
2115
f720b3f15333 Modifying extra_records should work now.
Timo Sirainen <tss@iki.fi>
parents: 2074
diff changeset
41 MAIL_TRANSACTION_EXTERNAL = 0x10000000
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
42 };
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
43
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
44 struct mail_transaction_header {
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
45 uint32_t size;
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
46 uint32_t type; /* enum mail_transaction_type */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
47 };
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
48
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
49 struct mail_transaction_expunge {
2033
4f6b1118a53d Transaction log contains only UIDs now, no more sequences which just mess up
Timo Sirainen <tss@iki.fi>
parents: 2009
diff changeset
50 uint32_t uid1, uid2;
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
51 };
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
52
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
53 struct mail_transaction_flag_update {
2033
4f6b1118a53d Transaction log contains only UIDs now, no more sequences which just mess up
Timo Sirainen <tss@iki.fi>
parents: 2009
diff changeset
54 uint32_t uid1, uid2;
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
55 uint8_t add_flags;
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
56 uint8_t remove_flags;
3111
b1eaafa49f53 Added padding field explicitly for struct mail_transaction_flag_update. It
Timo Sirainen <tss@iki.fi>
parents: 3016
diff changeset
57 uint16_t padding;
3016
61c8d205d887 Initial support for keywords. Syncing to mbox/maildir doesn't work yet.
Timo Sirainen <tss@iki.fi>
parents: 2853
diff changeset
58 };
61c8d205d887 Initial support for keywords. Syncing to mbox/maildir doesn't work yet.
Timo Sirainen <tss@iki.fi>
parents: 2853
diff changeset
59
61c8d205d887 Initial support for keywords. Syncing to mbox/maildir doesn't work yet.
Timo Sirainen <tss@iki.fi>
parents: 2853
diff changeset
60 struct mail_transaction_keyword_update {
3138
fbe844061fe2 Internal changes in how keywords are handled. struct mail_keywords isn't
Timo Sirainen <tss@iki.fi>
parents: 3111
diff changeset
61 uint8_t modify_type; /* enum modify_type : MODIFY_ADD / MODIFY_REMOVE */
3016
61c8d205d887 Initial support for keywords. Syncing to mbox/maildir doesn't work yet.
Timo Sirainen <tss@iki.fi>
parents: 2853
diff changeset
62 uint8_t padding;
3138
fbe844061fe2 Internal changes in how keywords are handled. struct mail_keywords isn't
Timo Sirainen <tss@iki.fi>
parents: 3111
diff changeset
63 uint16_t name_size;
fbe844061fe2 Internal changes in how keywords are handled. struct mail_keywords isn't
Timo Sirainen <tss@iki.fi>
parents: 3111
diff changeset
64 /* unsigned char name[];
3016
61c8d205d887 Initial support for keywords. Syncing to mbox/maildir doesn't work yet.
Timo Sirainen <tss@iki.fi>
parents: 2853
diff changeset
65 array of { uint32_t uid1, uid2; }
61c8d205d887 Initial support for keywords. Syncing to mbox/maildir doesn't work yet.
Timo Sirainen <tss@iki.fi>
parents: 2853
diff changeset
66 */
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
67 };
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
68
3138
fbe844061fe2 Internal changes in how keywords are handled. struct mail_keywords isn't
Timo Sirainen <tss@iki.fi>
parents: 3111
diff changeset
69 struct mail_transaction_keyword_reset {
fbe844061fe2 Internal changes in how keywords are handled. struct mail_keywords isn't
Timo Sirainen <tss@iki.fi>
parents: 3111
diff changeset
70 uint32_t uid1, uid2;
fbe844061fe2 Internal changes in how keywords are handled. struct mail_keywords isn't
Timo Sirainen <tss@iki.fi>
parents: 3111
diff changeset
71 };
fbe844061fe2 Internal changes in how keywords are handled. struct mail_keywords isn't
Timo Sirainen <tss@iki.fi>
parents: 3111
diff changeset
72
2050
ee1095ccfd23 Index header changes now go through transaction log. Removed the kludgy
Timo Sirainen <tss@iki.fi>
parents: 2033
diff changeset
73 struct mail_transaction_header_update {
ee1095ccfd23 Index header changes now go through transaction log. Removed the kludgy
Timo Sirainen <tss@iki.fi>
parents: 2033
diff changeset
74 uint16_t offset;
ee1095ccfd23 Index header changes now go through transaction log. Removed the kludgy
Timo Sirainen <tss@iki.fi>
parents: 2033
diff changeset
75 uint16_t size;
2410
c7c886199f28 Small cleanups.
Timo Sirainen <tss@iki.fi>
parents: 2407
diff changeset
76 /* unsigned char data[]; */
2050
ee1095ccfd23 Index header changes now go through transaction log. Removed the kludgy
Timo Sirainen <tss@iki.fi>
parents: 2033
diff changeset
77 };
ee1095ccfd23 Index header changes now go through transaction log. Removed the kludgy
Timo Sirainen <tss@iki.fi>
parents: 2033
diff changeset
78
2671
3b70ddb51771 Renamed "extra record info" and variations of it to "extension" or "ext" in
Timo Sirainen <tss@iki.fi>
parents: 2563
diff changeset
79 struct mail_transaction_ext_intro {
2762
a1c7e92c1839 New way of handling extension introductions in transaction log.
Timo Sirainen <tss@iki.fi>
parents: 2683
diff changeset
80 /* old extension: set ext_id. don't set name.
a1c7e92c1839 New way of handling extension introductions in transaction log.
Timo Sirainen <tss@iki.fi>
parents: 2683
diff changeset
81 new extension: ext_id = (uint32_t)-1. give name. */
a1c7e92c1839 New way of handling extension introductions in transaction log.
Timo Sirainen <tss@iki.fi>
parents: 2683
diff changeset
82 uint32_t ext_id;
2853
512dd7d76cdc Removed cache_offset from mail_index_record and changed it to use extension
Timo Sirainen <tss@iki.fi>
parents: 2762
diff changeset
83 uint32_t reset_id;
2563
5752e5ac88f0 Save extra record/header infos into index file permanently.
Timo Sirainen <tss@iki.fi>
parents: 2410
diff changeset
84 uint32_t hdr_size;
5752e5ac88f0 Save extra record/header infos into index file permanently.
Timo Sirainen <tss@iki.fi>
parents: 2410
diff changeset
85 uint16_t record_size;
2683
d41c42a7bf1e Index extensions can now specify record alignment, and it's possible to
Timo Sirainen <tss@iki.fi>
parents: 2671
diff changeset
86 uint16_t record_align;
d41c42a7bf1e Index extensions can now specify record alignment, and it's possible to
Timo Sirainen <tss@iki.fi>
parents: 2671
diff changeset
87 uint16_t unused_padding;
2563
5752e5ac88f0 Save extra record/header infos into index file permanently.
Timo Sirainen <tss@iki.fi>
parents: 2410
diff changeset
88 uint16_t name_size;
5752e5ac88f0 Save extra record/header infos into index file permanently.
Timo Sirainen <tss@iki.fi>
parents: 2410
diff changeset
89 /* unsigned char name[]; */
5752e5ac88f0 Save extra record/header infos into index file permanently.
Timo Sirainen <tss@iki.fi>
parents: 2410
diff changeset
90 };
5752e5ac88f0 Save extra record/header infos into index file permanently.
Timo Sirainen <tss@iki.fi>
parents: 2410
diff changeset
91
2853
512dd7d76cdc Removed cache_offset from mail_index_record and changed it to use extension
Timo Sirainen <tss@iki.fi>
parents: 2762
diff changeset
92 struct mail_transaction_ext_reset {
512dd7d76cdc Removed cache_offset from mail_index_record and changed it to use extension
Timo Sirainen <tss@iki.fi>
parents: 2762
diff changeset
93 uint32_t new_reset_id;
512dd7d76cdc Removed cache_offset from mail_index_record and changed it to use extension
Timo Sirainen <tss@iki.fi>
parents: 2762
diff changeset
94 };
512dd7d76cdc Removed cache_offset from mail_index_record and changed it to use extension
Timo Sirainen <tss@iki.fi>
parents: 2762
diff changeset
95
2762
a1c7e92c1839 New way of handling extension introductions in transaction log.
Timo Sirainen <tss@iki.fi>
parents: 2683
diff changeset
96 /* these are set for the last ext_intro */
2671
3b70ddb51771 Renamed "extra record info" and variations of it to "extension" or "ext" in
Timo Sirainen <tss@iki.fi>
parents: 2563
diff changeset
97 struct mail_transaction_ext_hdr_update {
2563
5752e5ac88f0 Save extra record/header infos into index file permanently.
Timo Sirainen <tss@iki.fi>
parents: 2410
diff changeset
98 uint16_t offset;
5752e5ac88f0 Save extra record/header infos into index file permanently.
Timo Sirainen <tss@iki.fi>
parents: 2410
diff changeset
99 uint16_t size;
5752e5ac88f0 Save extra record/header infos into index file permanently.
Timo Sirainen <tss@iki.fi>
parents: 2410
diff changeset
100 /* unsigned char data[]; */
5752e5ac88f0 Save extra record/header infos into index file permanently.
Timo Sirainen <tss@iki.fi>
parents: 2410
diff changeset
101 };
5752e5ac88f0 Save extra record/header infos into index file permanently.
Timo Sirainen <tss@iki.fi>
parents: 2410
diff changeset
102
2671
3b70ddb51771 Renamed "extra record info" and variations of it to "extension" or "ext" in
Timo Sirainen <tss@iki.fi>
parents: 2563
diff changeset
103 struct mail_transaction_ext_rec_update {
2115
f720b3f15333 Modifying extra_records should work now.
Timo Sirainen <tss@iki.fi>
parents: 2074
diff changeset
104 uint32_t uid;
2410
c7c886199f28 Small cleanups.
Timo Sirainen <tss@iki.fi>
parents: 2407
diff changeset
105 /* unsigned char data[]; */
2115
f720b3f15333 Modifying extra_records should work now.
Timo Sirainen <tss@iki.fi>
parents: 2074
diff changeset
106 };
f720b3f15333 Modifying extra_records should work now.
Timo Sirainen <tss@iki.fi>
parents: 2074
diff changeset
107
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
108 struct mail_transaction_log *
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
109 mail_transaction_log_open_or_create(struct mail_index *index);
5247
c1ef15c1a1fa If index file is corrupted, recreate transaction log file instead of trying
Timo Sirainen <tss@iki.fi>
parents: 3879
diff changeset
110 struct mail_transaction_log *
c1ef15c1a1fa If index file is corrupted, recreate transaction log file instead of trying
Timo Sirainen <tss@iki.fi>
parents: 3879
diff changeset
111 mail_transaction_log_create(struct mail_index *index);
3879
928229f8b3e6 deinit, unref, destroy, close, free, etc. functions now take a pointer to
Timo Sirainen <tss@iki.fi>
parents: 3863
diff changeset
112 void mail_transaction_log_close(struct mail_transaction_log **log);
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
113
3833
318c70c1d4ec Beginnings of fallbacking to in-memory indexes when write fails with "out of
Timo Sirainen <tss@iki.fi>
parents: 3832
diff changeset
114 int mail_transaction_log_move_to_memory(struct mail_transaction_log *log);
318c70c1d4ec Beginnings of fallbacking to in-memory indexes when write fails with "out of
Timo Sirainen <tss@iki.fi>
parents: 3832
diff changeset
115
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
116 struct mail_transaction_log_view *
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
117 mail_transaction_log_view_open(struct mail_transaction_log *log);
3879
928229f8b3e6 deinit, unref, destroy, close, free, etc. functions now take a pointer to
Timo Sirainen <tss@iki.fi>
parents: 3863
diff changeset
118 void mail_transaction_log_view_close(struct mail_transaction_log_view **view);
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
119
3832
76f4be7ae499 Handle missing/broken transaction logs better. Handle broken sync position
Timo Sirainen <tss@iki.fi>
parents: 3180
diff changeset
120 /* Set view boundaries. Returns -1 if error, 0 if files are lost, 1 if ok. */
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
121 int
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
122 mail_transaction_log_view_set(struct mail_transaction_log_view *view,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
123 uint32_t min_file_seq, uoff_t min_file_offset,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
124 uint32_t max_file_seq, uoff_t max_file_offset,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
125 enum mail_transaction_type type_mask);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
126
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
127 /* Read next transaction record from current position. The position is updated.
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
128 Returns -1 if error, 0 if we're at end of the view, 1 if ok. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
129 int mail_transaction_log_view_next(struct mail_transaction_log_view *view,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
130 const struct mail_transaction_header **hdr_r,
3863
55df57c028d4 Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents: 3833
diff changeset
131 const void **data_r, bool *skipped_r);
5278
d569caa88a66 If we run out of disk space, move to in-memory indexes.
Timo Sirainen <tss@iki.fi>
parents: 5247
diff changeset
132 /* Seek to given position within view. Must be inside the view's range. */
d569caa88a66 If we run out of disk space, move to in-memory indexes.
Timo Sirainen <tss@iki.fi>
parents: 5247
diff changeset
133 void mail_transaction_log_view_seek(struct mail_transaction_log_view *view,
d569caa88a66 If we run out of disk space, move to in-memory indexes.
Timo Sirainen <tss@iki.fi>
parents: 5247
diff changeset
134 uint32_t seq, uoff_t offset);
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
135
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
136 /* Returns the position of the record returned previously with
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
137 mail_transaction_log_view_next() */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
138 void
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
139 mail_transaction_log_view_get_prev_pos(struct mail_transaction_log_view *view,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
140 uint32_t *file_seq_r,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
141 uoff_t *file_offset_r);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
142
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
143 /* Marks the log file in current position to be corrupted. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
144 void
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
145 mail_transaction_log_view_set_corrupted(struct mail_transaction_log_view *view,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
146 const char *fmt, ...)
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
147 __attr_format__(2, 3);
3863
55df57c028d4 Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents: 3833
diff changeset
148 bool
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
149 mail_transaction_log_view_is_corrupted(struct mail_transaction_log_view *view);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
150
1942
2b114aa7eeec handle losing index file
Timo Sirainen <tss@iki.fi>
parents: 1941
diff changeset
151 void mail_transaction_log_views_close(struct mail_transaction_log *log);
2b114aa7eeec handle losing index file
Timo Sirainen <tss@iki.fi>
parents: 1941
diff changeset
152
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
153 /* Write data to transaction log. This is atomic operation. Sequences in
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
154 updates[] and expunges[] are relative to given view, they're modified
2009
2e77ee652e2e When committing with no changes, don't try to sync them later.
Timo Sirainen <tss@iki.fi>
parents: 1976
diff changeset
155 to real ones. If nothing is written, log_file_seq_r and log_file_offset_r
2e77ee652e2e When committing with no changes, don't try to sync them later.
Timo Sirainen <tss@iki.fi>
parents: 1976
diff changeset
156 will be set to 0. */
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
157 int mail_transaction_log_append(struct mail_index_transaction *t,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
158 uint32_t *log_file_seq_r,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
159 uoff_t *log_file_offset_r);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
160
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
161 /* Lock transaction log for index synchronization. Log cannot be read or
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
162 written to while it's locked. Returns end offset. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
163 int mail_transaction_log_sync_lock(struct mail_transaction_log *log,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
164 uint32_t *file_seq_r, uoff_t *file_offset_r);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
165 void mail_transaction_log_sync_unlock(struct mail_transaction_log *log);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
166 /* Returns the current head. Works only when log is locked. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
167 void mail_transaction_log_get_head(struct mail_transaction_log *log,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
168 uint32_t *file_seq_r, uoff_t *file_offset_r);
3832
76f4be7ae499 Handle missing/broken transaction logs better. Handle broken sync position
Timo Sirainen <tss@iki.fi>
parents: 3180
diff changeset
169 /* Returns TRUE if given seq/offset is current head log's rotate point. */
3863
55df57c028d4 Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents: 3833
diff changeset
170 bool mail_transaction_log_is_head_prev(struct mail_transaction_log *log,
55df57c028d4 Added "bool" type and changed all ints that were used as booleans to bool.
Timo Sirainen <tss@iki.fi>
parents: 3833
diff changeset
171 uint32_t file_seq, uoff_t file_offset);
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
172
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
173 #endif