mail-cache.h revision a835194f9a9dae88528367a791cbc282589f6c01
#ifndef __MAIL_CACHE_H
#define __MAIL_CACHE_H
#include "mail-index.h"
#define MAIL_CACHE_FILE_SUFFIX ".cache"
struct mail_cache;
struct mail_cache_view;
struct mail_cache_transaction_ctx;
enum mail_cache_decision_type {
/* Not needed currently */
MAIL_CACHE_DECISION_NO = 0x00,
/* Needed only for new mails. Drop when compressing. */
MAIL_CACHE_DECISION_TEMP = 0x01,
/* Needed. */
MAIL_CACHE_DECISION_YES = 0x02,
/* This decision has been forced manually, don't change it. */
MAIL_CACHE_DECISION_FORCED = 0x80
};
enum mail_cache_field_type {
};
struct mail_cache_field {
const char *name;
unsigned int idx;
enum mail_cache_field_type type;
unsigned int field_size;
};
/* Register fields. fields[].idx is updated to contain field index. */
struct mail_cache_field *fields,
unsigned int fields_count);
/* Returns registered field index, or (unsigned int)-1 if not found. */
unsigned int
/* Returns TRUE if cache should be compressed. */
/* Compress cache file. */
struct mail_cache_view *
/* Get index transaction specific cache transaction. */
struct mail_cache_transaction_ctx *
struct mail_index_transaction *t);
/* Add new field to given record. Updates are not allowed. Fixed size fields
must be exactly the expected size. */
/* Retursn 1 if field exists, 0 if not, -1 if error. */
unsigned int field);
/* Returns current caching decision for given field. */
/* Set data_r and size_r to point to wanted field in cache file.
Returns 1 if field was found, 0 if not, -1 if error. */
/* Return specified cached headers. Returns 1 if all fields were found,
0 if not, -1 if error. dest is updated only if all fields were found. */
unsigned int fields_count);
/* "Error in index cache file %s: ...". */
#endif