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
23
54
55#ifndef MUTT_STORE_LIB_H
56#define MUTT_STORE_LIB_H
57
58#include <stdbool.h>
59#include <stdlib.h>
60
62typedef void StoreHandle;
63
70{
71 const char *name;
72
87 StoreHandle *(*open)(const char *path, bool create);
88
101 void *(*fetch)(StoreHandle *store, const char *key, size_t klen, size_t *vlen);
102
111 void (*free)(StoreHandle *store, void **ptr);
112
126 int (*store)(StoreHandle *store, const char *key, size_t klen, void *value, size_t vlen);
127
139 int (*delete_record)(StoreHandle *store, const char *key, size_t klen);
140
148 void (*close)(StoreHandle **ptr);
149
157 const char *(*version)(void);
158};
159
160struct Slist * store_backend_list(void);
161const struct StoreOps *store_get_backend_ops(const char *str);
162bool store_is_valid_backend(const char *str);
163
164#define STORE_BACKEND_OPS(_name) \
165 const struct StoreOps store_##_name##_ops = { \
166 .name = #_name, \
167 .open = store_##_name##_open, \
168 .fetch = store_##_name##_fetch, \
169 .free = store_##_name##_free, \
170 .store = store_##_name##_store, \
171 .delete_record = store_##_name##_delete_record, \
172 .close = store_##_name##_close, \
173 .version = store_##_name##_version, \
174 };
175
176#endif /* MUTT_STORE_LIB_H */
void StoreHandle
Opaque type for store backend.
Definition lib.h:62
bool store_is_valid_backend(const char *str)
Is the string a valid Store backend.
Definition store.c:126
struct Slist * store_backend_list(void)
Get a list of backend names.
Definition store.c:85
const struct StoreOps * store_get_backend_ops(const char *str)
Get the API functions for an store backend.
Definition store.c:104
String list.
Definition slist.h:37
Definition lib.h:70
void(* close)(StoreHandle **ptr)
Definition lib.h:148
int(* store)(StoreHandle *store, const char *key, size_t klen, void *value, size_t vlen)
Definition lib.h:126
const char * name
Store name.
Definition lib.h:71
int(* delete_record)(StoreHandle *store, const char *key, size_t klen)
Definition lib.h:139
void(* free)(StoreHandle *store, void **ptr)
Definition lib.h:111