1 /*
2  * ROX-Filer, filer for the ROX desktop project
3  * Thomas Leonard, <tal197@users.sourceforge.net>
4  */
5 
6 
7 #ifndef _FSCACHE_H
8 #define _FSCACHE_H
9 
10 #include <sys/stat.h>
11 #include <unistd.h>
12 #include <stdlib.h>
13 #include <time.h>
14 #include <glib.h>
15 #include <glib-object.h>
16 
17 typedef GObject *(*GFSLoadFunc)(const char *pathname, gpointer user_data);
18 typedef void (*GFSUpdateFunc)(gpointer object,
19 			      const char *pathname,
20 			      gpointer user_data);
21 typedef enum {
22 	FSCACHE_LOOKUP_CREATE,	/* Load if missing. Update as needed. */
23 	FSCACHE_LOOKUP_ONLY_NEW,/* Return NULL if not present AND uptodate */
24 	FSCACHE_LOOKUP_PEEK,	/* Lookup; don't load or update */
25 	FSCACHE_LOOKUP_INIT,	/* Internal use */
26 	FSCACHE_LOOKUP_INSERT,	/* Internal use */
27 } FSCacheLookup;
28 
29 GFSCache *g_fscache_new(GFSLoadFunc load,
30 			GFSUpdateFunc update,
31 			gpointer user_data);
32 void g_fscache_destroy(GFSCache *cache);
33 gpointer g_fscache_lookup(GFSCache *cache, const char *pathname);
34 gpointer g_fscache_lookup_full(GFSCache *cache, const char *pathname,
35 				FSCacheLookup lookup_type,
36 				gboolean *found);
37 void g_fscache_may_update(GFSCache *cache, const char *pathname);
38 void g_fscache_update(GFSCache *cache, const char *pathname);
39 void g_fscache_purge(GFSCache *cache, gint age);
40 
41 void g_fscache_insert(GFSCache *cache, const char *pathname, gpointer obj,
42 		      gboolean update_details);
43 
44 #endif /* _FSCACHE_H */
45