NeoMutt  2024-10-02-37-gfa9146
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
lib.h
Go to the documentation of this file.
1
54#ifndef MUTT_STORE_LIB_H
55#define MUTT_STORE_LIB_H
56
57#include <stdbool.h>
58#include <stdlib.h>
59
61typedef void StoreHandle;
62
69{
70 const char *name;
71
86 StoreHandle *(*open)(const char *path, bool create);
87
100 void *(*fetch)(StoreHandle *store, const char *key, size_t klen, size_t *vlen);
101
110 void (*free)(StoreHandle *store, void **ptr);
111
125 int (*store)(StoreHandle *store, const char *key, size_t klen, void *value, size_t vlen);
126
138 int (*delete_record)(StoreHandle *store, const char *key, size_t klen);
139
147 void (*close)(StoreHandle **ptr);
148
156 const char *(*version)(void);
157};
158
159const char * store_backend_list(void);
160const struct StoreOps *store_get_backend_ops(const char *str);
161bool store_is_valid_backend(const char *str);
162
163#define STORE_BACKEND_OPS(_name) \
164 const struct StoreOps store_##_name##_ops = { \
165 .name = #_name, \
166 .open = store_##_name##_open, \
167 .fetch = store_##_name##_fetch, \
168 .free = store_##_name##_free, \
169 .store = store_##_name##_store, \
170 .delete_record = store_##_name##_delete_record, \
171 .close = store_##_name##_close, \
172 .version = store_##_name##_version, \
173 };
174
175#endif /* MUTT_STORE_LIB_H */
void StoreHandle
Opaque type for store backend.
Definition: lib.h:61
bool store_is_valid_backend(const char *str)
Is the string a valid Store backend.
Definition: store.c:129
const struct StoreOps * store_get_backend_ops(const char *str)
Get the API functions for an store backend.
Definition: store.c:107
const char * store_backend_list(void)
Get a list of backend names.
Definition: store.c:84
Definition: lib.h:69
void(* close)(StoreHandle **ptr)
Definition: lib.h:147
int(* store)(StoreHandle *store, const char *key, size_t klen, void *value, size_t vlen)
Definition: lib.h:125
const char * name
Store name.
Definition: lib.h:70
int(* delete_record)(StoreHandle *store, const char *key, size_t klen)
Definition: lib.h:138
void(* free)(StoreHandle *store, void **ptr)
Definition: lib.h:110