Mercurial > dovecot > core-2.2
annotate src/lib-index/mail-cache-private.h @ 22611:65ada9976a7f
lib-index: Add mail_index_cache_optimization_settings
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Mon, 09 Oct 2017 15:37:51 +0300 |
parents | 7ae75b9c0a23 |
children | 105a2e1fd770 |
rev | line source |
---|---|
6410
e4eb71ae8e96
Changed .h ifdef/defines to use <NAME>_H format.
Timo Sirainen <tss@iki.fi>
parents:
6296
diff
changeset
|
1 #ifndef MAIL_CACHE_PRIVATE_H |
e4eb71ae8e96
Changed .h ifdef/defines to use <NAME>_H format.
Timo Sirainen <tss@iki.fi>
parents:
6296
diff
changeset
|
2 #define MAIL_CACHE_PRIVATE_H |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
3 |
3106 | 4 #include "file-dotlock.h" |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
5 #include "mail-index-private.h" |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
6 #include "mail-cache.h" |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
7 |
15373
8323e81785e2
lib-index: Added minor version to dovecot.index.cache file header.
Timo Sirainen <tss@iki.fi>
parents:
15372
diff
changeset
|
8 #define MAIL_CACHE_MAJOR_VERSION 1 |
8323e81785e2
lib-index: Added minor version to dovecot.index.cache file header.
Timo Sirainen <tss@iki.fi>
parents:
15372
diff
changeset
|
9 #define MAIL_CACHE_MINOR_VERSION 1 |
2276
5f374049abdb
Caching fixes and optimizations. Removed all network byte ordering code -
Timo Sirainen <tss@iki.fi>
parents:
2275
diff
changeset
|
10 |
8190
9902de77194e
Mail cache: If locking failed, the next time try to lock it only once.
Timo Sirainen <tss@iki.fi>
parents:
8188
diff
changeset
|
11 #define MAIL_CACHE_LOCK_TIMEOUT 10 |
8182
4bfe2c1c375f
Mail cache file: Changed lock timeout to just 2 seconds.
Timo Sirainen <tss@iki.fi>
parents:
8181
diff
changeset
|
12 #define MAIL_CACHE_LOCK_CHANGE_TIMEOUT 300 |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
13 |
2275
c68a3c9f6d73
Cache file compression works now and compressed cache file is reopened.
Timo Sirainen <tss@iki.fi>
parents:
2247
diff
changeset
|
14 #define MAIL_CACHE_IS_UNUSABLE(cache) \ |
c68a3c9f6d73
Cache file compression works now and compressed cache file is reopened.
Timo Sirainen <tss@iki.fi>
parents:
2247
diff
changeset
|
15 ((cache)->hdr == NULL) |
c68a3c9f6d73
Cache file compression works now and compressed cache file is reopened.
Timo Sirainen <tss@iki.fi>
parents:
2247
diff
changeset
|
16 |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
17 struct mail_cache_header { |
2276
5f374049abdb
Caching fixes and optimizations. Removed all network byte ordering code -
Timo Sirainen <tss@iki.fi>
parents:
2275
diff
changeset
|
18 /* version is increased only when you can't have backwards |
5f374049abdb
Caching fixes and optimizations. Removed all network byte ordering code -
Timo Sirainen <tss@iki.fi>
parents:
2275
diff
changeset
|
19 compatibility. */ |
15373
8323e81785e2
lib-index: Added minor version to dovecot.index.cache file header.
Timo Sirainen <tss@iki.fi>
parents:
15372
diff
changeset
|
20 uint8_t major_version; |
3819
61f0e1fe9b55
Moved uoff_t and time_t compatibility checks to cache file, since they're
Timo Sirainen <tss@iki.fi>
parents:
3627
diff
changeset
|
21 uint8_t compat_sizeof_uoff_t; |
15527
55e84bb452e6
lib-index: Added v2.2+ forwards compatibility to dovecot.index.cache
Timo Sirainen <tss@iki.fi>
parents:
15313
diff
changeset
|
22 uint8_t minor_version; |
55e84bb452e6
lib-index: Added v2.2+ forwards compatibility to dovecot.index.cache
Timo Sirainen <tss@iki.fi>
parents:
15313
diff
changeset
|
23 uint8_t unused; |
2276
5f374049abdb
Caching fixes and optimizations. Removed all network byte ordering code -
Timo Sirainen <tss@iki.fi>
parents:
2275
diff
changeset
|
24 |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
25 uint32_t indexid; |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
26 uint32_t file_seq; |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
27 |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
28 uint32_t continued_record_count; |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
29 |
15374
debecd057f9c
lib-index: Replaced cache's deleted_space with deleted_record_count.
Timo Sirainen <tss@iki.fi>
parents:
15373
diff
changeset
|
30 /* NOTE: old versions used this for hole offset, so we can't fully |
debecd057f9c
lib-index: Replaced cache's deleted_space with deleted_record_count.
Timo Sirainen <tss@iki.fi>
parents:
15373
diff
changeset
|
31 rely on it */ |
debecd057f9c
lib-index: Replaced cache's deleted_space with deleted_record_count.
Timo Sirainen <tss@iki.fi>
parents:
15373
diff
changeset
|
32 uint32_t record_count; |
15190
60c4815778fb
lib-index: Simplified writing to dovecot.index.cache file.
Timo Sirainen <tss@iki.fi>
parents:
14923
diff
changeset
|
33 uint32_t backwards_compat_used_file_size; |
15374
debecd057f9c
lib-index: Replaced cache's deleted_space with deleted_record_count.
Timo Sirainen <tss@iki.fi>
parents:
15373
diff
changeset
|
34 uint32_t deleted_record_count; |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
35 |
2327
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
36 uint32_t field_header_offset; |
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
37 }; |
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
38 |
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
39 struct mail_cache_header_fields { |
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
40 uint32_t next_offset; |
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
41 uint32_t size; |
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
42 uint32_t fields_count; |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
43 |
2327
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
44 #if 0 |
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
45 /* last time the field was accessed. not updated more often than |
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
46 once a day. */ |
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
47 uint32_t last_used[fields_count]; |
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
48 /* (uint32_t)-1 for variable sized fields */ |
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
49 uint32_t size[fields_count]; |
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
50 /* enum mail_cache_field_type */ |
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
51 uint8_t type[fields_count]; |
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
52 /* enum mail_cache_decision_type */ |
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
53 uint8_t decision[fields_count]; |
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
54 /* NUL-separated list of field names */ |
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
55 char name[fields_count][]; |
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
56 #endif |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
57 }; |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
58 |
2339
406692edc12d
Cache fixes. Decisions are saved again.
Timo Sirainen <tss@iki.fi>
parents:
2327
diff
changeset
|
59 #define MAIL_CACHE_FIELD_LAST_USED() \ |
406692edc12d
Cache fixes. Decisions are saved again.
Timo Sirainen <tss@iki.fi>
parents:
2327
diff
changeset
|
60 (sizeof(uint32_t) * 3) |
406692edc12d
Cache fixes. Decisions are saved again.
Timo Sirainen <tss@iki.fi>
parents:
2327
diff
changeset
|
61 #define MAIL_CACHE_FIELD_SIZE(count) \ |
406692edc12d
Cache fixes. Decisions are saved again.
Timo Sirainen <tss@iki.fi>
parents:
2327
diff
changeset
|
62 (MAIL_CACHE_FIELD_LAST_USED() + sizeof(uint32_t) * (count)) |
406692edc12d
Cache fixes. Decisions are saved again.
Timo Sirainen <tss@iki.fi>
parents:
2327
diff
changeset
|
63 #define MAIL_CACHE_FIELD_TYPE(count) \ |
406692edc12d
Cache fixes. Decisions are saved again.
Timo Sirainen <tss@iki.fi>
parents:
2327
diff
changeset
|
64 (MAIL_CACHE_FIELD_SIZE(count) + sizeof(uint32_t) * (count)) |
406692edc12d
Cache fixes. Decisions are saved again.
Timo Sirainen <tss@iki.fi>
parents:
2327
diff
changeset
|
65 #define MAIL_CACHE_FIELD_DECISION(count) \ |
406692edc12d
Cache fixes. Decisions are saved again.
Timo Sirainen <tss@iki.fi>
parents:
2327
diff
changeset
|
66 (MAIL_CACHE_FIELD_TYPE(count) + sizeof(uint8_t) * (count)) |
406692edc12d
Cache fixes. Decisions are saved again.
Timo Sirainen <tss@iki.fi>
parents:
2327
diff
changeset
|
67 #define MAIL_CACHE_FIELD_NAMES(count) \ |
406692edc12d
Cache fixes. Decisions are saved again.
Timo Sirainen <tss@iki.fi>
parents:
2327
diff
changeset
|
68 (MAIL_CACHE_FIELD_DECISION(count) + sizeof(uint8_t) * (count)) |
2327
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
69 |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
70 struct mail_cache_record { |
2276
5f374049abdb
Caching fixes and optimizations. Removed all network byte ordering code -
Timo Sirainen <tss@iki.fi>
parents:
2275
diff
changeset
|
71 uint32_t prev_offset; |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
72 uint32_t size; /* full record size, including this header */ |
2298
5beb0c20b6e8
Cache file fixes, API changes, etc. It's still in somewhat ugly state, but
Timo Sirainen <tss@iki.fi>
parents:
2277
diff
changeset
|
73 /* array of { uint32_t field; [ uint32_t size; ] { .. } } */ |
1915
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 |
2339
406692edc12d
Cache fixes. Decisions are saved again.
Timo Sirainen <tss@iki.fi>
parents:
2327
diff
changeset
|
76 struct mail_cache_field_private { |
406692edc12d
Cache fixes. Decisions are saved again.
Timo Sirainen <tss@iki.fi>
parents:
2327
diff
changeset
|
77 struct mail_cache_field field; |
406692edc12d
Cache fixes. Decisions are saved again.
Timo Sirainen <tss@iki.fi>
parents:
2327
diff
changeset
|
78 |
406692edc12d
Cache fixes. Decisions are saved again.
Timo Sirainen <tss@iki.fi>
parents:
2327
diff
changeset
|
79 uint32_t uid_highwater; |
406692edc12d
Cache fixes. Decisions are saved again.
Timo Sirainen <tss@iki.fi>
parents:
2327
diff
changeset
|
80 |
6296
205ee38f10d1
Drop fields that haven't been used for 30 days when compressing.
Timo Sirainen <tss@iki.fi>
parents:
6005
diff
changeset
|
81 /* Unused fields aren't written to cache file */ |
205ee38f10d1
Drop fields that haven't been used for 30 days when compressing.
Timo Sirainen <tss@iki.fi>
parents:
6005
diff
changeset
|
82 unsigned int used:1; |
7105
f0ad529ac9ea
Fixes to handling when fields are dropped from cache file.
Timo Sirainen <tss@iki.fi>
parents:
7076
diff
changeset
|
83 unsigned int adding:1; |
2339
406692edc12d
Cache fixes. Decisions are saved again.
Timo Sirainen <tss@iki.fi>
parents:
2327
diff
changeset
|
84 unsigned int decision_dirty:1; |
406692edc12d
Cache fixes. Decisions are saved again.
Timo Sirainen <tss@iki.fi>
parents:
2327
diff
changeset
|
85 }; |
406692edc12d
Cache fixes. Decisions are saved again.
Timo Sirainen <tss@iki.fi>
parents:
2327
diff
changeset
|
86 |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
87 struct mail_cache { |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
88 struct mail_index *index; |
2853
512dd7d76cdc
Removed cache_offset from mail_index_record and changed it to use extension
Timo Sirainen <tss@iki.fi>
parents:
2632
diff
changeset
|
89 uint32_t ext_id; |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
90 |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
91 char *filepath; |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
92 int fd; |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
93 |
6815
c991d1b132d8
Fixed cache file's NFS attribute cache flushing.
Timo Sirainen <tss@iki.fi>
parents:
6705
diff
changeset
|
94 ino_t st_ino; |
c991d1b132d8
Fixed cache file's NFS attribute cache flushing.
Timo Sirainen <tss@iki.fi>
parents:
6705
diff
changeset
|
95 dev_t st_dev; |
c991d1b132d8
Fixed cache file's NFS attribute cache flushing.
Timo Sirainen <tss@iki.fi>
parents:
6705
diff
changeset
|
96 |
21186
34074cc72a15
lib-index: Limit mmap errors in index cache to 1/s
Aki Tuomi <aki.tuomi@dovecot.fi>
parents:
17902
diff
changeset
|
97 time_t last_mmap_error_time; |
34074cc72a15
lib-index: Limit mmap errors in index cache to 1/s
Aki Tuomi <aki.tuomi@dovecot.fi>
parents:
17902
diff
changeset
|
98 |
15313
51f2be9aa8ad
lib-index: Added MAIL_INDEX_OPEN_FLAG_SAVEONLY to do only minimal reads from cache file.
Timo Sirainen <tss@iki.fi>
parents:
15312
diff
changeset
|
99 size_t mmap_length; |
51f2be9aa8ad
lib-index: Added MAIL_INDEX_OPEN_FLAG_SAVEONLY to do only minimal reads from cache file.
Timo Sirainen <tss@iki.fi>
parents:
15312
diff
changeset
|
100 /* a) mmaping the whole file */ |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
101 void *mmap_base; |
15313
51f2be9aa8ad
lib-index: Added MAIL_INDEX_OPEN_FLAG_SAVEONLY to do only minimal reads from cache file.
Timo Sirainen <tss@iki.fi>
parents:
15312
diff
changeset
|
102 /* b) using file cache */ |
2866
bf1e718e7370
Cache file works now with mmap_disable=yes. Still needs a few optimizations.
Timo Sirainen <tss@iki.fi>
parents:
2853
diff
changeset
|
103 struct file_cache *file_cache; |
15313
51f2be9aa8ad
lib-index: Added MAIL_INDEX_OPEN_FLAG_SAVEONLY to do only minimal reads from cache file.
Timo Sirainen <tss@iki.fi>
parents:
15312
diff
changeset
|
104 /* c) using small read() calls with MAIL_INDEX_OPEN_FLAG_SAVEONLY */ |
51f2be9aa8ad
lib-index: Added MAIL_INDEX_OPEN_FLAG_SAVEONLY to do only minimal reads from cache file.
Timo Sirainen <tss@iki.fi>
parents:
15312
diff
changeset
|
105 uoff_t read_offset; |
51f2be9aa8ad
lib-index: Added MAIL_INDEX_OPEN_FLAG_SAVEONLY to do only minimal reads from cache file.
Timo Sirainen <tss@iki.fi>
parents:
15312
diff
changeset
|
106 buffer_t *read_buf; |
5736
b3ed52bbeca7
Changed mail_cache_foreach() to be an iterator: mail_cache_lookup_iter_*()
Timo Sirainen <tss@iki.fi>
parents:
5734
diff
changeset
|
107 /* mail_cache_map() increases this always. */ |
b3ed52bbeca7
Changed mail_cache_foreach() to be an iterator: mail_cache_lookup_iter_*()
Timo Sirainen <tss@iki.fi>
parents:
5734
diff
changeset
|
108 unsigned int remap_counter; |
3106 | 109 |
110 struct dotlock_settings dotlock_settings; | |
111 struct dotlock *dotlock; | |
4876
f1d77064884c
Lock handling changes. Everything goes through file-lock API now and there's
Timo Sirainen <tss@iki.fi>
parents:
4657
diff
changeset
|
112 struct file_lock *file_lock; |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
113 |
6703
75c48f171ad3
Keep a separate copy of mail_cache_header when mmap_disable=yes, otherwise
Timo Sirainen <tss@iki.fi>
parents:
6695
diff
changeset
|
114 /* mmap_disable=no: hdr points to data / NULL when cache is invalid. |
75c48f171ad3
Keep a separate copy of mail_cache_header when mmap_disable=yes, otherwise
Timo Sirainen <tss@iki.fi>
parents:
6695
diff
changeset
|
115 mmap_disable=yes: hdr points to hdr_ro_copy. this is needed because |
75c48f171ad3
Keep a separate copy of mail_cache_header when mmap_disable=yes, otherwise
Timo Sirainen <tss@iki.fi>
parents:
6695
diff
changeset
|
116 cache invalidation can zero the data any time */ |
2277
41e56f28d085
Cache updating is done now by first reserving space where to write, and then
Timo Sirainen <tss@iki.fi>
parents:
2276
diff
changeset
|
117 const struct mail_cache_header *hdr; |
6703
75c48f171ad3
Keep a separate copy of mail_cache_header when mmap_disable=yes, otherwise
Timo Sirainen <tss@iki.fi>
parents:
6695
diff
changeset
|
118 struct mail_cache_header hdr_ro_copy; |
75c48f171ad3
Keep a separate copy of mail_cache_header when mmap_disable=yes, otherwise
Timo Sirainen <tss@iki.fi>
parents:
6695
diff
changeset
|
119 /* hdr_copy gets updated when cache is locked and written when |
75c48f171ad3
Keep a separate copy of mail_cache_header when mmap_disable=yes, otherwise
Timo Sirainen <tss@iki.fi>
parents:
6695
diff
changeset
|
120 unlocking and hdr_modified=TRUE */ |
2277
41e56f28d085
Cache updating is done now by first reserving space where to write, and then
Timo Sirainen <tss@iki.fi>
parents:
2276
diff
changeset
|
121 struct mail_cache_header hdr_copy; |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
122 |
2327
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
123 pool_t field_pool; |
2339
406692edc12d
Cache fixes. Decisions are saved again.
Timo Sirainen <tss@iki.fi>
parents:
2327
diff
changeset
|
124 struct mail_cache_field_private *fields; |
2327
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
125 uint32_t *field_file_map; |
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
126 unsigned int fields_count; |
14923
96fd2c3bf932
Reverted "support for non-pointers" part of the hash table API changes.
Timo Sirainen <tss@iki.fi>
parents:
14918
diff
changeset
|
127 HASH_TABLE(char *, void *) field_name_hash; /* name -> idx */ |
6705
68bb5bec043e
When reading the latest fields, begin finding the fields from the last known
Timo Sirainen <tss@iki.fi>
parents:
6703
diff
changeset
|
128 uint32_t last_field_header_offset; |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
129 |
4247
9c3f19110538
Don't compress cache file if it was just compressed by another process.
Timo Sirainen <tss@iki.fi>
parents:
3981
diff
changeset
|
130 /* 0 is no need for compression, otherwise the file sequence number |
9c3f19110538
Don't compress cache file if it was just compressed by another process.
Timo Sirainen <tss@iki.fi>
parents:
3981
diff
changeset
|
131 which we want compressed. */ |
9c3f19110538
Don't compress cache file if it was just compressed by another process.
Timo Sirainen <tss@iki.fi>
parents:
3981
diff
changeset
|
132 uint32_t need_compress_file_seq; |
9c3f19110538
Don't compress cache file if it was just compressed by another process.
Timo Sirainen <tss@iki.fi>
parents:
3981
diff
changeset
|
133 |
2327
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
134 unsigned int *file_field_map; |
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
135 unsigned int file_fields_count; |
2247
2d51bb58a070
Added some smartness for deciding what to cache. Cache compression code compiles, but untested.
Timo Sirainen <tss@iki.fi>
parents:
2201
diff
changeset
|
136 |
4655
df8de2e47fb5
Delay opening the cache file until it's actually needed.
Timo Sirainen <tss@iki.fi>
parents:
4490
diff
changeset
|
137 unsigned int opened:1; |
2277
41e56f28d085
Cache updating is done now by first reserving space where to write, and then
Timo Sirainen <tss@iki.fi>
parents:
2276
diff
changeset
|
138 unsigned int locked:1; |
8190
9902de77194e
Mail cache: If locking failed, the next time try to lock it only once.
Timo Sirainen <tss@iki.fi>
parents:
8188
diff
changeset
|
139 unsigned int last_lock_failed:1; |
2277
41e56f28d085
Cache updating is done now by first reserving space where to write, and then
Timo Sirainen <tss@iki.fi>
parents:
2276
diff
changeset
|
140 unsigned int hdr_modified:1; |
2327
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
141 unsigned int field_header_write_pending:1; |
8187
f1203dce2d8c
Mail cache: lock_method=dotlock could have caused a process to deadlock with itself.
Timo Sirainen <tss@iki.fi>
parents:
8182
diff
changeset
|
142 unsigned int compressing:1; |
15313
51f2be9aa8ad
lib-index: Added MAIL_INDEX_OPEN_FLAG_SAVEONLY to do only minimal reads from cache file.
Timo Sirainen <tss@iki.fi>
parents:
15312
diff
changeset
|
143 unsigned int map_with_read:1; |
1915
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 |
7312
6f59434cf229
Optimized cache record loop tracking.
Timo Sirainen <tss@iki.fi>
parents:
7138
diff
changeset
|
146 struct mail_cache_loop_track { |
6f59434cf229
Optimized cache record loop tracking.
Timo Sirainen <tss@iki.fi>
parents:
7138
diff
changeset
|
147 /* we're looping if size_sum > (max_offset-min_offset) */ |
6f59434cf229
Optimized cache record loop tracking.
Timo Sirainen <tss@iki.fi>
parents:
7138
diff
changeset
|
148 uoff_t min_offset, max_offset; |
6f59434cf229
Optimized cache record loop tracking.
Timo Sirainen <tss@iki.fi>
parents:
7138
diff
changeset
|
149 uoff_t size_sum; |
6f59434cf229
Optimized cache record loop tracking.
Timo Sirainen <tss@iki.fi>
parents:
7138
diff
changeset
|
150 }; |
6f59434cf229
Optimized cache record loop tracking.
Timo Sirainen <tss@iki.fi>
parents:
7138
diff
changeset
|
151 |
22130
39df47bebbe7
lib-index: Add cache to mail_cache_get_missing_reason()
Timo Sirainen <timo.sirainen@dovecot.fi>
parents:
22037
diff
changeset
|
152 struct mail_cache_missing_reason_cache { |
39df47bebbe7
lib-index: Add cache to mail_cache_get_missing_reason()
Timo Sirainen <timo.sirainen@dovecot.fi>
parents:
22037
diff
changeset
|
153 uint32_t highest_checked_seq; |
39df47bebbe7
lib-index: Add cache to mail_cache_get_missing_reason()
Timo Sirainen <timo.sirainen@dovecot.fi>
parents:
22037
diff
changeset
|
154 uint32_t highest_seq_with_cache; |
39df47bebbe7
lib-index: Add cache to mail_cache_get_missing_reason()
Timo Sirainen <timo.sirainen@dovecot.fi>
parents:
22037
diff
changeset
|
155 |
22132
7ae75b9c0a23
lib-index: Fix reset_id handling in mail_cache_get_missing_reason() cache
Timo Sirainen <timo.sirainen@dovecot.fi>
parents:
22130
diff
changeset
|
156 uint32_t reset_id; |
22130
39df47bebbe7
lib-index: Add cache to mail_cache_get_missing_reason()
Timo Sirainen <timo.sirainen@dovecot.fi>
parents:
22037
diff
changeset
|
157 uint32_t log_file_head_seq; |
39df47bebbe7
lib-index: Add cache to mail_cache_get_missing_reason()
Timo Sirainen <timo.sirainen@dovecot.fi>
parents:
22037
diff
changeset
|
158 uoff_t log_file_head_offset; |
39df47bebbe7
lib-index: Add cache to mail_cache_get_missing_reason()
Timo Sirainen <timo.sirainen@dovecot.fi>
parents:
22037
diff
changeset
|
159 }; |
39df47bebbe7
lib-index: Add cache to mail_cache_get_missing_reason()
Timo Sirainen <timo.sirainen@dovecot.fi>
parents:
22037
diff
changeset
|
160 |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
161 struct mail_cache_view { |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
162 struct mail_cache *cache; |
2853
512dd7d76cdc
Removed cache_offset from mail_index_record and changed it to use extension
Timo Sirainen <tss@iki.fi>
parents:
2632
diff
changeset
|
163 struct mail_index_view *view, *trans_view; |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
164 |
2298
5beb0c20b6e8
Cache file fixes, API changes, etc. It's still in somewhat ugly state, but
Timo Sirainen <tss@iki.fi>
parents:
2277
diff
changeset
|
165 struct mail_cache_transaction_ctx *transaction; |
2315
22210d6cf238
Cache fixes. Lookups now look into transactions too.
Timo Sirainen <tss@iki.fi>
parents:
2298
diff
changeset
|
166 uint32_t trans_seq1, trans_seq2; |
22210d6cf238
Cache fixes. Lookups now look into transactions too.
Timo Sirainen <tss@iki.fi>
parents:
2298
diff
changeset
|
167 |
7312
6f59434cf229
Optimized cache record loop tracking.
Timo Sirainen <tss@iki.fi>
parents:
7138
diff
changeset
|
168 struct mail_cache_loop_track loop_track; |
22130
39df47bebbe7
lib-index: Add cache to mail_cache_get_missing_reason()
Timo Sirainen <timo.sirainen@dovecot.fi>
parents:
22037
diff
changeset
|
169 struct mail_cache_missing_reason_cache reason_cache; |
2632
ec5601f71ba0
Fix for circular record list detection, we can't use data stack for buffer.
Timo Sirainen <tss@iki.fi>
parents:
2619
diff
changeset
|
170 |
2327
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
171 /* if cached_exists_buf[field] == cached_exists_value, it's cached. |
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
172 this allows us to avoid constantly clearing the whole buffer. |
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
173 it needs to be cleared only when cached_exists_value is wrapped. */ |
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
174 buffer_t *cached_exists_buf; |
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
175 uint8_t cached_exists_value; |
2298
5beb0c20b6e8
Cache file fixes, API changes, etc. It's still in somewhat ugly state, but
Timo Sirainen <tss@iki.fi>
parents:
2277
diff
changeset
|
176 uint32_t cached_exists_seq; |
13328
4a19aea565f7
lib-index: Added mail_cache_view_update_cache_decisions()
Timo Sirainen <tss@iki.fi>
parents:
8190
diff
changeset
|
177 |
4a19aea565f7
lib-index: Added mail_cache_view_update_cache_decisions()
Timo Sirainen <tss@iki.fi>
parents:
8190
diff
changeset
|
178 unsigned int no_decision_updates:1; |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
179 }; |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
180 |
5736
b3ed52bbeca7
Changed mail_cache_foreach() to be an iterator: mail_cache_lookup_iter_*()
Timo Sirainen <tss@iki.fi>
parents:
5734
diff
changeset
|
181 struct mail_cache_iterate_field { |
b3ed52bbeca7
Changed mail_cache_foreach() to be an iterator: mail_cache_lookup_iter_*()
Timo Sirainen <tss@iki.fi>
parents:
5734
diff
changeset
|
182 unsigned int field_idx; |
15312
0d1de37ad9d8
lib-index: Code cleanup: Removed mail_cache.data
Timo Sirainen <tss@iki.fi>
parents:
15311
diff
changeset
|
183 unsigned int size; |
5736
b3ed52bbeca7
Changed mail_cache_foreach() to be an iterator: mail_cache_lookup_iter_*()
Timo Sirainen <tss@iki.fi>
parents:
5734
diff
changeset
|
184 const void *data; |
15312
0d1de37ad9d8
lib-index: Code cleanup: Removed mail_cache.data
Timo Sirainen <tss@iki.fi>
parents:
15311
diff
changeset
|
185 uoff_t offset; |
5736
b3ed52bbeca7
Changed mail_cache_foreach() to be an iterator: mail_cache_lookup_iter_*()
Timo Sirainen <tss@iki.fi>
parents:
5734
diff
changeset
|
186 }; |
b3ed52bbeca7
Changed mail_cache_foreach() to be an iterator: mail_cache_lookup_iter_*()
Timo Sirainen <tss@iki.fi>
parents:
5734
diff
changeset
|
187 |
b3ed52bbeca7
Changed mail_cache_foreach() to be an iterator: mail_cache_lookup_iter_*()
Timo Sirainen <tss@iki.fi>
parents:
5734
diff
changeset
|
188 struct mail_cache_lookup_iterate_ctx { |
b3ed52bbeca7
Changed mail_cache_foreach() to be an iterator: mail_cache_lookup_iter_*()
Timo Sirainen <tss@iki.fi>
parents:
5734
diff
changeset
|
189 struct mail_cache_view *view; |
b3ed52bbeca7
Changed mail_cache_foreach() to be an iterator: mail_cache_lookup_iter_*()
Timo Sirainen <tss@iki.fi>
parents:
5734
diff
changeset
|
190 unsigned int remap_counter; |
b3ed52bbeca7
Changed mail_cache_foreach() to be an iterator: mail_cache_lookup_iter_*()
Timo Sirainen <tss@iki.fi>
parents:
5734
diff
changeset
|
191 uint32_t seq; |
b3ed52bbeca7
Changed mail_cache_foreach() to be an iterator: mail_cache_lookup_iter_*()
Timo Sirainen <tss@iki.fi>
parents:
5734
diff
changeset
|
192 |
b3ed52bbeca7
Changed mail_cache_foreach() to be an iterator: mail_cache_lookup_iter_*()
Timo Sirainen <tss@iki.fi>
parents:
5734
diff
changeset
|
193 const struct mail_cache_record *rec; |
b3ed52bbeca7
Changed mail_cache_foreach() to be an iterator: mail_cache_lookup_iter_*()
Timo Sirainen <tss@iki.fi>
parents:
5734
diff
changeset
|
194 unsigned int pos, rec_size; |
b3ed52bbeca7
Changed mail_cache_foreach() to be an iterator: mail_cache_lookup_iter_*()
Timo Sirainen <tss@iki.fi>
parents:
5734
diff
changeset
|
195 uint32_t offset; |
b3ed52bbeca7
Changed mail_cache_foreach() to be an iterator: mail_cache_lookup_iter_*()
Timo Sirainen <tss@iki.fi>
parents:
5734
diff
changeset
|
196 |
16393
b9a312951881
lib-index: mail_cache_lookup*() can now return fields recently added with mail_cache_add()
Timo Sirainen <tss@iki.fi>
parents:
15578
diff
changeset
|
197 unsigned int trans_next_idx; |
b9a312951881
lib-index: mail_cache_lookup*() can now return fields recently added with mail_cache_add()
Timo Sirainen <tss@iki.fi>
parents:
15578
diff
changeset
|
198 |
6005
7c1e6ea4bfab
mail_cache_lookup_iter_next() returned -1 if entry didn't exist, causing
Timo Sirainen <tss@iki.fi>
parents:
5972
diff
changeset
|
199 unsigned int stop:1; |
5736
b3ed52bbeca7
Changed mail_cache_foreach() to be an iterator: mail_cache_lookup_iter_*()
Timo Sirainen <tss@iki.fi>
parents:
5734
diff
changeset
|
200 unsigned int failed:1; |
16393
b9a312951881
lib-index: mail_cache_lookup*() can now return fields recently added with mail_cache_add()
Timo Sirainen <tss@iki.fi>
parents:
15578
diff
changeset
|
201 unsigned int memory_appends_checked:1; |
b9a312951881
lib-index: mail_cache_lookup*() can now return fields recently added with mail_cache_add()
Timo Sirainen <tss@iki.fi>
parents:
15578
diff
changeset
|
202 unsigned int disk_appends_checked:1; |
5736
b3ed52bbeca7
Changed mail_cache_foreach() to be an iterator: mail_cache_lookup_iter_*()
Timo Sirainen <tss@iki.fi>
parents:
5734
diff
changeset
|
203 }; |
2315
22210d6cf238
Cache fixes. Lookups now look into transactions too.
Timo Sirainen <tss@iki.fi>
parents:
2298
diff
changeset
|
204 |
8181
5c0c674eae1a
mail_cache_lock(): Return -1 if locking times out.
Timo Sirainen <tss@iki.fi>
parents:
7312
diff
changeset
|
205 /* Explicitly lock the cache file. Returns -1 if error / timed out, |
5c0c674eae1a
mail_cache_lock(): Return -1 if locking times out.
Timo Sirainen <tss@iki.fi>
parents:
7312
diff
changeset
|
206 1 if ok, 0 if cache is broken/doesn't exist */ |
17902
8c84b69e7f69
lib-index: mail_cache_lock() partial rewrite.
Timo Sirainen <tss@iki.fi>
parents:
17899
diff
changeset
|
207 int mail_cache_lock(struct mail_cache *cache); |
8188
2db48458d73b
Mail cache compression: If we can't get lock immediately, do it later.
Timo Sirainen <tss@iki.fi>
parents:
8187
diff
changeset
|
208 int mail_cache_try_lock(struct mail_cache *cache); |
3627
c0e35566dd14
Unlocking cache file can also corrupt it since it modifies it. Added a
Timo Sirainen <tss@iki.fi>
parents:
3375
diff
changeset
|
209 /* Returns -1 if cache is / just got corrupted, 0 if ok. */ |
c0e35566dd14
Unlocking cache file can also corrupt it since it modifies it. Added a
Timo Sirainen <tss@iki.fi>
parents:
3375
diff
changeset
|
210 int mail_cache_unlock(struct mail_cache *cache); |
2277
41e56f28d085
Cache updating is done now by first reserving space where to write, and then
Timo Sirainen <tss@iki.fi>
parents:
2276
diff
changeset
|
211 |
3375
9e2abc4c341c
Whenever writing to cache file, also updated file_cache. Fixes problems with
Timo Sirainen <tss@iki.fi>
parents:
3191
diff
changeset
|
212 int mail_cache_write(struct mail_cache *cache, const void *data, size_t size, |
9e2abc4c341c
Whenever writing to cache file, also updated file_cache. Fixes problems with
Timo Sirainen <tss@iki.fi>
parents:
3191
diff
changeset
|
213 uoff_t offset); |
15190
60c4815778fb
lib-index: Simplified writing to dovecot.index.cache file.
Timo Sirainen <tss@iki.fi>
parents:
14923
diff
changeset
|
214 int mail_cache_append(struct mail_cache *cache, const void *data, size_t size, |
15371
67afcb730109
lib-index: Cache record linking is now while writing new records, not later with pwrite().
Timo Sirainen <tss@iki.fi>
parents:
15337
diff
changeset
|
215 uint32_t *offset); |
3375
9e2abc4c341c
Whenever writing to cache file, also updated file_cache. Fixes problems with
Timo Sirainen <tss@iki.fi>
parents:
3191
diff
changeset
|
216 |
2327
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
217 int mail_cache_header_fields_read(struct mail_cache *cache); |
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
218 int mail_cache_header_fields_update(struct mail_cache *cache); |
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
219 void mail_cache_header_fields_get(struct mail_cache *cache, buffer_t *dest); |
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
220 int mail_cache_header_fields_get_next_offset(struct mail_cache *cache, |
7d02e2a7672d
Header caching redesigned. New design allows caching decisions per field, so
Timo Sirainen <tss@iki.fi>
parents:
2315
diff
changeset
|
221 uint32_t *offset_r); |
22037
7d09937dc4ff
lib-index: Add mail_cache_expunge_count
Aki Tuomi <aki.tuomi@dovecot.fi>
parents:
21186
diff
changeset
|
222 void mail_cache_expunge_count(struct mail_cache *cache, unsigned int count); |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
223 |
7138
876c7bca351c
Link cache records together directly when writing the new records, instead
Timo Sirainen <tss@iki.fi>
parents:
7105
diff
changeset
|
224 uint32_t mail_cache_lookup_cur_offset(struct mail_index_view *view, |
876c7bca351c
Link cache records together directly when writing the new records, instead
Timo Sirainen <tss@iki.fi>
parents:
7105
diff
changeset
|
225 uint32_t seq, uint32_t *reset_id_r); |
2917
e657c7874962
Crashfixes for reading corrupted cache files.
Timo Sirainen <tss@iki.fi>
parents:
2866
diff
changeset
|
226 int mail_cache_get_record(struct mail_cache *cache, uint32_t offset, |
e657c7874962
Crashfixes for reading corrupted cache files.
Timo Sirainen <tss@iki.fi>
parents:
2866
diff
changeset
|
227 const struct mail_cache_record **rec_r); |
6841
0c970b3493ac
mail_cache_field_want_add(): Return TRUE for temp fields only if we're
Timo Sirainen <tss@iki.fi>
parents:
6829
diff
changeset
|
228 uint32_t mail_cache_get_first_new_seq(struct mail_index_view *view); |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
229 |
7312
6f59434cf229
Optimized cache record loop tracking.
Timo Sirainen <tss@iki.fi>
parents:
7138
diff
changeset
|
230 /* Returns TRUE if offset..size area has been tracked before. |
6f59434cf229
Optimized cache record loop tracking.
Timo Sirainen <tss@iki.fi>
parents:
7138
diff
changeset
|
231 Returns FALSE if the area may or may not have been tracked before, |
6f59434cf229
Optimized cache record loop tracking.
Timo Sirainen <tss@iki.fi>
parents:
7138
diff
changeset
|
232 but we don't know for sure yet. */ |
6f59434cf229
Optimized cache record loop tracking.
Timo Sirainen <tss@iki.fi>
parents:
7138
diff
changeset
|
233 bool mail_cache_track_loops(struct mail_cache_loop_track *loop_track, |
6f59434cf229
Optimized cache record loop tracking.
Timo Sirainen <tss@iki.fi>
parents:
7138
diff
changeset
|
234 uoff_t offset, uoff_t size); |
5736
b3ed52bbeca7
Changed mail_cache_foreach() to be an iterator: mail_cache_lookup_iter_*()
Timo Sirainen <tss@iki.fi>
parents:
5734
diff
changeset
|
235 |
b3ed52bbeca7
Changed mail_cache_foreach() to be an iterator: mail_cache_lookup_iter_*()
Timo Sirainen <tss@iki.fi>
parents:
5734
diff
changeset
|
236 /* Iterate through a message's cached fields. */ |
b3ed52bbeca7
Changed mail_cache_foreach() to be an iterator: mail_cache_lookup_iter_*()
Timo Sirainen <tss@iki.fi>
parents:
5734
diff
changeset
|
237 void mail_cache_lookup_iter_init(struct mail_cache_view *view, uint32_t seq, |
b3ed52bbeca7
Changed mail_cache_foreach() to be an iterator: mail_cache_lookup_iter_*()
Timo Sirainen <tss@iki.fi>
parents:
5734
diff
changeset
|
238 struct mail_cache_lookup_iterate_ctx *ctx_r); |
b3ed52bbeca7
Changed mail_cache_foreach() to be an iterator: mail_cache_lookup_iter_*()
Timo Sirainen <tss@iki.fi>
parents:
5734
diff
changeset
|
239 /* Returns 1 if field was returned, 0 if end of fields, or -1 if error */ |
b3ed52bbeca7
Changed mail_cache_foreach() to be an iterator: mail_cache_lookup_iter_*()
Timo Sirainen <tss@iki.fi>
parents:
5734
diff
changeset
|
240 int mail_cache_lookup_iter_next(struct mail_cache_lookup_iterate_ctx *ctx, |
b3ed52bbeca7
Changed mail_cache_foreach() to be an iterator: mail_cache_lookup_iter_*()
Timo Sirainen <tss@iki.fi>
parents:
5734
diff
changeset
|
241 struct mail_cache_iterate_field *field_r); |
16393
b9a312951881
lib-index: mail_cache_lookup*() can now return fields recently added with mail_cache_add()
Timo Sirainen <tss@iki.fi>
parents:
15578
diff
changeset
|
242 const struct mail_cache_record * |
b9a312951881
lib-index: mail_cache_lookup*() can now return fields recently added with mail_cache_add()
Timo Sirainen <tss@iki.fi>
parents:
15578
diff
changeset
|
243 mail_cache_transaction_lookup_rec(struct mail_cache_transaction_ctx *ctx, |
b9a312951881
lib-index: mail_cache_lookup*() can now return fields recently added with mail_cache_add()
Timo Sirainen <tss@iki.fi>
parents:
15578
diff
changeset
|
244 unsigned int seq, |
b9a312951881
lib-index: mail_cache_lookup*() can now return fields recently added with mail_cache_add()
Timo Sirainen <tss@iki.fi>
parents:
15578
diff
changeset
|
245 unsigned int *trans_next_idx); |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
246 |
15311
022d0d21e56d
lib-index: mail_cache_map() API cleanup
Timo Sirainen <tss@iki.fi>
parents:
14083
diff
changeset
|
247 int mail_cache_map(struct mail_cache *cache, size_t offset, size_t size, |
022d0d21e56d
lib-index: mail_cache_map() API cleanup
Timo Sirainen <tss@iki.fi>
parents:
14083
diff
changeset
|
248 const void **data_r); |
2247
2d51bb58a070
Added some smartness for deciding what to cache. Cache compression code compiles, but untested.
Timo Sirainen <tss@iki.fi>
parents:
2201
diff
changeset
|
249 void mail_cache_file_close(struct mail_cache *cache); |
2275
c68a3c9f6d73
Cache file compression works now and compressed cache file is reopened.
Timo Sirainen <tss@iki.fi>
parents:
2247
diff
changeset
|
250 int mail_cache_reopen(struct mail_cache *cache); |
2247
2d51bb58a070
Added some smartness for deciding what to cache. Cache compression code compiles, but untested.
Timo Sirainen <tss@iki.fi>
parents:
2201
diff
changeset
|
251 |
7076
3cb00348ed06
Update caching decision for fields even if it doesn't currently exist in the
Timo Sirainen <tss@iki.fi>
parents:
6841
diff
changeset
|
252 /* Notify the decision handling code that field was looked up for seq. |
3cb00348ed06
Update caching decision for fields even if it doesn't currently exist in the
Timo Sirainen <tss@iki.fi>
parents:
6841
diff
changeset
|
253 This should be called even for fields that aren't currently in cache file */ |
5734 | 254 void mail_cache_decision_state_update(struct mail_cache_view *view, |
255 uint32_t seq, unsigned int field); | |
2298
5beb0c20b6e8
Cache file fixes, API changes, etc. It's still in somewhat ugly state, but
Timo Sirainen <tss@iki.fi>
parents:
2277
diff
changeset
|
256 void mail_cache_decision_add(struct mail_cache_view *view, uint32_t seq, |
2999
1d328531c466
mail_cache_decision_*() prototypes were wrong.
Timo Sirainen <tss@iki.fi>
parents:
2941
diff
changeset
|
257 unsigned int field); |
2200
97bb7b127617
Beginnings of getting cache file working again. Easy to break currently, but
Timo Sirainen <tss@iki.fi>
parents:
1915
diff
changeset
|
258 |
2853
512dd7d76cdc
Removed cache_offset from mail_index_record and changed it to use extension
Timo Sirainen <tss@iki.fi>
parents:
2632
diff
changeset
|
259 int mail_cache_expunge_handler(struct mail_index_sync_map_ctx *sync_ctx, |
4490
56d17f2e1d66
Added support for calling expunge handler for an extension even if the
Timo Sirainen <tss@iki.fi>
parents:
4451
diff
changeset
|
260 uint32_t seq, const void *data, |
56d17f2e1d66
Added support for calling expunge handler for an extension even if the
Timo Sirainen <tss@iki.fi>
parents:
4451
diff
changeset
|
261 void **sync_context, void *context); |
2853
512dd7d76cdc
Removed cache_offset from mail_index_record and changed it to use extension
Timo Sirainen <tss@iki.fi>
parents:
2632
diff
changeset
|
262 |
1915
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
263 void mail_cache_set_syscall_error(struct mail_cache *cache, |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
264 const char *function); |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
265 |
79790750c349
importing new index code. mbox still broken.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
266 #endif |