annotate src/lib-storage/index/index-storage.h @ 1546:9c9ce9c71509 HEAD

Close index files before deleting the mailbox.
author Timo Sirainen <tss@iki.fi>
date Sat, 14 Jun 2003 20:38:06 +0300
parents 5166b1e09f84
children bc3307f2f35d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
1 #ifndef __INDEX_STORAGE_H
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
2 #define __INDEX_STORAGE_H
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
3
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
4 #include "mail-storage.h"
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
5 #include "mail-index.h"
988
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 939
diff changeset
6 #include "index-mail.h"
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
7
1172
f7c273202dc3 Support for IDLE extension.
Timo Sirainen <tss@iki.fi>
parents: 1161
diff changeset
8 struct index_autosync_file {
f7c273202dc3 Support for IDLE extension.
Timo Sirainen <tss@iki.fi>
parents: 1161
diff changeset
9 struct index_autosync_file *next;
f7c273202dc3 Support for IDLE extension.
Timo Sirainen <tss@iki.fi>
parents: 1161
diff changeset
10
f7c273202dc3 Support for IDLE extension.
Timo Sirainen <tss@iki.fi>
parents: 1161
diff changeset
11 char *path;
f7c273202dc3 Support for IDLE extension.
Timo Sirainen <tss@iki.fi>
parents: 1161
diff changeset
12 time_t last_stamp;
f7c273202dc3 Support for IDLE extension.
Timo Sirainen <tss@iki.fi>
parents: 1161
diff changeset
13 };
f7c273202dc3 Support for IDLE extension.
Timo Sirainen <tss@iki.fi>
parents: 1161
diff changeset
14
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
15 struct index_mailbox {
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
16 struct mailbox box;
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
17
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
18 /* expunge messages marked as deleted, requires index to be
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
19 exclusively locked */
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
20 int (*expunge_locked)(struct index_mailbox *ibox, int notify);
450
925d6eb5f8be MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents: 410
diff changeset
21
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
22 struct mail_index *index;
600
3b44bc64afd4 mailbox_check_interval setting: Dovecot can notify client of new mail in
Timo Sirainen <tss@iki.fi>
parents: 570
diff changeset
23
1172
f7c273202dc3 Support for IDLE extension.
Timo Sirainen <tss@iki.fi>
parents: 1161
diff changeset
24 struct timeout *autosync_to;
f7c273202dc3 Support for IDLE extension.
Timo Sirainen <tss@iki.fi>
parents: 1161
diff changeset
25 struct index_autosync_file *autosync_files;
f7c273202dc3 Support for IDLE extension.
Timo Sirainen <tss@iki.fi>
parents: 1161
diff changeset
26 enum mailbox_sync_type autosync_type;
f7c273202dc3 Support for IDLE extension.
Timo Sirainen <tss@iki.fi>
parents: 1161
diff changeset
27 time_t sync_last_check;
f7c273202dc3 Support for IDLE extension.
Timo Sirainen <tss@iki.fi>
parents: 1161
diff changeset
28 unsigned int min_newmail_notify_interval;
600
3b44bc64afd4 mailbox_check_interval setting: Dovecot can notify client of new mail in
Timo Sirainen <tss@iki.fi>
parents: 570
diff changeset
29
988
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 939
diff changeset
30 struct index_mail fetch_mail; /* fetch_uid() or fetch_seq() */
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
31 unsigned int synced_messages_count;
450
925d6eb5f8be MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents: 410
diff changeset
32
674
b7aefd0d7611 Locking changes triggered a bit larger cleanup :) If we have to wait for a
Timo Sirainen <tss@iki.fi>
parents: 633
diff changeset
33 time_t next_lock_notify; /* temporary */
1161
fc5d2e44cc5e Locking code cleanups and small fixes
Timo Sirainen <tss@iki.fi>
parents: 1015
diff changeset
34 enum mail_lock_notify_type last_notify_type;
674
b7aefd0d7611 Locking changes triggered a bit larger cleanup :) If we have to wait for a
Timo Sirainen <tss@iki.fi>
parents: 633
diff changeset
35
450
925d6eb5f8be MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents: 410
diff changeset
36 unsigned int sent_diskspace_warning:1;
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
37 };
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
38
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
39 int mail_storage_set_index_error(struct index_mailbox *ibox);
939
24b64302f59c index_storage_sync_and_lock() didn't set lock notify function.
Timo Sirainen <tss@iki.fi>
parents: 924
diff changeset
40 void index_storage_init_lock_notify(struct index_mailbox *ibox);
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
41 int index_storage_lock(struct index_mailbox *ibox,
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
42 enum mail_lock_type lock_type);
223
ca6967899c05 More cleanups. lib-storage should handle "out of disk space" conditions
Timo Sirainen <tss@iki.fi>
parents: 184
diff changeset
43
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
44 void index_storage_add(struct mail_index *index);
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
45 struct mail_index *index_storage_lookup_ref(const char *path);
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
46 void index_storage_unref(struct mail_index *index);
1546
9c9ce9c71509 Close index files before deleting the mailbox.
Timo Sirainen <tss@iki.fi>
parents: 1429
diff changeset
47 void index_storage_destroy_unrefed(void);
450
925d6eb5f8be MailStorage interface change. We now let storage call several sync-functions
Timo Sirainen <tss@iki.fi>
parents: 410
diff changeset
48
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
49 struct index_mailbox *
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
50 index_storage_init(struct mail_storage *storage, struct mailbox *box,
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
51 struct mail_index *index, const char *name,
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
52 int readonly, int fast);
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
53 int index_storage_close(struct mailbox *box);
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
54
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
55 int index_storage_sync_and_lock(struct index_mailbox *ibox, int sync_size,
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
56 enum mail_lock_type data_lock_type);
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
57 int index_storage_sync_modifylog(struct index_mailbox *ibox, int hide_deleted);
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
58
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
59 int index_mailbox_fix_custom_flags(struct index_mailbox *ibox,
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
60 enum mail_flags *flags,
988
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 939
diff changeset
61 const char *custom_flags[],
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 939
diff changeset
62 unsigned int custom_flags_count);
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
63
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
64 unsigned int index_storage_get_recent_count(struct mail_index *index);
325
ba058497efa9 Send RECENT after all EXISTS replies. Check for new mail in mailbox after
Timo Sirainen <tss@iki.fi>
parents: 296
diff changeset
65
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
66 int index_expunge_seek_first(struct index_mailbox *ibox, unsigned int *seq,
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
67 struct mail_index_record **rec);
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
68 int index_expunge_mail(struct index_mailbox *ibox,
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
69 struct mail_index_record *rec,
453
0f6fd6802265 Modify log now stores the changes in ranges, so store 1:100 doesn't
Timo Sirainen <tss@iki.fi>
parents: 450
diff changeset
70 unsigned int seq, int notify);
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
71
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
72 void index_mailbox_check_add(struct index_mailbox *ibox, const char *path);
1172
f7c273202dc3 Support for IDLE extension.
Timo Sirainen <tss@iki.fi>
parents: 1161
diff changeset
73 void index_mailbox_check_remove_all(struct index_mailbox *ibox);
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
74
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
75 /* mailbox methods: */
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
76 void index_storage_set_callbacks(struct mail_storage *storage,
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
77 struct mail_storage_callbacks *callbacks,
674
b7aefd0d7611 Locking changes triggered a bit larger cleanup :) If we have to wait for a
Timo Sirainen <tss@iki.fi>
parents: 633
diff changeset
78 void *context);
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
79 int index_storage_copy(struct mailbox *box, struct mailbox *destbox,
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
80 const char *messageset, int uidset);
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
81 int index_storage_expunge(struct mailbox *box, int notify);
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
82 int index_storage_get_status(struct mailbox *box,
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
83 enum mailbox_status_items items,
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
84 struct mailbox_status *status);
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
85 int index_storage_sync(struct mailbox *box, int sync_expunges);
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
86 int index_storage_update_flags(struct mailbox *box, const char *messageset,
988
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 939
diff changeset
87 int uidset, const struct mail_full_flags *flags,
903
fd8888f6f037 Naming style changes, finally got tired of most of the typedefs. Also the
Timo Sirainen <tss@iki.fi>
parents: 764
diff changeset
88 enum modify_type modify_type, int notify,
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
89 int *all_found);
988
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 939
diff changeset
90
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 939
diff changeset
91 struct mail_fetch_context *
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 939
diff changeset
92 index_storage_fetch_init(struct mailbox *box,
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 939
diff changeset
93 enum mail_fetch_field wanted_fields, int *update_seen,
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 939
diff changeset
94 const char *messageset, int uidset);
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 939
diff changeset
95 int index_storage_fetch_deinit(struct mail_fetch_context *ctx, int *all_found);
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 939
diff changeset
96 struct mail *index_storage_fetch_next(struct mail_fetch_context *ctx);
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 939
diff changeset
97
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 939
diff changeset
98 struct mail *index_storage_fetch_uid(struct mailbox *box, unsigned int uid,
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 939
diff changeset
99 enum mail_fetch_field wanted_fields);
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 939
diff changeset
100 struct mail *index_storage_fetch_seq(struct mailbox *box, unsigned int seq,
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 939
diff changeset
101 enum mail_fetch_field wanted_fields);
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 939
diff changeset
102
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 939
diff changeset
103 int index_storage_search_get_sorting(struct mailbox *box,
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 939
diff changeset
104 enum mail_sort_type *sort_program);
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 939
diff changeset
105 struct mail_search_context *
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 939
diff changeset
106 index_storage_search_init(struct mailbox *box, const char *charset,
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 939
diff changeset
107 struct mail_search_arg *args,
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 939
diff changeset
108 const enum mail_sort_type *sort_program,
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 939
diff changeset
109 enum mail_fetch_field wanted_fields,
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 939
diff changeset
110 const char *const wanted_headers[]);
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 939
diff changeset
111 int index_storage_search_deinit(struct mail_search_context *ctx);
8028c4dcf38f mail-storage.h interface changes, affects pretty much everything.
Timo Sirainen <tss@iki.fi>
parents: 939
diff changeset
112 struct mail *index_storage_search_next(struct mail_search_context *ctx);
0
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
113
3b1985cbc908 Initial revision
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
114 #endif