Fix FSF address (Tobias Mueller, #470445)
[platform/upstream/evolution-data-server.git] / camel / camel-data-cache.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /* camel-data-cache.h: Class for a Camel filesystem cache
3  *
4  * Authors: Michael Zucchi <notzed@ximian.com>
5  *
6  * Copyright (C) 2001 Ximian, Inc. (www.ximian.com)
7  *
8  * This program is free software; you can redistribute it and/or 
9  * modify it under the terms of version 2 of the GNU Lesser General Public 
10  * License as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
20  * USA
21  */
22
23
24 #ifndef CAMEL_DATA_CACHE_H
25 #define CAMEL_DATA_CACHE_H 1
26
27 #include <glib.h>
28
29 #include <camel/camel-stream.h>
30 #include <camel/camel-exception.h>
31
32 #define CAMEL_DATA_CACHE_TYPE     (camel_data_cache_get_type ())
33 #define CAMEL_DATA_CACHE(obj)     (CAMEL_CHECK_CAST((obj), CAMEL_DATA_CACHE_TYPE, CamelFolder))
34 #define CAMEL_DATA_CACHE_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_DATA_CACHE_TYPE, CamelFolderClass))
35 #define CAMEL_IS_DATA_CACHE(o)    (CAMEL_CHECK_TYPE((o), CAMEL_DATA_CACHE_TYPE))
36
37 G_BEGIN_DECLS
38
39 typedef struct _CamelDataCache CamelDataCache;
40 typedef struct _CamelDataCacheClass CamelDataCacheClass;
41
42 struct _CamelDataCache {
43         CamelObject parent_object;
44
45         struct _CamelDataCachePrivate *priv;
46
47         char *path;
48         guint32 flags;
49
50         time_t expire_age;
51         time_t expire_access;
52 };
53
54 struct _CamelDataCacheClass {
55         CamelObjectClass parent_class;
56
57         /* None are virtual yet */
58 #if 0
59         /* Virtual methods */
60         CamelStream *(*add)(CamelDataCache *cmc, const char *path, const char *key, CamelException *ex);
61         CamelStream *(*get)(CamelDataCache *cmc, const char *path, const char *key, CamelException *ex);
62         int (*close)(CamelDataCache *cmc, CamelStream *stream, CamelException *ex);
63         int (*remove)(CamelDataCache *cmc, const char *path, const char *key, CamelException *ex);
64
65         int (*clear)(CamelDataCache *cmc, const char *path, CamelException *ex);
66 #endif
67 };
68
69 /* public methods */
70 CamelDataCache *camel_data_cache_new(const char *path, guint32 flags, CamelException *ex);
71
72 void camel_data_cache_set_expire_age(CamelDataCache *cache, time_t when);
73 void camel_data_cache_set_expire_access(CamelDataCache *cdc, time_t when);
74
75 int             camel_data_cache_rename(CamelDataCache *cache,
76                                         const char *old, const char *new, CamelException *ex);
77
78 CamelStream    *camel_data_cache_add(CamelDataCache *cache,
79                                      const char *path, const char *key, CamelException *ex);
80 CamelStream    *camel_data_cache_get(CamelDataCache *cache,
81                                      const char *path, const char *key, CamelException *ex);
82 int             camel_data_cache_remove(CamelDataCache *cache,
83                                         const char *path, const char *key, CamelException *ex);
84
85 int             camel_data_cache_clear(CamelDataCache *cache,
86                                        const char *path, CamelException *ex);
87
88 /* Standard Camel function */
89 CamelType camel_data_cache_get_type (void);
90
91 G_END_DECLS
92
93 #endif /* CAMEL_DATA_CACHE_H */