root / lib / filter-kvs.h @ aebfd4cc
History | View | Annotate | Download (1.9 kB)
| 1 | /* SylFilter - a message filter
|
|---|---|
| 2 | * |
| 3 | * Copyright (C) 2011 Hiroyuki Yamamoto |
| 4 | * Copyright (C) 2011 Sylpheed Development Team |
| 5 | */ |
| 6 | |
| 7 | #ifndef __FILTER_KVS_H__
|
| 8 | #define __FILTER_KVS_H__
|
| 9 | |
| 10 | typedef struct _XFilterKVS XFilterKVS; |
| 11 | |
| 12 | typedef int (*XFilterKVSForeachFunc) (XFilterKVS *kvs, const char *key, void *value, int size, void *data); |
| 13 | |
| 14 | typedef struct _XFilterKVSEngine |
| 15 | {
|
| 16 | XFilterKVS * (*open) (const char *dbfile); |
| 17 | int (*close) (XFilterKVS *kvs);
|
| 18 | int (*insert) (XFilterKVS *kvs, const char *key, void *value, |
| 19 | int size);
|
| 20 | int (*delete) (XFilterKVS *kvs, const char *key); |
| 21 | int (*update) (XFilterKVS *kvs, const char *key, void *value, |
| 22 | int size);
|
| 23 | int (*fetch) (XFilterKVS *kvs, const char *key, void *vbuf, int vsize); |
| 24 | int (*size) (XFilterKVS *kvs);
|
| 25 | int (*foreach) (XFilterKVS *kvs, XFilterKVSForeachFunc func, void *data); |
| 26 | } XFilterKVSEngine; |
| 27 | |
| 28 | int xfilter_kvs_set_engine (XFilterKVSEngine *engine);
|
| 29 | |
| 30 | XFilterKVS *xfilter_kvs_new (const char *dbfile, void *dbhandle); |
| 31 | const char *xfilter_kvs_get_file(XFilterKVS *kvs); |
| 32 | void *xfilter_kvs_get_handle (XFilterKVS *kvs);
|
| 33 | |
| 34 | XFilterKVS *xfilter_kvs_open (const char *dbfile); |
| 35 | int xfilter_kvs_close (XFilterKVS *kvs);
|
| 36 | |
| 37 | int xfilter_kvs_insert (XFilterKVS *kvs, const char *key, void *value, |
| 38 | int size);
|
| 39 | int xfilter_kvs_delete (XFilterKVS *kvs, const char *key); |
| 40 | int xfilter_kvs_update (XFilterKVS *kvs, const char *key, void *value, |
| 41 | int size);
|
| 42 | int xfilter_kvs_fetch (XFilterKVS *kvs, const char *key, void *vbuf, int vsize); |
| 43 | |
| 44 | int xfilter_kvs_get_record_size (XFilterKVS *kvs);
|
| 45 | |
| 46 | int xfilter_kvs_foreach (XFilterKVS *kvs, XFilterKVSForeachFunc func, void *data); |
| 47 | |
| 48 | int xfilter_kvs_fetch_int (XFilterKVS *kvs, const char *key); |
| 49 | |
| 50 | int xfilter_kvs_increment (XFilterKVS *kvs, const char *key, int num); |
| 51 | int xfilter_kvs_decrement (XFilterKVS *kvs, const char *key, int num); |
| 52 | |
| 53 | int xfilter_kvs_count_sum (XFilterKVS *kvs);
|
| 54 | |
| 55 | #endif /* __FILTER_KVS_H__ */ |