squat-uidlist.h revision 1777c974563740daac427d3ef738903d8f6ad7d0
383395aee82283b15d9ea8ea0ad55d1d8c988b60Timo Sirainensquat_uidlist_init(struct squat_trie *trie, const char *path,
383395aee82283b15d9ea8ea0ad55d1d8c988b60Timo Sirainenvoid squat_uidlist_deinit(struct squat_uidlist *uidlist);
383395aee82283b15d9ea8ea0ad55d1d8c988b60Timo Sirainen/* Make sure that we've the latest uidlist file fully mapped. */
383395aee82283b15d9ea8ea0ad55d1d8c988b60Timo Sirainenint squat_uidlist_refresh(struct squat_uidlist *uidlist);
383395aee82283b15d9ea8ea0ad55d1d8c988b60Timo Sirainen/* Get the last UID added to the file. */
383395aee82283b15d9ea8ea0ad55d1d8c988b60Timo Sirainenint squat_uidlist_get_last_uid(struct squat_uidlist *uidlist, uint32_t *uid_r);
383395aee82283b15d9ea8ea0ad55d1d8c988b60Timo Sirainen/* Add new UID to given UID list. The uid_list_idx is updated to contain the
383395aee82283b15d9ea8ea0ad55d1d8c988b60Timo Sirainen new list index. It must be put through _finish_list() before it's actually
f052a448696b1246ee9fc36b7c727237aed56058Timo Sirainen written to disk. */
383395aee82283b15d9ea8ea0ad55d1d8c988b60Timo Sirainenint squat_uidlist_add(struct squat_uidlist *uidlist, uint32_t *uid_list_idx,
bd63b5b860658b01b1f46f26d406e1e4a9dc019aTimo Sirainen/* Write UID list into disk. The uid_list_idx is updated to contain the new
383395aee82283b15d9ea8ea0ad55d1d8c988b60Timo Sirainen permanent index for it. */
383395aee82283b15d9ea8ea0ad55d1d8c988b60Timo Sirainenint squat_uidlist_finish_list(struct squat_uidlist *uidlist,
383395aee82283b15d9ea8ea0ad55d1d8c988b60Timo Sirainenint squat_uidlist_flush(struct squat_uidlist *uidlist, uint32_t uid_validity);
383395aee82283b15d9ea8ea0ad55d1d8c988b60Timo Sirainen/* Returns TRUE if uidlist should be compressed. current_message_count can be
383395aee82283b15d9ea8ea0ad55d1d8c988b60Timo Sirainen (unsigned int)-1 if you don't want include it in the check. */
383395aee82283b15d9ea8ea0ad55d1d8c988b60Timo Sirainenbool squat_uidlist_need_compress(struct squat_uidlist *uidlist,
383395aee82283b15d9ea8ea0ad55d1d8c988b60Timo Sirainen/* Mark the uidlist containing expunged messages. update_disk=FALSE should be
383395aee82283b15d9ea8ea0ad55d1d8c988b60Timo Sirainen done when the uidlist is going to be compressed and this function only tells
383395aee82283b15d9ea8ea0ad55d1d8c988b60Timo Sirainen the compression to check for the expunged messages. */
383395aee82283b15d9ea8ea0ad55d1d8c988b60Timo Sirainenint squat_uidlist_mark_having_expunges(struct squat_uidlist *uidlist,
383395aee82283b15d9ea8ea0ad55d1d8c988b60Timo Sirainen/* Compress the uidlist file. existing_uids may be NULL if they're not known. */
383395aee82283b15d9ea8ea0ad55d1d8c988b60Timo Sirainensquat_uidlist_compress_begin(struct squat_uidlist *uidlist,
383395aee82283b15d9ea8ea0ad55d1d8c988b60Timo Sirainenint squat_uidlist_compress_next(struct squat_uidlist_compress_ctx *ctx,
383395aee82283b15d9ea8ea0ad55d1d8c988b60Timo Sirainenvoid squat_uidlist_compress_rollback(struct squat_uidlist_compress_ctx **ctx);
383395aee82283b15d9ea8ea0ad55d1d8c988b60Timo Sirainenint squat_uidlist_compress_commit(struct squat_uidlist_compress_ctx **ctx);
383395aee82283b15d9ea8ea0ad55d1d8c988b60Timo Sirainen/* Returns UIDs for a given UID list index. */
383395aee82283b15d9ea8ea0ad55d1d8c988b60Timo Sirainenint squat_uidlist_get(struct squat_uidlist *uidlist, uint32_t uid_list_idx,
383395aee82283b15d9ea8ea0ad55d1d8c988b60Timo Sirainen/* Filter out UIDs which don't appear in the given UID list from the given
383395aee82283b15d9ea8ea0ad55d1d8c988b60Timo Sirainen result array */
383395aee82283b15d9ea8ea0ad55d1d8c988b60Timo Sirainenint squat_uidlist_filter(struct squat_uidlist *uidlist, uint32_t uid_list_idx,
383395aee82283b15d9ea8ea0ad55d1d8c988b60Timo Sirainensize_t squat_uidlist_mem_used(struct squat_uidlist *uidlist,
383395aee82283b15d9ea8ea0ad55d1d8c988b60Timo Sirainen unsigned int *count_r);