summaryrefslogtreecommitdiff
path: root/src/or/rendcache.h
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@ev0ke.net>2016-03-29 15:08:04 -0400
committerDavid Goulet <dgoulet@torproject.org>2016-11-04 10:31:35 -0400
commit025610612d78fe0a0ec95dd88c3d44e4bf643603 (patch)
tree165a149fe0534bb58711aa61c4b2c622e7c87b25 /src/or/rendcache.h
parent473f99bf7bdb7d23b914cd1b590451333baaf7fe (diff)
downloadtor-025610612d78fe0a0ec95dd88c3d44e4bf643603.tar.gz
tor-025610612d78fe0a0ec95dd88c3d44e4bf643603.zip
prop224: Directory cache support
This implements the proposal 224 directory descriptor cache store and lookup functionalities. Furthermore, it merges the OOM call for the HSDir cache with current protocol v2 and the new upcoming v3. Add hs_cache.{c|h} with store/lookup API. Closes #18572 Signed-off-by: David Goulet <dgoulet@torproject.org> Signed-off-by: George Kadianakis <desnacked@riseup.net>
Diffstat (limited to 'src/or/rendcache.h')
-rw-r--r--src/or/rendcache.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/or/rendcache.h b/src/or/rendcache.h
index 270b614c38..746f142fcc 100644
--- a/src/or/rendcache.h
+++ b/src/or/rendcache.h
@@ -53,10 +53,17 @@ typedef enum {
REND_CACHE_TYPE_SERVICE = 2,
} rend_cache_type_t;
+/* Return maximum lifetime in seconds of a cache entry. */
+static inline time_t
+rend_cache_max_entry_lifetime(void)
+{
+ return REND_CACHE_MAX_AGE + REND_CACHE_MAX_SKEW;
+}
+
void rend_cache_init(void);
void rend_cache_clean(time_t now, rend_cache_type_t cache_type);
void rend_cache_failure_clean(time_t now);
-void rend_cache_clean_v2_descs_as_dir(time_t now, size_t min_to_remove);
+size_t rend_cache_clean_v2_descs_as_dir(time_t cutoff);
void rend_cache_purge(void);
void rend_cache_free_all(void);
int rend_cache_lookup_entry(const char *query, int version,
@@ -77,6 +84,8 @@ void rend_cache_intro_failure_note(rend_intro_point_failure_t failure,
const uint8_t *identity,
const char *service_id);
void rend_cache_failure_purge(void);
+void rend_cache_decrement_allocation(size_t n);
+void rend_cache_increment_allocation(size_t n);
#ifdef RENDCACHE_PRIVATE
@@ -89,8 +98,6 @@ STATIC int cache_failure_intro_lookup(const uint8_t *identity,
const char *service_id,
rend_cache_failure_intro_t
**intro_entry);
-STATIC void rend_cache_decrement_allocation(size_t n);
-STATIC void rend_cache_increment_allocation(size_t n);
STATIC rend_cache_failure_intro_t *rend_cache_failure_intro_entry_new(
rend_intro_point_failure_t failure);
STATIC rend_cache_failure_t *rend_cache_failure_entry_new(void);