annotate src/lib-index/mail-cache.h @ 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 79790750c349
children 97bb7b127617
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_CACHE_H
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
2 #define __MAIL_CACHE_H
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
3
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
4 #include "mail-index.h"
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
5
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
6 #define MAIL_CACHE_FILE_PREFIX ".cache"
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
7
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
8 #define MAIL_CACHE_HEADERS_COUNT 4
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
9
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
10 struct mail_cache;
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
11 struct mail_cache_view;
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
12 struct mail_cache_transaction_ctx;
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
13
1956
d6941cd8afdc Added support for setting dirty flags for messages (TODO: undirty..)
Timo Sirainen <tss@iki.fi>
parents: 1915
diff changeset
14 enum mail_cache_record_flag {
d6941cd8afdc Added support for setting dirty flags for messages (TODO: undirty..)
Timo Sirainen <tss@iki.fi>
parents: 1915
diff changeset
15 /* If binary flags are set, it's not checked whether mail is
d6941cd8afdc Added support for setting dirty flags for messages (TODO: undirty..)
Timo Sirainen <tss@iki.fi>
parents: 1915
diff changeset
16 missing CRs. So this flag may be set as an optimization for
d6941cd8afdc Added support for setting dirty flags for messages (TODO: undirty..)
Timo Sirainen <tss@iki.fi>
parents: 1915
diff changeset
17 regular non-binary mails as well if it's known that it contains
d6941cd8afdc Added support for setting dirty flags for messages (TODO: undirty..)
Timo Sirainen <tss@iki.fi>
parents: 1915
diff changeset
18 valid CR+LF line breaks. */
d6941cd8afdc Added support for setting dirty flags for messages (TODO: undirty..)
Timo Sirainen <tss@iki.fi>
parents: 1915
diff changeset
19 MAIL_INDEX_FLAG_BINARY_HEADER = 0x0001,
d6941cd8afdc Added support for setting dirty flags for messages (TODO: undirty..)
Timo Sirainen <tss@iki.fi>
parents: 1915
diff changeset
20 MAIL_INDEX_FLAG_BINARY_BODY = 0x0002,
d6941cd8afdc Added support for setting dirty flags for messages (TODO: undirty..)
Timo Sirainen <tss@iki.fi>
parents: 1915
diff changeset
21
d6941cd8afdc Added support for setting dirty flags for messages (TODO: undirty..)
Timo Sirainen <tss@iki.fi>
parents: 1915
diff changeset
22 /* Mail header or body is known to contain NUL characters. */
d6941cd8afdc Added support for setting dirty flags for messages (TODO: undirty..)
Timo Sirainen <tss@iki.fi>
parents: 1915
diff changeset
23 MAIL_INDEX_FLAG_HAS_NULS = 0x0004,
d6941cd8afdc Added support for setting dirty flags for messages (TODO: undirty..)
Timo Sirainen <tss@iki.fi>
parents: 1915
diff changeset
24 /* Mail header or body is known to not contain NUL characters. */
d6941cd8afdc Added support for setting dirty flags for messages (TODO: undirty..)
Timo Sirainen <tss@iki.fi>
parents: 1915
diff changeset
25 MAIL_INDEX_FLAG_HAS_NO_NULS = 0x0008
d6941cd8afdc Added support for setting dirty flags for messages (TODO: undirty..)
Timo Sirainen <tss@iki.fi>
parents: 1915
diff changeset
26 };
d6941cd8afdc Added support for setting dirty flags for messages (TODO: undirty..)
Timo Sirainen <tss@iki.fi>
parents: 1915
diff changeset
27
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
28 enum mail_cache_field {
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
29 /* fixed size fields */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
30 MAIL_CACHE_INDEX_FLAGS = 0x00000001,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
31 MAIL_CACHE_LOCATION_OFFSET = 0x00000002,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
32 MAIL_CACHE_MD5 = 0x00000004,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
33 MAIL_CACHE_SENT_DATE = 0x00000008,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
34 MAIL_CACHE_RECEIVED_DATE = 0x00000010,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
35 MAIL_CACHE_VIRTUAL_FULL_SIZE = 0x00000020,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
36 MAIL_CACHE_PHYSICAL_BODY_SIZE = 0x00000040,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
37
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
38 /* variable sized field */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
39 MAIL_CACHE_HEADERS1 = 0x40000000,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
40 MAIL_CACHE_HEADERS2 = 0x20000000,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
41 MAIL_CACHE_HEADERS3 = 0x10000000,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
42 MAIL_CACHE_HEADERS4 = 0x08000000,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
43 MAIL_CACHE_LOCATION = 0x04000000,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
44 MAIL_CACHE_BODY = 0x02000000,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
45 MAIL_CACHE_BODYSTRUCTURE = 0x01000000,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
46 MAIL_CACHE_ENVELOPE = 0x00800000,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
47 MAIL_CACHE_MESSAGEPART = 0x00400000,
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 MAIL_CACHE_FIXED_MASK = MAIL_CACHE_INDEX_FLAGS |
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
50 MAIL_CACHE_LOCATION_OFFSET |
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
51 MAIL_CACHE_MD5 |
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
52 MAIL_CACHE_SENT_DATE |
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
53 MAIL_CACHE_RECEIVED_DATE |
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
54 MAIL_CACHE_VIRTUAL_FULL_SIZE |
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
55 MAIL_CACHE_PHYSICAL_BODY_SIZE,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
56 MAIL_CACHE_HEADERS_MASK = MAIL_CACHE_HEADERS1 |
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
57 MAIL_CACHE_HEADERS2 |
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
58 MAIL_CACHE_HEADERS3 |
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
59 MAIL_CACHE_HEADERS4,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
60 MAIL_CACHE_STRING_MASK = MAIL_CACHE_HEADERS_MASK |
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
61 MAIL_CACHE_LOCATION |
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
62 MAIL_CACHE_BODY |
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
63 MAIL_CACHE_BODYSTRUCTURE |
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
64 MAIL_CACHE_ENVELOPE,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
65 MAIL_CACHE_BODYSTRUCTURE_MASK = MAIL_CACHE_BODY |
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
66 MAIL_CACHE_BODYSTRUCTURE |
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
67 MAIL_CACHE_MESSAGEPART
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
68 };
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
69
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
70 struct mail_sent_date {
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
71 time_t time;
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
72 int32_t timezone;
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
73 };
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
74
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
75 extern enum mail_cache_field mail_cache_header_fields[MAIL_CACHE_HEADERS_COUNT];
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
76
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
77 int mail_cache_open_or_create(struct mail_index *index);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
78 void mail_cache_free(struct mail_cache *cache);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
79
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
80 void mail_cache_set_defaults(struct mail_cache *cache,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
81 enum mail_cache_field default_cache_fields,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
82 enum mail_cache_field never_cache_fields);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
83
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
84 /* Compress cache file. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
85 int mail_cache_compress(struct mail_cache *cache);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
86
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
87 /* Reset the cache file, clearing all data. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
88 int mail_cache_reset(struct mail_cache *cache);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
89
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
90 /* Explicitly lock the cache file. Returns 1 if ok, 0 if nonblock is TRUE and
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
91 we couldn't immediately get a lock, or -1 if error. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
92 int mail_cache_lock(struct mail_cache *cache, int nonblock);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
93 int mail_cache_unlock(struct mail_cache *cache);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
94
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
95 /* Returns TRUE if cache file is locked. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
96 int mail_cache_is_locked(struct mail_cache *cache);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
97
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
98 struct mail_cache_view *
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
99 mail_cache_view_open(struct mail_cache *cache, struct mail_index_view *iview);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
100 void mail_cache_view_close(struct mail_cache_view *view);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
101
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
102 /* Begin transaction. Cache transaction may be committed or rollbacked multiple
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
103 times. It will finish when index transaction is committed or rollbacked.
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
104 The transaction might also be partially committed automatically, so this
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
105 is kind of fake transaction, it's only purpose being optimizing writes.
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
106 Returns same as mail_cache_lock(). */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
107 int mail_cache_transaction_begin(struct mail_cache_view *view, int nonblock,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
108 struct mail_index_transaction *t,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
109 struct mail_cache_transaction_ctx **ctx_r);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
110 int mail_cache_transaction_commit(struct mail_cache_transaction_ctx *ctx);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
111 void mail_cache_transaction_rollback(struct mail_cache_transaction_ctx *ctx);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
112
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
113 /* Should be called only by mail_transaction_commit/rollback: */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
114 int mail_cache_transaction_end(struct mail_cache_transaction_ctx *ctx);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
115
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
116 /* Return NULL-terminated list of headers for given index, or NULL if
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
117 header index isn't used. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
118 const char *const *mail_cache_get_header_fields(struct mail_cache_view *view,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
119 unsigned int idx);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
120 /* Set list of headers for given index. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
121 int mail_cache_set_header_fields(struct mail_cache_transaction_ctx *ctx,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
122 unsigned int idx, const char *const headers[]);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
123
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
124 /* Add new field to given record. Updates are not allowed. Fixed size fields
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
125 must be exactly the expected size and they're converted to network byte
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
126 order in disk. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
127 int mail_cache_add(struct mail_cache_transaction_ctx *ctx, uint32_t seq,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
128 enum mail_cache_field field,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
129 const void *data, size_t data_size);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
130
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
131 /* Mark the given record deleted. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
132 int mail_cache_delete(struct mail_cache_transaction_ctx *ctx, uint32_t seq);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
133
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
134 /* Return all fields that are currently cached for record. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
135 enum mail_cache_field
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
136 mail_cache_get_fields(struct mail_cache_view *view, uint32_t seq);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
137
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
138 /* Set data_r and size_r to point to wanted field in cache file.
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
139 Returns TRUE if field was found. If field contains multiple fields,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
140 first one found is returned. This is mostly useful for finding headers. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
141 int mail_cache_lookup_field(struct mail_cache_view *view, uint32_t seq,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
142 enum mail_cache_field field,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
143 const void **data_r, size_t *size_r);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
144
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
145 /* Return string field. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
146 const char *
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
147 mail_cache_lookup_string_field(struct mail_cache_view *view, uint32_t seq,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
148 enum mail_cache_field field);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
149
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
150 /* Copy fixed size field to given buffer. buffer_size must be exactly the
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
151 expected size. The result will be converted to host byte order.
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
152 Returns TRUE if field was found. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
153 int mail_cache_copy_fixed_field(struct mail_cache_view *view, uint32_t seq,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
154 enum mail_cache_field field,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
155 void *buffer, size_t buffer_size);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
156
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
157 /* Mark given fields as missing, ie. they should be cached when possible. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
158 void mail_cache_mark_missing(struct mail_cache_view *view,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
159 enum mail_cache_field fields);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
160
1956
d6941cd8afdc Added support for setting dirty flags for messages (TODO: undirty..)
Timo Sirainen <tss@iki.fi>
parents: 1915
diff changeset
161 /* Return record flags. */
d6941cd8afdc Added support for setting dirty flags for messages (TODO: undirty..)
Timo Sirainen <tss@iki.fi>
parents: 1915
diff changeset
162 enum mail_cache_record_flag
d6941cd8afdc Added support for setting dirty flags for messages (TODO: undirty..)
Timo Sirainen <tss@iki.fi>
parents: 1915
diff changeset
163 mail_cache_get_record_flags(struct mail_cache_view *view, uint32_t seq);
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
164
1956
d6941cd8afdc Added support for setting dirty flags for messages (TODO: undirty..)
Timo Sirainen <tss@iki.fi>
parents: 1915
diff changeset
165 /* Update record flags. The cache file must be locked and the flags must be
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
166 already inserted to the record. */
1956
d6941cd8afdc Added support for setting dirty flags for messages (TODO: undirty..)
Timo Sirainen <tss@iki.fi>
parents: 1915
diff changeset
167 int mail_cache_update_record_flags(struct mail_cache_view *view, uint32_t seq,
d6941cd8afdc Added support for setting dirty flags for messages (TODO: undirty..)
Timo Sirainen <tss@iki.fi>
parents: 1915
diff changeset
168 enum mail_cache_record_flag flags);
1915
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
169
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
170 /* Update location offset. External locking is assumed to take care of locking
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
171 readers out to prevent race conditions. */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
172 int mail_cache_update_location_offset(struct mail_cache_view *view,
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
173 uint32_t seq, uoff_t offset);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
174
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
175 /* "Error in index cache file %s: ...". */
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
176 void mail_cache_set_corrupted(struct mail_cache *cache, const char *fmt, ...)
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
177 __attr_format__(2, 3);
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
178
79790750c349 importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
179 #endif