Header cache multiplexor. More...
#include <stdbool.h>#include <stddef.h>#include <stdint.h>#include "compress/lib.h"#include "store/lib.h"
Include dependency graph for lib.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Data Structures | |
| struct | HeaderCache |
| Header Cache. More... | |
| struct | HCacheEntry |
| Wrapper for Email retrieved from the header cache. More... | |
Macros | |
| #define | hcache_fetch_raw_obj(hc, key, keylen, dst) hcache_fetch_raw_obj_full(hc, key, keylen, dst, sizeof(*dst)) |
Typedefs | |
| typedef void(* | hcache_namer_t) (const char *path, struct Buffer *dest) |
Functions | |
| struct HeaderCache * | hcache_open (const char *path, const char *folder, hcache_namer_t namer, bool create) |
| Open the connection to the header cache. | |
| void | hcache_close (struct HeaderCache **ptr) |
| Close the connection to the header cache. | |
| 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. | |
| 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. | |
| char * | hcache_fetch_raw_str (struct HeaderCache *hc, const char *key, size_t keylen) |
| Fetch a string from the cache. | |
| 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. | |
| int | hcache_store_raw (struct HeaderCache *hc, const char *key, size_t keylen, void *data, size_t dlen) |
| Store a key / data pair. | |
| int | hcache_delete_email (struct HeaderCache *hc, const char *key, size_t keylen) |
| Delete a key / data pair. | |
| int | hcache_delete_raw (struct HeaderCache *hc, const char *key, size_t keylen) |
| Delete a key / data pair. | |
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 hcache_fetch_raw_obj | ( | hc, | |
| key, | |||
| keylen, | |||
| dst | |||
| ) | hcache_fetch_raw_obj_full(hc, key, keylen, dst, sizeof(*dst)) |
| typedef void(* hcache_namer_t) (const char *path, struct Buffer *dest) |
| struct HeaderCache * hcache_open | ( | const char * | path, |
| const char * | folder, | ||
| hcache_namer_t | namer, | ||
| bool | create | ||
| ) |
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. |
| create | Create the file if it's not there? |
| ptr | Success, struct HeaderCache struct |
| NULL | Otherwise |
Open the connection to the header cache.
Definition at line 471 of file hcache.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void hcache_close | ( | struct HeaderCache ** | ptr | ) |
Close the connection to the header cache.
| ptr | Pointer to the struct HeaderCache structure got by hcache_open() |
Close the connection to the header cache.
Definition at line 542 of file hcache.c.
Here is the call graph for this function:
Here is the caller graph for this function:| 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.
| hc | Pointer to the struct HeaderCache structure got by 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 670 of file hcache.c.
Here is the call graph for this function:
Here is the caller graph for this function:| 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.
| hc | Pointer to the struct HeaderCache structure got by 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 562 of file hcache.c.
Here is the call graph for this function:
Here is the caller graph for this function:| char * hcache_fetch_raw_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 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 652 of file hcache.c.
Here is the call graph for this function:
Here is the caller graph for this function:| 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.
| [in] | hc | Pointer to the struct HeaderCache structure got by 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 623 of file hcache.c.
Here is the call graph for this function:| int 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 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 724 of file hcache.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int hcache_delete_email | ( | struct HeaderCache * | hc, |
| const char * | key, | ||
| size_t | keylen | ||
| ) |
Delete a key / data pair.
| hc | Pointer to the struct HeaderCache structure got by 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 739 of file hcache.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int hcache_delete_raw | ( | struct HeaderCache * | hc, |
| const char * | key, | ||
| size_t | keylen | ||
| ) |
Delete a key / data pair.
| hc | Pointer to the struct HeaderCache structure got by 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 752 of file hcache.c.
Here is the call graph for this function:
Here is the caller graph for this function: