NeoMutt  2024-04-16-36-g75b6fb
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 <stddef.h>
71#include <stdbool.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
124struct HeaderCache *hcache_open(const char *path, const char *folder, hcache_namer_t namer);
125
132void hcache_close(struct HeaderCache **ptr);
133
144int hcache_store_email(struct HeaderCache *hc, const char *key, size_t keylen, struct Email *e, uint32_t uidvalidity);
145
157struct HCacheEntry hcache_fetch_email(struct HeaderCache *hc, const char *key, size_t keylen, uint32_t uidvalidity);
158
159char *hcache_fetch_raw_str(struct HeaderCache *hc, const char *key, size_t keylen);
160bool hcache_fetch_raw_obj_full(struct HeaderCache *hc, const char *key, size_t keylen, void *dst, size_t dstlen);
161#define hcache_fetch_raw_obj(hc, key, keylen, dst) hcache_fetch_raw_obj_full(hc, key, keylen, dst, sizeof(*dst))
162
163int hcache_store_raw(struct HeaderCache *hc, const char *key, size_t keylen,
164 void *data, size_t dlen);
165
174int hcache_delete_email(struct HeaderCache *hc, const char *key, size_t keylen);
175
184int hcache_delete_raw(struct HeaderCache *hc, const char *key, size_t keylen);
185
186#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)
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:737
void hcache_close(struct HeaderCache **ptr)
Close the connection to the header cache.
Definition: hcache.c:540
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:560
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:668
char * hcache_fetch_raw_str(struct HeaderCache *hc, const char *key, size_t keylen)
Fetch a string from the cache.
Definition: hcache.c:650
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:621
int hcache_delete_raw(struct HeaderCache *hc, const char *key, size_t keylen)
Delete a key / data pair.
Definition: hcache.c:750
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:722
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