Implement a (dumb) cache garbage collector.
[bluesky.git] / bluesky / bluesky-private.h
index 65f356b..73f38e1 100644 (file)
@@ -257,6 +257,10 @@ struct _BlueSkyLog {
     /* Cache of log segments which have been memory-mapped. */
     GMutex *mmap_lock;
     GHashTable *mmap_cache;
+
+    /* A count of the disk space consumed (in 1024-byte units) by all files
+     * tracked by mmap_cache (whether mapped or not, actually). */
+    gint disk_used;
 };
 
 /* An object for tracking log files which are stored locally--either the
@@ -286,6 +290,8 @@ BlueSkyRCStr *bluesky_log_map_object(BlueSkyFS *fs, int log_dir, int log_seq,
                                      int log_offset, int log_size);
 void bluesky_mmap_unref(BlueSkyCacheFile *mmap);
 
+void bluesky_cachefile_gc(BlueSkyFS *fs);
+
 #ifdef __cplusplus
 }
 #endif