1 /* 2 * Copyright (C) 2015 Jonathan Matthew <jonathan@d14n.org> 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * The Rhythmbox authors hereby grant permission for non-GPL compatible 10 * GStreamer plugins to be used and distributed together with GStreamer 11 * and Rhythmbox. This permission is above and beyond the permissions granted 12 * by the GPL license by which Rhythmbox is covered. If you modify this code 13 * you may extend this exception to your version of the code, but you are not 14 * obligated to do so. If you do not wish to do so, delete this exception 15 * statement from your version. 16 * 17 * This program is distributed in the hope that it will be useful, 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 * GNU General Public License for more details. 21 * 22 * You should have received a copy of the GNU General Public License 23 * along with this program; if not, write to the Free Software 24 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 25 * 26 */ 27 28 #ifndef RHYTHMDB_METADATA_CACHE_H 29 #define RHYTHMDB_METADATA_CACHE_H 30 31 #include <glib.h> 32 #include <glib-object.h> 33 34 #include <rhythmdb/rhythmdb.h> 35 36 G_BEGIN_DECLS 37 38 #define RHYTHMDB_TYPE_METADATA_CACHE (rhythmdb_metadata_cache_get_type ()) 39 #define RHYTHMDB_METADATA_CACHE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), RHYTHMDB_TYPE_METADATA_CACHE, RhythmDBMetadataCache)) 40 #define RHYTHMDB_METADATA_CACHE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), RHYTHMDB_TYPE_METADATA_CACHE, RhythmDBMetadataCacheClass)) 41 #define RHYTHMDB_IS_METADATA_CACHE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), RHYTHMDB_TYPE_METADATA_CACHE)) 42 #define RHYTHMDB_IS_METADATA_CACHE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), RHYTHMDB_TYPE_METADATA_CACHE)) 43 #define RHYTHMDB_METADATA_CACHE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), RHYTHMDB_TYPE_METADATA_CACHE, RhythmDBMetadataCacheClass)) 44 45 typedef struct _RhythmDBMetadataCache RhythmDBMetadataCache; 46 typedef struct _RhythmDBMetadataCacheClass RhythmDBMetadataCacheClass; 47 typedef struct _RhythmDBMetadataCachePrivate RhythmDBMetadataCachePrivate; 48 49 struct _RhythmDBMetadataCache 50 { 51 GObject parent; 52 RhythmDBMetadataCachePrivate *priv; 53 }; 54 55 struct _RhythmDBMetadataCacheClass 56 { 57 GObjectClass parent_class; 58 }; 59 60 typedef gboolean (*RhythmDBMetadataCacheValidFunc) (const char *key, gpointer data); 61 62 GType rhythmdb_metadata_cache_get_type (void); 63 64 RhythmDBMetadataCache *rhythmdb_metadata_cache_get (RhythmDB *db, 65 const char *cache_name); 66 67 gboolean rhythmdb_metadata_cache_load (RhythmDBMetadataCache *cache, 68 const char *key, 69 GArray *metadata); 70 71 void rhythmdb_metadata_cache_store (RhythmDBMetadataCache *cache, 72 const char *key, 73 RhythmDBEntry *entry); 74 75 void rhythmdb_metadata_cache_purge (RhythmDBMetadataCache *cache, 76 const char *prefix, 77 gulong age, 78 RhythmDBMetadataCacheValidFunc cb, 79 gpointer cb_data, 80 GDestroyNotify cb_data_destroy); 81 82 G_END_DECLS 83 84 #endif /* RHYTHMDB_METADATA_CACHE_H */ 85