NeoMutt  2020-06-26-30-g76c339
Teaching an old dog new tricks
DOXYGEN
lib.h
Go to the documentation of this file.
1 
66 #ifndef MUTT_HCACHE_LIB_H
67 #define MUTT_HCACHE_LIB_H
68 
69 #include <stddef.h>
70 #include <stdint.h>
71 
72 struct Buffer;
73 struct Email;
74 
83 struct EmailCache
84 {
85  char *folder;
86  unsigned int crc;
87  void *ctx;
88  void *cctx;
89 };
90 
91 typedef struct EmailCache header_cache_t;
92 
97 {
98  uint32_t uidvalidity;
99  unsigned int crc;
100  struct Email *email;
101 };
102 
108 typedef void (*hcache_namer_t)(const char *path, struct Buffer *dest);
109 
110 /* These Config Variables are only used in hcache/hcache.c */
111 extern char *C_HeaderCacheBackend;
112 extern short C_HeaderCacheCompressLevel;
113 extern char *C_HeaderCacheCompressMethod;
114 
124 header_cache_t *mutt_hcache_open(const char *path, const char *folder, hcache_namer_t namer);
125 
131 
142 int mutt_hcache_store(header_cache_t *hc, const char *key, size_t keylen,
143  struct Email *e, uint32_t uidvalidity);
144 
156 struct HCacheEntry mutt_hcache_fetch(header_cache_t *hc, const char *key, size_t keylen, uint32_t uidvalidity);
157 
158 int mutt_hcache_store_raw(header_cache_t *hc, const char *key, size_t keylen,
159  void *data, size_t dlen);
160 
161 void *mutt_hcache_fetch_raw(header_cache_t *hc, const char *key, size_t keylen, size_t *dlen);
162 
168 void mutt_hcache_free_raw(header_cache_t *hc, void **data);
169 
178 int mutt_hcache_delete_header(header_cache_t *hc, const char *key, size_t keylen);
179 
180 #endif /* MUTT_HCACHE_LIB_H */
The envelope/body of an email.
Definition: email.h:37
int mutt_hcache_store_raw(header_cache_t *hc, const char *key, size_t keylen, void *data, size_t dlen)
store a key / data pair
Definition: hcache.c:588
void * mutt_hcache_fetch_raw(header_cache_t *hc, const char *key, size_t keylen, size_t *dlen)
Fetch a message&#39;s header from the cache.
Definition: hcache.c:501
Wrapper for Email retrieved from the header cache.
Definition: lib.h:96
int mutt_hcache_store(header_cache_t *hc, const char *key, size_t keylen, struct Email *e, uint32_t uidvalidity)
store a Header along with a validity datum
Definition: hcache.c:531
char * C_HeaderCacheCompressMethod
Config: (hcache) Enable generic hcache database compression.
Definition: hcache.c:70
void mutt_hcache_free_raw(header_cache_t *hc, void **data)
free data fetched with mutt_hcache_fetch_raw()
Definition: hcache.c:518
uint32_t uidvalidity
IMAP-specific UIDVALIDITY.
Definition: lib.h:98
String manipulation buffer.
Definition: buffer.h:33
char * folder
Definition: lib.h:85
void * cctx
Definition: lib.h:88
int mutt_hcache_delete_header(header_cache_t *hc, const char *key, size_t keylen)
delete a key / data pair
Definition: hcache.c:608
void mutt_hcache_close(header_cache_t *hc)
close the connection to the header cache
Definition: hcache.c:424
void(* hcache_namer_t)(const char *path, struct Buffer *dest)
Prototype for function to compose hcache file names.
Definition: lib.h:108
unsigned int crc
Definition: lib.h:86
void * ctx
Definition: lib.h:87
char * C_HeaderCacheBackend
Config: (hcache) Header cache backend to use.
Definition: hcache.c:62
struct HCacheEntry mutt_hcache_fetch(header_cache_t *hc, const char *key, size_t keylen, uint32_t uidvalidity)
fetch and validate a message&#39;s header from the cache
Definition: hcache.c:443
char * path
Path of Email (for local Mailboxes)
Definition: email.h:91
unsigned int crc
CRC of Email/Body/etc structs.
Definition: lib.h:99
struct Email * email
Retrieved email.
Definition: lib.h:100
header cache structure
Definition: lib.h:83
short C_HeaderCacheCompressLevel
Config: (hcache) Level of compression for method.
Definition: hcache.c:69
header_cache_t * mutt_hcache_open(const char *path, const char *folder, hcache_namer_t namer)
open the connection to the header cache
Definition: hcache.c:327