Mercurial > dovecot > original-hg > dovecot-1.2
annotate src/plugins/fts-squat/squat-trie.h @ 9575:0a00dcc4f0ea HEAD
lib-storage: Allow shared namespace prefix to use %variable modifiers.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 26 May 2010 17:07:51 +0100 |
parents | b62042ddb79e |
children |
rev | line source |
---|---|
6410
e4eb71ae8e96
Changed .h ifdef/defines to use <NAME>_H format.
Timo Sirainen <tss@iki.fi>
parents:
4901
diff
changeset
|
1 #ifndef SQUAT_TRIE_H |
e4eb71ae8e96
Changed .h ifdef/defines to use <NAME>_H format.
Timo Sirainen <tss@iki.fi>
parents:
4901
diff
changeset
|
2 #define SQUAT_TRIE_H |
4855
5bc593f1a8f6
Added "squat" full text search indexer backend. Its name and basic ideas
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
3 |
6502
c4cb7f25bf09
Don't forward declare enums. It doesn't seem to work with all compilers.
Timo Sirainen <tss@iki.fi>
parents:
6418
diff
changeset
|
4 #include "file-lock.h" |
4855
5bc593f1a8f6
Added "squat" full text search indexer backend. Its name and basic ideas
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
5 #include "seq-range-array.h" |
5bc593f1a8f6
Added "squat" full text search indexer backend. Its name and basic ideas
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
6 |
7371 | 7 enum squat_index_flags { |
8 SQUAT_INDEX_FLAG_MMAP_DISABLE = 0x01, | |
9 SQUAT_INDEX_FLAG_NFS_FLUSH = 0x02, | |
10 SQUAT_INDEX_FLAG_DOTLOCK_USE_EXCL = 0x04 | |
11 }; | |
12 | |
6898
e739cffd05ef
FTS API changes and Squat rewrite. Squat is still missing expunge handling.
Timo Sirainen <tss@iki.fi>
parents:
6502
diff
changeset
|
13 enum squat_index_type { |
e739cffd05ef
FTS API changes and Squat rewrite. Squat is still missing expunge handling.
Timo Sirainen <tss@iki.fi>
parents:
6502
diff
changeset
|
14 SQUAT_INDEX_TYPE_HEADER = 0x01, |
e739cffd05ef
FTS API changes and Squat rewrite. Squat is still missing expunge handling.
Timo Sirainen <tss@iki.fi>
parents:
6502
diff
changeset
|
15 SQUAT_INDEX_TYPE_BODY = 0x02 |
e739cffd05ef
FTS API changes and Squat rewrite. Squat is still missing expunge handling.
Timo Sirainen <tss@iki.fi>
parents:
6502
diff
changeset
|
16 }; |
e739cffd05ef
FTS API changes and Squat rewrite. Squat is still missing expunge handling.
Timo Sirainen <tss@iki.fi>
parents:
6502
diff
changeset
|
17 |
e739cffd05ef
FTS API changes and Squat rewrite. Squat is still missing expunge handling.
Timo Sirainen <tss@iki.fi>
parents:
6502
diff
changeset
|
18 struct squat_trie_build_context; |
e739cffd05ef
FTS API changes and Squat rewrite. Squat is still missing expunge handling.
Timo Sirainen <tss@iki.fi>
parents:
6502
diff
changeset
|
19 |
4878
88a91d9a867b
Fixes. Should be pretty much working now.
Timo Sirainen <tss@iki.fi>
parents:
4855
diff
changeset
|
20 struct squat_trie * |
6898
e739cffd05ef
FTS API changes and Squat rewrite. Squat is still missing expunge handling.
Timo Sirainen <tss@iki.fi>
parents:
6502
diff
changeset
|
21 squat_trie_init(const char *path, uint32_t uidvalidity, |
7371 | 22 enum file_lock_method lock_method, |
8205
b62042ddb79e
Squat: Create files with the correct mode and group.
Timo Sirainen <tss@iki.fi>
parents:
7429
diff
changeset
|
23 enum squat_index_flags flags, mode_t mode, gid_t gid); |
6898
e739cffd05ef
FTS API changes and Squat rewrite. Squat is still missing expunge handling.
Timo Sirainen <tss@iki.fi>
parents:
6502
diff
changeset
|
24 void squat_trie_deinit(struct squat_trie **trie); |
e739cffd05ef
FTS API changes and Squat rewrite. Squat is still missing expunge handling.
Timo Sirainen <tss@iki.fi>
parents:
6502
diff
changeset
|
25 |
7429
477b619b926b
Added FTS_SQUAT environment with partial=n and full=m settings.
Timo Sirainen <tss@iki.fi>
parents:
7371
diff
changeset
|
26 void squat_trie_set_partial_len(struct squat_trie *trie, unsigned int len); |
477b619b926b
Added FTS_SQUAT environment with partial=n and full=m settings.
Timo Sirainen <tss@iki.fi>
parents:
7371
diff
changeset
|
27 void squat_trie_set_full_len(struct squat_trie *trie, unsigned int len); |
477b619b926b
Added FTS_SQUAT environment with partial=n and full=m settings.
Timo Sirainen <tss@iki.fi>
parents:
7371
diff
changeset
|
28 |
6898
e739cffd05ef
FTS API changes and Squat rewrite. Squat is still missing expunge handling.
Timo Sirainen <tss@iki.fi>
parents:
6502
diff
changeset
|
29 void squat_trie_refresh(struct squat_trie *trie); |
e739cffd05ef
FTS API changes and Squat rewrite. Squat is still missing expunge handling.
Timo Sirainen <tss@iki.fi>
parents:
6502
diff
changeset
|
30 |
e739cffd05ef
FTS API changes and Squat rewrite. Squat is still missing expunge handling.
Timo Sirainen <tss@iki.fi>
parents:
6502
diff
changeset
|
31 int squat_trie_build_init(struct squat_trie *trie, uint32_t *last_uid_r, |
e739cffd05ef
FTS API changes and Squat rewrite. Squat is still missing expunge handling.
Timo Sirainen <tss@iki.fi>
parents:
6502
diff
changeset
|
32 struct squat_trie_build_context **ctx_r); |
7210
f5f77a3ae203
Initial code to support expunging from squat indexes, probably still buggy.
Timo Sirainen <tss@iki.fi>
parents:
6898
diff
changeset
|
33 /* bodies must be added before headers */ |
6898
e739cffd05ef
FTS API changes and Squat rewrite. Squat is still missing expunge handling.
Timo Sirainen <tss@iki.fi>
parents:
6502
diff
changeset
|
34 int squat_trie_build_more(struct squat_trie_build_context *ctx, |
e739cffd05ef
FTS API changes and Squat rewrite. Squat is still missing expunge handling.
Timo Sirainen <tss@iki.fi>
parents:
6502
diff
changeset
|
35 uint32_t uid, enum squat_index_type type, |
e739cffd05ef
FTS API changes and Squat rewrite. Squat is still missing expunge handling.
Timo Sirainen <tss@iki.fi>
parents:
6502
diff
changeset
|
36 const unsigned char *data, unsigned int size); |
7210
f5f77a3ae203
Initial code to support expunging from squat indexes, probably still buggy.
Timo Sirainen <tss@iki.fi>
parents:
6898
diff
changeset
|
37 /* if expunged_uids is non-NULL, they may be removed from the index if they |
f5f77a3ae203
Initial code to support expunging from squat indexes, probably still buggy.
Timo Sirainen <tss@iki.fi>
parents:
6898
diff
changeset
|
38 still exist. */ |
f5f77a3ae203
Initial code to support expunging from squat indexes, probably still buggy.
Timo Sirainen <tss@iki.fi>
parents:
6898
diff
changeset
|
39 int squat_trie_build_deinit(struct squat_trie_build_context **ctx, |
f5f77a3ae203
Initial code to support expunging from squat indexes, probably still buggy.
Timo Sirainen <tss@iki.fi>
parents:
6898
diff
changeset
|
40 const ARRAY_TYPE(seq_range) *expunged_uids); |
4855
5bc593f1a8f6
Added "squat" full text search indexer backend. Its name and basic ideas
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
41 |
4878
88a91d9a867b
Fixes. Should be pretty much working now.
Timo Sirainen <tss@iki.fi>
parents:
4855
diff
changeset
|
42 int squat_trie_get_last_uid(struct squat_trie *trie, uint32_t *last_uid_r); |
6898
e739cffd05ef
FTS API changes and Squat rewrite. Squat is still missing expunge handling.
Timo Sirainen <tss@iki.fi>
parents:
6502
diff
changeset
|
43 /* type specifies if we're looking at header, body or both */ |
e739cffd05ef
FTS API changes and Squat rewrite. Squat is still missing expunge handling.
Timo Sirainen <tss@iki.fi>
parents:
6502
diff
changeset
|
44 int squat_trie_lookup(struct squat_trie *trie, const char *str, |
e739cffd05ef
FTS API changes and Squat rewrite. Squat is still missing expunge handling.
Timo Sirainen <tss@iki.fi>
parents:
6502
diff
changeset
|
45 enum squat_index_type type, |
e739cffd05ef
FTS API changes and Squat rewrite. Squat is still missing expunge handling.
Timo Sirainen <tss@iki.fi>
parents:
6502
diff
changeset
|
46 ARRAY_TYPE(seq_range) *definite_uids, |
e739cffd05ef
FTS API changes and Squat rewrite. Squat is still missing expunge handling.
Timo Sirainen <tss@iki.fi>
parents:
6502
diff
changeset
|
47 ARRAY_TYPE(seq_range) *maybe_uids); |
4878
88a91d9a867b
Fixes. Should be pretty much working now.
Timo Sirainen <tss@iki.fi>
parents:
4855
diff
changeset
|
48 |
6898
e739cffd05ef
FTS API changes and Squat rewrite. Squat is still missing expunge handling.
Timo Sirainen <tss@iki.fi>
parents:
6502
diff
changeset
|
49 struct squat_uidlist *squat_trie_get_uidlist(struct squat_trie *trie); |
4855
5bc593f1a8f6
Added "squat" full text search indexer backend. Its name and basic ideas
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
50 size_t squat_trie_mem_used(struct squat_trie *trie, unsigned int *count_r); |
5bc593f1a8f6
Added "squat" full text search indexer backend. Its name and basic ideas
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
51 |
5bc593f1a8f6
Added "squat" full text search indexer backend. Its name and basic ideas
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
52 #endif |