NeoMutt  2022-04-29-81-g9c5a59
Teaching an old dog new tricks
DOXYGEN
lib.h
Go to the documentation of this file.
1 
69 #ifndef MUTT_HCACHE_LIB_H
70 #define MUTT_HCACHE_LIB_H
71 
72 #include <stddef.h>
73 #include <stdint.h>
74 
75 struct Buffer;
76 struct Email;
77 
87 {
88  char *folder;
89  unsigned int crc;
90  void *ctx;
91  void *cctx;
92 };
93 
98 {
99  uint32_t uidvalidity;
100  unsigned int crc;
101  struct Email *email;
102 };
103 
112 typedef void (*hcache_namer_t)(const char *path, struct Buffer *dest);
113 
123 struct HeaderCache *mutt_hcache_open(const char *path, const char *folder, hcache_namer_t namer);
124 
129 void mutt_hcache_close(struct HeaderCache *hc);
130 
141 int mutt_hcache_store(struct HeaderCache *hc, const char *key, size_t keylen,
142  struct Email *e, uint32_t uidvalidity);
143 
155 struct HCacheEntry mutt_hcache_fetch(struct HeaderCache *hc, const char *key, size_t keylen, uint32_t uidvalidity);
156 
157 int mutt_hcache_store_raw(struct HeaderCache *hc, const char *key, size_t keylen,
158  void *data, size_t dlen);
159 
160 void *mutt_hcache_fetch_raw(struct HeaderCache *hc, const char *key, size_t keylen, size_t *dlen);
161 
167 void mutt_hcache_free_raw(struct HeaderCache *hc, void **data);
168 
177 int mutt_hcache_delete_record(struct HeaderCache *hc, const char *key, size_t keylen);
178 
179 #endif /* MUTT_HCACHE_LIB_H */
int mutt_hcache_store(struct HeaderCache *hc, const char *key, size_t keylen, struct Email *e, uint32_t uidvalidity)
Store a Header along with a validity datum.
Definition: hcache.c:548
struct HeaderCache * mutt_hcache_open(const char *path, const char *folder, hcache_namer_t namer)
Open the connection to the header cache.
Definition: hcache.c:332
void mutt_hcache_close(struct HeaderCache *hc)
Close the connection to the header cache.
Definition: hcache.c:432
int mutt_hcache_delete_record(struct HeaderCache *hc, const char *key, size_t keylen)
Delete a key / data pair.
Definition: hcache.c:627
int mutt_hcache_store_raw(struct HeaderCache *hc, const char *key, size_t keylen, void *data, size_t dlen)
Store a key / data pair.
Definition: hcache.c:606
void(* hcache_namer_t)(const char *path, struct Buffer *dest)
Definition: lib.h:112
struct HCacheEntry mutt_hcache_fetch(struct HeaderCache *hc, const char *key, size_t keylen, uint32_t uidvalidity)
Fetch and validate a message's header from the cache.
Definition: hcache.c:456
void mutt_hcache_free_raw(struct HeaderCache *hc, void **data)
Free data fetched with mutt_hcache_fetch_raw()
Definition: hcache.c:534
void * mutt_hcache_fetch_raw(struct HeaderCache *hc, const char *key, size_t keylen, size_t *dlen)
Fetch a message's header from the cache.
Definition: hcache.c:515
String manipulation buffer.
Definition: buffer.h:34
The envelope/body of an email.
Definition: email.h:37
char * path
Path of Email (for local Mailboxes)
Definition: email.h:68
Wrapper for Email retrieved from the header cache.
Definition: lib.h:98
uint32_t uidvalidity
IMAP-specific UIDVALIDITY.
Definition: lib.h:99
struct Email * email
Retrieved email.
Definition: lib.h:101
unsigned int crc
CRC of Email/Body/etc structs.
Definition: lib.h:100
Header cache structure.
Definition: lib.h:87
void * ctx
Store context (handle)
Definition: lib.h:90
unsigned int crc
CRC of the cache entry.
Definition: lib.h:89
char * folder
Folder name.
Definition: lib.h:88
void * cctx
Compression context (handle)
Definition: lib.h:91