mail-index-view-private.h revision 7c95b03620a03a43dd72d39608cea5fc77393ad6
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek#ifndef __MAIL_INDEX_VIEW_PRIVATE_H
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek#define __MAIL_INDEX_VIEW_PRIVATE_H
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek#include "mail-index-private.h"
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek
d6d50c17e94dc0d3000345e8a933311c14bbb828Jakub Hrozekstruct mail_index_view_methods {
a7797068c4deb6ce2bdbcda27c45ff1bbb4a8e78Jakub Hrozek void (*close)(struct mail_index_view *view);
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek uint32_t (*get_message_count)(struct mail_index_view *view);
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek int (*get_header)(struct mail_index_view *view,
481ec0e1eb0058195732cb320845b41f6f4d43ebJakub Hrozek const struct mail_index_header **hdr_r);
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek int (*lookup_full)(struct mail_index_view *view, uint32_t seq,
481ec0e1eb0058195732cb320845b41f6f4d43ebJakub Hrozek struct mail_index_map **map_r,
481ec0e1eb0058195732cb320845b41f6f4d43ebJakub Hrozek const struct mail_index_record **rec_r);
2cb6f28b3a12bb714bf14494d31eb6b6fff64b8bJakub Hrozek int (*lookup_uid)(struct mail_index_view *view, uint32_t seq,
a7797068c4deb6ce2bdbcda27c45ff1bbb4a8e78Jakub Hrozek uint32_t *uid_r);
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek int (*lookup_uid_range)(struct mail_index_view *view,
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek uint32_t first_uid, uint32_t last_uid,
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek uint32_t *first_seq_r, uint32_t *last_seq_r);
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek int (*lookup_first)(struct mail_index_view *view, enum mail_flags flags,
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek uint8_t flags_mask, uint32_t *seq_r);
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek int (*lookup_ext_full)(struct mail_index_view *view, uint32_t seq,
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek uint32_t ext_id, struct mail_index_map **map_r,
481ec0e1eb0058195732cb320845b41f6f4d43ebJakub Hrozek const void **data_r);
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek int (*get_header_ext)(struct mail_index_view *view,
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek struct mail_index_map *map, uint32_t ext_id,
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek const void **data_r, size_t *data_size_r);
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek};
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozekstruct mail_index_view {
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek struct mail_index_view_methods methods;
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek struct mail_index *index;
5ee3fba0bd812242a1ffe189f5ddf2689e6e6811Jakub Hrozek struct mail_transaction_log_view *log_view;
5ee3fba0bd812242a1ffe189f5ddf2689e6e6811Jakub Hrozek
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek unsigned int indexid;
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek struct mail_index_map *map;
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek struct mail_index_map *new_map;
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek buffer_t *map_refs;
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek struct mail_index_header tmp_hdr_copy;
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek uint32_t messages_count; /* last synced one, map may be different */
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek uint32_t log_file_seq;
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek uoff_t log_file_offset;
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek buffer_t *log_syncs;
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek int transactions;
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek unsigned int lock_id;
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek unsigned int inconsistent:1;
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek unsigned int syncing:1;
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek};
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozekvoid mail_index_view_clone(struct mail_index_view *dest,
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek const struct mail_index_view *src);
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozekint mail_index_view_lock(struct mail_index_view *view);
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozekint mail_index_view_lock_head(struct mail_index_view *view, int update_index);
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozekvoid mail_index_view_unref_maps(struct mail_index_view *view);
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozekvoid mail_index_view_add_synced_transaction(struct mail_index_view *view,
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek uint32_t log_file_seq,
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek uoff_t log_file_offset);
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek#endif
6463ed1dcdd45416468b3fa178bd856b5a9ed2c3Jakub Hrozek