summaryrefslogtreecommitdiff
path: root/src/or/dirserv.h
diff options
context:
space:
mode:
authorAndrea Shepard <andrea@torproject.org>2013-03-07 15:41:22 -0800
committerAndrea Shepard <andrea@torproject.org>2013-03-07 15:41:22 -0800
commit6e978ab8294eda5bb9a658c8d062bdd0098a9ac5 (patch)
tree15cc6c2b36aede023bd38b739cb11c94f32dd8f4 /src/or/dirserv.h
parent302d1dae6c468fd2bd5551de654e36b8464a7eab (diff)
downloadtor-6e978ab8294eda5bb9a658c8d062bdd0098a9ac5.tar.gz
tor-6e978ab8294eda5bb9a658c8d062bdd0098a9ac5.zip
Add unit test for dirserv measured bandwidth cache
Diffstat (limited to 'src/or/dirserv.h')
-rw-r--r--src/or/dirserv.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/or/dirserv.h b/src/or/dirserv.h
index 0caf55f830..887a4992ed 100644
--- a/src/or/dirserv.h
+++ b/src/or/dirserv.h
@@ -138,10 +138,22 @@ void cached_dir_decref(cached_dir_t *d);
cached_dir_t *new_cached_dir(char *s, time_t published);
#ifdef DIRSERV_PRIVATE
+
+/* Put the MAX_MEASUREMENT_AGE #define here so unit tests can see it */
+#define MAX_MEASUREMENT_AGE (3*24*60*60) /* 3 days */
+
int measured_bw_line_parse(measured_bw_line_t *out, const char *line);
int measured_bw_line_apply(measured_bw_line_t *parsed_line,
smartlist_t *routerstatuses);
+
+void dirserv_cache_measured_bw(const measured_bw_line_t *parsed_line,
+ time_t as_of);
+void dirserv_clear_measured_bw_cache(void);
+void dirserv_expire_measured_bw_cache(time_t now);
+int dirserv_get_measured_bw_cache_size(void);
+int dirserv_query_measured_bw_cache(const char *node_id, long *bw_out,
+ time_t *as_of_out);
#endif
int dirserv_read_measured_bandwidths(const char *from_file,