/* 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
struct _BlueSkyCacheFile {
GMutex *lock;
GCond *cond;
+ gint refcount;
int type; // Only one of CLOUDLOG_{JOURNAL,CLOUD}
int log_dir;
int log_seq;
char *filename; // Local filename, relateive to log directory
- gint refcount; // References to the mmaped data
+ gint mapcount; // References to the mmaped data
const char *addr; // May be null if data is not mapped in memory
size_t len;
BlueSkyFS *fs;
BlueSkyLog *log;
gboolean fetching, ready;
+ int64_t atime; // Access time, for cache management
};
BlueSkyLog *bluesky_log_new(const char *log_directory);
int log_offset, int log_size);
void bluesky_mmap_unref(BlueSkyCacheFile *mmap);
+void bluesky_cachefile_gc(BlueSkyFS *fs);
+
#ifdef __cplusplus
}
#endif