File: filter-kvs.h

package info (click to toggle)
sylfilter 0.8-7
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 2,124 kB
  • sloc: ansic: 12,806; sh: 8,910; makefile: 349
file content (60 lines) | stat: -rw-r--r-- 2,129 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/* SylFilter - a message filter
 *
 * Copyright (C) 2011 Hiroyuki Yamamoto
 * Copyright (C) 2011 Sylpheed Development Team
 */

#ifndef __FILTER_KVS_H__
#define __FILTER_KVS_H__

typedef struct _XFilterKVS	XFilterKVS;

typedef int (*XFilterKVSForeachFunc) (XFilterKVS *kvs, const char *key, void *value, int size, void *data);

typedef struct _XFilterKVSEngine
{
	XFilterKVS * (*open)	(const char *dbfile);
	int (*close)		(XFilterKVS *kvs);
	int (*insert)		(XFilterKVS *kvs, const char *key, void *value,
				 int size);
	int (*delete)		(XFilterKVS *kvs, const char *key);
	int (*update)		(XFilterKVS *kvs, const char *key, void *value,
				 int size);
	int (*fetch)		(XFilterKVS *kvs, const char *key, void *vbuf, int vsize);
	int (*begin)		(XFilterKVS *kvs);
	int (*end)		(XFilterKVS *kvs);
	int (*size)		(XFilterKVS *kvs);
	int (*foreach)		(XFilterKVS *kvs, XFilterKVSForeachFunc func, void *data);
} XFilterKVSEngine;

int xfilter_kvs_set_engine	(XFilterKVSEngine *engine);

XFilterKVS *xfilter_kvs_new	(const char *dbfile, void *dbhandle);
const char *xfilter_kvs_get_file(XFilterKVS *kvs);
void *xfilter_kvs_get_handle	(XFilterKVS *kvs);

XFilterKVS *xfilter_kvs_open	(const char *dbfile);
int xfilter_kvs_close		(XFilterKVS *kvs);

int xfilter_kvs_insert		(XFilterKVS *kvs, const char *key, void *value,
				 int size);
int xfilter_kvs_delete		(XFilterKVS *kvs, const char *key);
int xfilter_kvs_update		(XFilterKVS *kvs, const char *key, void *value,
				 int size);
int xfilter_kvs_fetch		(XFilterKVS *kvs, const char *key, void *vbuf, int vsize);
int xfilter_kvs_begin		(XFilterKVS *kvs);
int xfilter_kvs_end		(XFilterKVS *kvs);

int xfilter_kvs_get_record_size	(XFilterKVS *kvs);

int xfilter_kvs_foreach		(XFilterKVS *kvs, XFilterKVSForeachFunc func, void *data);

int xfilter_kvs_fetch_int	(XFilterKVS *kvs, const char *key);
int xfilter_kvs_set_int		(XFilterKVS *kvs, const char *key, int num);

int xfilter_kvs_increment	(XFilterKVS *kvs, const char *key, int num);
int xfilter_kvs_decrement	(XFilterKVS *kvs, const char *key, int num);

int xfilter_kvs_count_sum	(XFilterKVS *kvs);

#endif /* __FILTER_KVS_H__ */