NeoMutt  2025-12-11-177-g48e272
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
114typedef void (*hcache_namer_t)(const char *path, struct Buffer *dest);
115
126struct HeaderCache *hcache_open(const char *path, const char *folder, hcache_namer_t namer, bool create);
127
134void hcache_close(struct HeaderCache **ptr);
135
146int hcache_store_email(struct HeaderCache *hc, const char *key, size_t keylen, struct Email *e, uint32_t uidvalidity);
147
159struct HCacheEntry hcache_fetch_email(struct HeaderCache *hc, const char *key, size_t keylen, uint32_t uidvalidity);
160
161char *hcache_fetch_raw_str(struct HeaderCache *hc, const char *key, size_t keylen);
162bool hcache_fetch_raw_obj_full(struct HeaderCache *hc, const char *key, size_t keylen, void *dst, size_t dstlen);
163#define hcache_fetch_raw_obj(hc, key, keylen, dst) hcache_fetch_raw_obj_full(hc, key, keylen, dst, sizeof(*dst))
164
165int hcache_store_raw(struct HeaderCache *hc, const char *key, size_t keylen,
166 void *data, size_t dlen);
167
176int hcache_delete_email(struct HeaderCache *hc, const char *key, size_t keylen);
177
186int hcache_delete_raw(struct HeaderCache *hc, const char *key, size_t keylen);
187
188#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:564
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:473
int hcache_delete_email(struct HeaderCache *hc, const char *key, size_t keylen)
Delete a key / data pair.
Definition hcache.c:741
void hcache_close(struct HeaderCache **ptr)
Close the connection to the header cache.
Definition hcache.c:544
void(* hcache_namer_t)(const char *path, struct Buffer *dest)
Definition lib.h:114
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:672
char * hcache_fetch_raw_str(struct HeaderCache *hc, const char *key, size_t keylen)
Fetch a string from the cache.
Definition hcache.c:654
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:625
int hcache_delete_raw(struct HeaderCache *hc, const char *key, size_t keylen)
Delete a key / data pair.
Definition hcache.c:754
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:726
Key value store.
void StoreHandle
Opaque type for store backend.
Definition lib.h:62
String manipulation buffer.
Definition buffer.h:36
Definition lib.h:65
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: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:70