NeoMutt  2024-03-23-142-g2b2e76
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
85 StoreHandle *(*open)(const char *path);
86
99 void *(*fetch)(StoreHandle *store, const char *key, size_t klen, size_t *vlen);
100
109 void (*free)(StoreHandle *store, void **ptr);
110
124 int (*store)(StoreHandle *store, const char *key, size_t klen, void *value, size_t vlen);
125
137 int (*delete_record)(StoreHandle *store, const char *key, size_t klen);
138
146 void (*close)(StoreHandle **ptr);
147
155 const char *(*version)(void);
156};
157
158const char * store_backend_list(void);
159const struct StoreOps *store_get_backend_ops(const char *str);
160bool store_is_valid_backend(const char *str);
161
162#define STORE_BACKEND_OPS(_name) \
163 const struct StoreOps store_##_name##_ops = { \
164 .name = #_name, \
165 .open = store_##_name##_open, \
166 .fetch = store_##_name##_fetch, \
167 .free = store_##_name##_free, \
168 .store = store_##_name##_store, \
169 .delete_record = store_##_name##_delete_record, \
170 .close = store_##_name##_close, \
171 .version = store_##_name##_version, \
172 };
173
174#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:146
int(* store)(StoreHandle *store, const char *key, size_t klen, void *value, size_t vlen)
Definition: lib.h:124
const char * name
Store name.
Definition: lib.h:70
int(* delete_record)(StoreHandle *store, const char *key, size_t klen)
Definition: lib.h:137
void(* free)(StoreHandle *store, void **ptr)
Definition: lib.h:109