NeoMutt  2025-12-11-694-ga89709
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
lib.h
Go to the documentation of this file.
1
23
50
51#ifndef MUTT_STORE_LIB_H
52#define MUTT_STORE_LIB_H
53
54#include <stdbool.h>
55#include <stdlib.h>
56
58typedef void StoreHandle;
59
66{
67 const char *name;
68
83 StoreHandle *(*open)(const char *path, bool create);
84
97 void *(*fetch)(StoreHandle *store, const char *key, size_t klen, size_t *vlen);
98
107 void (*free)(StoreHandle *store, void **ptr);
108
122 int (*store)(StoreHandle *store, const char *key, size_t klen, void *value, size_t vlen);
123
135 int (*delete_record)(StoreHandle *store, const char *key, size_t klen);
136
144 void (*close)(StoreHandle **ptr);
145
153 const char *(*version)(void);
154};
155
156struct Slist * store_backend_list(void);
157const struct StoreOps *store_get_backend_ops(const char *str);
158bool store_is_valid_backend(const char *str);
159
160#define STORE_BACKEND_OPS(_name) \
161 const struct StoreOps store_##_name##_ops = { \
162 .name = #_name, \
163 .open = store_##_name##_open, \
164 .fetch = store_##_name##_fetch, \
165 .free = store_##_name##_free, \
166 .store = store_##_name##_store, \
167 .delete_record = store_##_name##_delete_record, \
168 .close = store_##_name##_close, \
169 .version = store_##_name##_version, \
170 };
171
172#endif /* MUTT_STORE_LIB_H */
void StoreHandle
Opaque type for store backend.
Definition lib.h:58
bool store_is_valid_backend(const char *str)
Is the string a valid Store backend.
Definition store.c:110
struct Slist * store_backend_list(void)
Get a list of backend names.
Definition store.c:69
const struct StoreOps * store_get_backend_ops(const char *str)
Get the API functions for an store backend.
Definition store.c:88
String list.
Definition slist.h:37
Definition lib.h:66
void(* close)(StoreHandle **ptr)
Definition lib.h:144
int(* store)(StoreHandle *store, const char *key, size_t klen, void *value, size_t vlen)
Definition lib.h:122
const char * name
Store name.
Definition lib.h:67
int(* delete_record)(StoreHandle *store, const char *key, size_t klen)
Definition lib.h:135
void(* free)(StoreHandle *store, void **ptr)
Definition lib.h:107