mail-index-data.h revision 025961fd171e7be79d7be7dee3d619de317f0b1e
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenvoid mail_index_data_free(MailIndexData *data);
5fb3bff645380804c9db2510940c41db6b8fdb01Timo Sirainen/* Truncate the data file and update it's indexid */
15b9759df8e4f6fb00c115353827a2aebbebfebcTimo Sirainenint mail_index_data_reset(MailIndexData *data);
15b9759df8e4f6fb00c115353827a2aebbebfebcTimo Sirainen/* Set indexid to 0 to notify other processes using this file that they should
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen re-open it. */
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainenint mail_index_data_mark_deleted(MailIndexData *data);
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen/* Mark the file as being modified */
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainenvoid mail_index_data_mark_modified(MailIndexData *data);
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen/* Append new data at the end of the file. Returns the position in file
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen where the data begins, or 0 if error occured. */
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainenuoff_t mail_index_data_append(MailIndexData *data, const void *buffer,
d6badc27cd6e8d3398877b6766cb0aaeef3a7800Timo Sirainen/* Increase header->deleted_space field */
f7539a17ea306191b53b8f5e752e228937df9ec3Timo Sirainenint mail_index_data_add_deleted_space(MailIndexData *data, size_t data_size);
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen/* Synchronize the data into disk */
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenint mail_index_data_sync_file(MailIndexData *data, int *fsync_fd);
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen/* Looks up a field from data file. If field is 0, returns the first field
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen found. Returns NULL if not found or if error occured. */
04ab375449dd97eed50ada88dd0df2abab01cfeeTimo Sirainenmail_index_data_lookup(MailIndexData *data, MailIndexRecord *index_rec,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen/* Returns the next record in data file, or NULL if there's no more. */
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainenmail_index_data_next(MailIndexData *data, MailIndexRecord *index_rec,
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainen/* Returns TRUE if rec->data is a valid \0-terminated string */
8e371a3ce32bd64288786855b8ce0cb63f19f7d1Timo Sirainenint mail_index_data_record_verify(MailIndexData *data,
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen/* Return the whole data file mmap()ed. */
57a8c6a95e4bce3eeaba36985adb81c07dd683ffTimo Sirainenvoid *mail_index_data_get_mmaped(MailIndexData *data, size_t *size);
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen/* "Error in index data file %s: ...". Also marks the index file as
fdc557286bc9f92c5f3bb49096ff6e2bcec0ea79Timo Sirainen corrupted. */
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenint index_data_set_corrupted(MailIndexData *data, const char *fmt, ...);