NeoMutt  2024-11-14-138-ge5ca67
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
lib.h
Go to the documentation of this file.
1
67#ifndef MUTT_HCACHE_LIB_H
68#define MUTT_HCACHE_LIB_H
69
70#include <stdbool.h>
71#include <stddef.h>
72#include <stdint.h>
73#include "compress/lib.h"
74#include "store/lib.h"
75
76struct Buffer;
77struct Email;
78
86{
87 char *folder;
88 unsigned int crc;
89 const struct StoreOps *store_ops;
91 const struct ComprOps *compr_ops;
93};
94
99{
100 uint32_t uidvalidity;
101 unsigned int crc;
102 struct Email *email;
103};
104
113typedef void (*hcache_namer_t)(const char *path, struct Buffer *dest);
114
125struct HeaderCache *hcache_open(const char *path, const char *folder, hcache_namer_t namer, bool create);
126
133void hcache_close(struct HeaderCache **ptr);
134
145int hcache_store_email(struct HeaderCache *hc, const char *key, size_t keylen, struct Email *e, uint32_t uidvalidity);
146
158struct HCacheEntry hcache_fetch_email(struct HeaderCache *hc, const char *key, size_t keylen, uint32_t uidvalidity);
159
160char *hcache_fetch_raw_str(struct HeaderCache *hc, const char *key, size_t keylen);
161bool hcache_fetch_raw_obj_full(struct HeaderCache *hc, const char *key, size_t keylen, void *dst, size_t dstlen);
162#define hcache_fetch_raw_obj(hc, key, keylen, dst) hcache_fetch_raw_obj_full(hc, key, keylen, dst, sizeof(*dst))
163
164int hcache_store_raw(struct HeaderCache *hc, const char *key, size_t keylen,
165 void *data, size_t dlen);
166
175int hcache_delete_email(struct HeaderCache *hc, const char *key, size_t keylen);
176
185int hcache_delete_raw(struct HeaderCache *hc, const char *key, size_t keylen);
186
187#endif /* MUTT_HCACHE_LIB_H */
API for the header cache compression.
void ComprHandle
Opaque type for compression data.
Definition: lib.h:56
struct HeaderCache * hcache_open(const char *path, const char *folder, hcache_namer_t namer, bool create)
Open the connection to the header cache.
Definition: hcache.c:471
int hcache_delete_email(struct HeaderCache *hc, const char *key, size_t keylen)
Delete a key / data pair.
Definition: hcache.c:739
void hcache_close(struct HeaderCache **ptr)
Close the connection to the header cache.
Definition: hcache.c:542
void(* hcache_namer_t)(const char *path, struct Buffer *dest)
Definition: lib.h:113
struct HCacheEntry hcache_fetch_email(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:562
int hcache_store_email(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:670
char * hcache_fetch_raw_str(struct HeaderCache *hc, const char *key, size_t keylen)
Fetch a string from the cache.
Definition: hcache.c:652
bool hcache_fetch_raw_obj_full(struct HeaderCache *hc, const char *key, size_t keylen, void *dst, size_t dstlen)
Fetch a message's header from the cache into a destination object.
Definition: hcache.c:623
int hcache_delete_raw(struct HeaderCache *hc, const char *key, size_t keylen)
Delete a key / data pair.
Definition: hcache.c:752
int 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:724
Key value store.
void StoreHandle
Opaque type for store backend.
Definition: lib.h:61
String manipulation buffer.
Definition: buffer.h:36
Definition: lib.h:64
The envelope/body of an email.
Definition: email.h:39
char * path
Path of Email (for local Mailboxes)
Definition: email.h:70
Wrapper for Email retrieved from the header cache.
Definition: lib.h:99
uint32_t uidvalidity
IMAP-specific UIDVALIDITY.
Definition: lib.h:100
struct Email * email
Retrieved email.
Definition: lib.h:102
unsigned int crc
CRC of Email/Body/etc structs.
Definition: lib.h:101
Header Cache.
Definition: lib.h:86
ComprHandle * compr_handle
Compression handle.
Definition: lib.h:92
unsigned int crc
CRC of the cache entry.
Definition: lib.h:88
char * folder
Folder name.
Definition: lib.h:87
const struct StoreOps * store_ops
Store backend.
Definition: lib.h:89
StoreHandle * store_handle
Store handle.
Definition: lib.h:90
const struct ComprOps * compr_ops
Compression backend.
Definition: lib.h:91
Definition: lib.h:69