summaryrefslogtreecommitdiff
path: root/src/or/conscache.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/or/conscache.c')
-rw-r--r--src/or/conscache.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/or/conscache.c b/src/or/conscache.c
index 7760d1315b..5ffa129bbe 100644
--- a/src/or/conscache.c
+++ b/src/or/conscache.c
@@ -400,6 +400,19 @@ consensus_cache_unmap_lazy(consensus_cache_t *cache, time_t cutoff)
}
/**
+ * Return the number of currently unused filenames available in this cache.
+ */
+int
+consensus_cache_get_n_filenames_available(consensus_cache_t *cache)
+{
+ tor_assert(cache);
+ int max = storage_dir_get_max_files(cache->dir);
+ int used = smartlist_len(storage_dir_list(cache->dir));
+ tor_assert_nonfatal(max >= used);
+ return max - used;
+}
+
+/**
* Delete every element of <b>cache</b> has been marked with
* consensus_cache_entry_mark_for_removal. If <b>force</b> is false,
* retain those entries which are not in use except by the cache.