NeoMutt
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
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 <stdbool.h>
74#include <stdint.h>
75#include "compress/lib.h"
76#include "store/lib.h"
77
78struct Buffer;
79struct Email;
80
88{
89 char *folder;
90 unsigned int crc;
91 const struct StoreOps *store_ops;
93 const struct ComprOps *compr_ops;
95};
96
101{
102 uint32_t uidvalidity;
103 unsigned int crc;
104 struct Email *email;
105};
106
115typedef void (*hcache_namer_t)(const char *path, struct Buffer *dest);
116
126struct HeaderCache *hcache_open(const char *path, const char *folder, hcache_namer_t namer);
127
134void hcache_close(struct HeaderCache **ptr);
135
146int hcache_store(struct HeaderCache *hc, const char *key, size_t keylen,
147 struct Email *e, uint32_t uidvalidity);
148
160struct HCacheEntry hcache_fetch(struct HeaderCache *hc, const char *key, size_t keylen, uint32_t uidvalidity);
161
162char *hcache_fetch_str(struct HeaderCache *hc, const char *key, size_t keylen);
163bool hcache_fetch_obj_(struct HeaderCache *hc, const char *key, size_t keylen, void *dst, size_t dstlen);
164#define hcache_fetch_obj(hc, key, keylen, dst) hcache_fetch_obj_(hc, key, keylen, dst, sizeof(*dst))
165
166int hcache_store_raw(struct HeaderCache *hc, const char *key, size_t keylen,
167 void *data, size_t dlen);
168
177int hcache_delete_record(struct HeaderCache *hc, const char *key, size_t keylen);
178
179#endif /* MUTT_HCACHE_LIB_H */
API for the header cache compression.
void ComprHandle
Opaque type for compression data.
Definition: lib.h:55
int 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:686
bool hcache_fetch_obj_(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:644
struct HCacheEntry 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:583
char * hcache_fetch_str(struct HeaderCache *hc, const char *key, size_t keylen)
Fetch a string from the cache.
Definition: hcache.c:670
struct HeaderCache * hcache_open(const char *path, const char *folder, hcache_namer_t namer)
Open the connection to the header cache.
Definition: hcache.c:494
void hcache_close(struct HeaderCache **ptr)
Close the connection to the header cache.
Definition: hcache.c:563
void(* hcache_namer_t)(const char *path, struct Buffer *dest)
Definition: lib.h:115
int hcache_delete_record(struct HeaderCache *hc, const char *key, size_t keylen)
Delete a key / data pair.
Definition: hcache.c:759
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:741
Key value store.
void StoreHandle
Opaque type for store backend.
Definition: lib.h:61
String manipulation buffer.
Definition: buffer.h:34
Definition: lib.h:63
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:101
uint32_t uidvalidity
IMAP-specific UIDVALIDITY.
Definition: lib.h:102
struct Email * email
Retrieved email.
Definition: lib.h:104
unsigned int crc
CRC of Email/Body/etc structs.
Definition: lib.h:103
Header Cache.
Definition: lib.h:88
ComprHandle * compr_handle
Compression handle.
Definition: lib.h:94
unsigned int crc
CRC of the cache entry.
Definition: lib.h:90
char * folder
Folder name.
Definition: lib.h:89
const struct StoreOps * store_ops
Store backend.
Definition: lib.h:91
StoreHandle * store_handle
Store handle.
Definition: lib.h:92
const struct ComprOps * compr_ops
Compression backend.
Definition: lib.h:93
Definition: lib.h:69