NeoMutt  2025-12-11-769-g906513
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
lib.h
Go to the documentation of this file.
1
24
67
68#ifndef MUTT_HCACHE_LIB_H
69#define MUTT_HCACHE_LIB_H
70
71#include <stdbool.h>
72#include <stddef.h>
73#include <stdint.h>
74#include "compress/lib.h"
75#include "store/lib.h"
76
77struct Buffer;
78struct Email;
79
87{
88 char *folder;
89 unsigned int crc;
90 const struct StoreOps *store_ops;
92 const struct ComprOps *compr_ops;
94};
95
100{
101 uint32_t uidvalidity;
102 unsigned int crc;
103 struct Email *email;
104};
105
119typedef void (*hcache_namer_t)(const struct StoreOps *store_ops, const char *path, struct Buffer *dest);
120
131struct HeaderCache *hcache_open(const char *path, const char *folder, hcache_namer_t namer, bool create);
132
139void hcache_close(struct HeaderCache **ptr);
140
151int hcache_store_email(struct HeaderCache *hc, const char *key, size_t keylen, struct Email *e, uint32_t uidvalidity);
152
164struct HCacheEntry hcache_fetch_email(struct HeaderCache *hc, const char *key, size_t keylen, uint32_t uidvalidity);
165
166char *hcache_fetch_raw_str(struct HeaderCache *hc, const char *key, size_t keylen);
167bool hcache_fetch_raw_obj_full(struct HeaderCache *hc, const char *key, size_t keylen, void *dst, size_t dstlen);
168#define hcache_fetch_raw_obj(hc, key, keylen, dst) hcache_fetch_raw_obj_full(hc, key, keylen, dst, sizeof(*dst))
169
170int hcache_store_raw(struct HeaderCache *hc, const char *key, size_t keylen,
171 void *data, size_t dlen);
172
181int hcache_delete_email(struct HeaderCache *hc, const char *key, size_t keylen);
182
191int hcache_delete_raw(struct HeaderCache *hc, const char *key, size_t keylen);
192
193#endif /* MUTT_HCACHE_LIB_H */
API for the header cache compression.
void ComprHandle
Opaque type for compression data.
Definition lib.h:57
struct HCacheEntry hcache_fetch_email(struct HeaderCache *hc, const char *key, size_t keylen, uint32_t uidvalidity)
Multiplexor for StoreOps::fetch.
Definition hcache.c:569
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:477
int hcache_delete_email(struct HeaderCache *hc, const char *key, size_t keylen)
Delete a key / data pair.
Definition hcache.c:752
void hcache_close(struct HeaderCache **ptr)
Close the connection to the header cache.
Definition hcache.c:549
void(* hcache_namer_t)(const struct StoreOps *store_ops, const char *path, struct Buffer *dest)
Definition lib.h:119
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:683
char * hcache_fetch_raw_str(struct HeaderCache *hc, const char *key, size_t keylen)
Fetch a string from the cache.
Definition hcache.c:662
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:630
int hcache_delete_raw(struct HeaderCache *hc, const char *key, size_t keylen)
Delete a key / data pair.
Definition hcache.c:765
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:737
Key value store.
void StoreHandle
Opaque type for store backend.
Definition lib.h:58
String manipulation buffer.
Definition buffer.h:36
Definition lib.h:65
The envelope/body of an email.
Definition email.h:39
Wrapper for Email retrieved from the header cache.
Definition lib.h:100
uint32_t uidvalidity
IMAP-specific UIDVALIDITY.
Definition lib.h:101
struct Email * email
Retrieved email.
Definition lib.h:103
unsigned int crc
CRC of Email/Body/etc structs.
Definition lib.h:102
Header Cache.
Definition lib.h:87
ComprHandle * compr_handle
Compression handle.
Definition lib.h:93
unsigned int crc
CRC of the cache entry.
Definition lib.h:89
char * folder
Folder name.
Definition lib.h:88
const struct StoreOps * store_ops
Store backend.
Definition lib.h:90
StoreHandle * store_handle
Store handle.
Definition lib.h:91
const struct ComprOps * compr_ops
Compression backend.
Definition lib.h:92
Definition lib.h:66