Header cache multiplexor. More...
#include <stddef.h>
#include <stdbool.h>
#include <stdint.h>
Go to the source code of this file.
Data Structures | |
struct | HeaderCache |
Header cache structure. More... | |
struct | HCacheEntry |
Wrapper for Email retrieved from the header cache. More... | |
Macros | |
#define | mutt_hcache_fetch_obj(hc, key, keylen, dst) mutt_hcache_fetch_obj_(hc, key, keylen, dst, sizeof(*dst)) |
Typedefs | |
typedef void(* | hcache_namer_t) (const char *path, struct Buffer *dest) |
Functions | |
struct HeaderCache * | mutt_hcache_open (const char *path, const char *folder, hcache_namer_t namer) |
Open the connection to the header cache. More... | |
void | mutt_hcache_close (struct HeaderCache *hc) |
Close the connection to the header cache. More... | |
int | mutt_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. More... | |
struct HCacheEntry | mutt_hcache_fetch (struct HeaderCache *hc, const char *key, size_t keylen, uint32_t uidvalidity) |
Fetch and validate a message's header from the cache. More... | |
char * | mutt_hcache_fetch_str (struct HeaderCache *hc, const char *key, size_t keylen) |
Fetch a string from the cache. More... | |
bool | mutt_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. More... | |
int | mutt_hcache_store_raw (struct HeaderCache *hc, const char *key, size_t keylen, void *data, size_t dlen) |
Store a key / data pair. More... | |
int | mutt_hcache_delete_record (struct HeaderCache *hc, const char *key, size_t keylen) |
Delete a key / data pair. More... | |
Header cache multiplexor.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file lib.h.
#define mutt_hcache_fetch_obj | ( | hc, | |
key, | |||
keylen, | |||
dst | |||
) | mutt_hcache_fetch_obj_(hc, key, keylen, dst, sizeof(*dst)) |
typedef void(* hcache_namer_t) (const char *path, struct Buffer *dest) |
struct HeaderCache * mutt_hcache_open | ( | const char * | path, |
const char * | folder, | ||
hcache_namer_t | namer | ||
) |
Open the connection to the header cache.
path | Location of the header cache (often as specified by the user) |
folder | Name of the folder containing the messages |
namer | Optional (might be NULL) client-specific function to form the final name of the hcache database file. |
ptr | Success, struct HeaderCache struct |
NULL | Otherwise |
Open the connection to the header cache.
< MD5 digest as a string
< MD5 digest as an integer
Definition at line 373 of file hcache.c.
void mutt_hcache_close | ( | struct HeaderCache * | hc | ) |
Close the connection to the header cache.
hc | Pointer to the struct HeaderCache structure got by mutt_hcache_open() |
Close the connection to the header cache.
Definition at line 483 of file hcache.c.
int mutt_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.
hc | Pointer to the struct HeaderCache structure got by mutt_hcache_open() |
key | Message identification string |
keylen | Length of the key string |
e | Email to store |
uidvalidity | IMAP-specific UIDVALIDITY value, or 0 to use the current time |
0 | Success |
num | Generic or backend-specific error code otherwise |
Store a Header along with a validity datum.
Definition at line 610 of file hcache.c.
struct HCacheEntry mutt_hcache_fetch | ( | struct HeaderCache * | hc, |
const char * | key, | ||
size_t | keylen, | ||
uint32_t | uidvalidity | ||
) |
Fetch and validate a message's header from the cache.
hc | Pointer to the struct HeaderCache structure got by mutt_hcache_open() |
key | Message identification string |
keylen | Length of the string pointed to by key |
uidvalidity | Only restore if it matches the stored uidvalidity |
obj | HCacheEntry containing an Email, empty on failure |
Fetch and validate a message's header from the cache.
Definition at line 507 of file hcache.c.
char * mutt_hcache_fetch_str | ( | struct HeaderCache * | hc, |
const char * | key, | ||
size_t | keylen | ||
) |
Fetch a string from the cache.
[in] | hc | Pointer to the struct HeaderCache structure got by mutt_hcache_open() |
[in] | key | Message identification string |
[in] | keylen | Length of the string pointed to by key |
ptr | Success, the data if found |
NULL | Otherwise |
Definition at line 594 of file hcache.c.
bool mutt_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.
[in] | hc | Pointer to the struct HeaderCache structure got by mutt_hcache_open() |
[in] | key | Message identification string |
[in] | keylen | Length of the string pointed to by key |
[out] | dst | Pointer to the destination object |
[in] | dstlen | Size of the destination object |
true | Success, the data was found and the length matches |
false | Otherwise |
Definition at line 568 of file hcache.c.
int mutt_hcache_store_raw | ( | struct HeaderCache * | hc, |
const char * | key, | ||
size_t | keylen, | ||
void * | data, | ||
size_t | dlen | ||
) |
Store a key / data pair.
hc | Pointer to the struct HeaderCache structure got by mutt_hcache_open() |
key | Message identification string |
keylen | Length of the string pointed to by key |
data | Payload to associate with key |
dlen | Length of the buffer pointed to by the data parameter |
0 | Success |
num | Generic or backend-specific error code otherwise |
Definition at line 668 of file hcache.c.
int mutt_hcache_delete_record | ( | struct HeaderCache * | hc, |
const char * | key, | ||
size_t | keylen | ||
) |
Delete a key / data pair.
hc | Pointer to the struct HeaderCache structure got by mutt_hcache_open() |
key | Message identification string |
keylen | Length of the string pointed to by key |
0 | Success |
num | Generic or backend-specific error code otherwise |
Delete a key / data pair.
Definition at line 689 of file hcache.c.