Mercurial > dovecot > original-hg > dovecot-1.2
annotate src/lib-index/mail-hash.h @ 69:8cef827d2d79 HEAD
MailHashHeader is now 8-byte aligned. Fixed other header alignments too and
stored MEM_ALIGN_SIZE into compat_data[].
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 28 Aug 2002 21:20:19 +0300 |
parents | d493b9cc265e |
children | e0f995ee5969 |
rev | line source |
---|---|
0 | 1 #ifndef __MAIL_HASH_H |
2 #define __MAIL_HASH_H | |
3 | |
4 typedef struct _MailHashHeader MailHashHeader; | |
5 typedef struct _MailHashRecord MailHashRecord; | |
6 | |
7 struct _MailHashHeader { | |
8 unsigned int indexid; | |
42
1ab58549429d
If hash file was rebuilt, other processes didn't notice that. Also added
Timo Sirainen <tss@iki.fi>
parents:
29
diff
changeset
|
9 unsigned int updateid; |
0 | 10 unsigned int used_records; |
69
8cef827d2d79
MailHashHeader is now 8-byte aligned. Fixed other header alignments too and
Timo Sirainen <tss@iki.fi>
parents:
50
diff
changeset
|
11 |
8cef827d2d79
MailHashHeader is now 8-byte aligned. Fixed other header alignments too and
Timo Sirainen <tss@iki.fi>
parents:
50
diff
changeset
|
12 unsigned int alignment; |
0 | 13 }; |
14 | |
15 struct _MailHashRecord { | |
16 unsigned int uid; | |
50
d493b9cc265e
Introduced uoff_t which is the unsigned-equilevant of off_t. This was needed
Timo Sirainen <tss@iki.fi>
parents:
42
diff
changeset
|
17 uoff_t position; |
0 | 18 }; |
19 | |
20 /* Open or create a hash file for index. If the hash needs to be created, | |
21 it's also immediately built from the given index. */ | |
22 int mail_hash_create(MailIndex *index); | |
23 int mail_hash_open_or_create(MailIndex *index); | |
24 | |
25 void mail_hash_free(MailHash *hash); | |
26 | |
27 /* Synchronize the hash file with memory map */ | |
28 int mail_hash_sync_file(MailHash *hash); | |
29 | |
29
e9375147c0cb
Added write_full() which is a simple wrapper around write() meant for
Timo Sirainen <tss@iki.fi>
parents:
0
diff
changeset
|
30 /* Rebuild hash from index and reset the FLAG_REBUILD_HASH in header. |
0 | 31 The index must have an exclusive lock before this function is called. */ |
32 int mail_hash_rebuild(MailHash *hash); | |
33 | |
34 /* Returns position in index file to given UID, or 0 if not found. */ | |
50
d493b9cc265e
Introduced uoff_t which is the unsigned-equilevant of off_t. This was needed
Timo Sirainen <tss@iki.fi>
parents:
42
diff
changeset
|
35 uoff_t mail_hash_lookup_uid(MailHash *hash, unsigned int uid); |
0 | 36 |
37 /* Update hash file. If pos is 0, the record is deleted. This call may | |
38 rebuild the hash if it's too full. */ | |
50
d493b9cc265e
Introduced uoff_t which is the unsigned-equilevant of off_t. This was needed
Timo Sirainen <tss@iki.fi>
parents:
42
diff
changeset
|
39 void mail_hash_update(MailHash *hash, unsigned int uid, uoff_t pos); |
0 | 40 |
41 #endif |