Tor 0.4.9.0-alpha-dev
conscache.h
Go to the documentation of this file.
1/* Copyright (c) 2017-2021, The Tor Project, Inc. */
2/* See LICENSE for licensing information */
3
4/**
5 * @file conscache.h
6 * @brief Header for conscache.c
7 **/
8
9#ifndef TOR_CONSCACHE_H
10#define TOR_CONSCACHE_H
11
13
16
17struct config_line_t;
18
19HANDLE_DECL(consensus_cache_entry, consensus_cache_entry_t, )
20#define consensus_cache_entry_handle_free(h) \
21 FREE_AND_NULL(consensus_cache_entry_handle_t, \
22 consensus_cache_entry_handle_free_, (h))
23
24consensus_cache_t *consensus_cache_open(const char *subdir, int max_entries);
26#define consensus_cache_free(cache) \
27 FREE_AND_NULL(consensus_cache_t, consensus_cache_free_, (cache))
28struct sandbox_cfg_elem_t;
31 struct sandbox_cfg_elem_t **cfg);
32void consensus_cache_unmap_lazy(consensus_cache_t *cache, time_t cutoff);
34 int force);
37 const struct config_line_t *labels,
38 const uint8_t *data,
39 size_t datalen);
40
42 consensus_cache_t *cache,
43 const char *key,
44 const char *value);
45
47 consensus_cache_t *cache,
48 const char *key,
49 const char *value);
51 const char *key,
52 const char *value);
53
55 const char *key);
57 const consensus_cache_entry_t *ent);
58
61
66 const uint8_t **body_out,
67 size_t *sz_out);
68
69#ifdef TOR_UNIT_TESTS
70int consensus_cache_entry_is_mapped(consensus_cache_entry_t *ent);
71#endif
72
73#endif /* !defined(TOR_CONSCACHE_H) */
consensus_cache_entry_t * consensus_cache_add(consensus_cache_t *cache, const config_line_t *labels, const uint8_t *data, size_t datalen)
Definition: conscache.c:221
void consensus_cache_entry_incref(consensus_cache_entry_t *ent)
Definition: conscache.c:355
void consensus_cache_find_all(smartlist_t *out, consensus_cache_t *cache, const char *key, const char *value)
Definition: conscache.c:277
void consensus_cache_delete_pending(consensus_cache_t *cache, int force)
Definition: conscache.c:509
consensus_cache_entry_t * consensus_cache_find_first(consensus_cache_t *cache, const char *key, const char *value)
Definition: conscache.c:255
void consensus_cache_entry_mark_for_aggressive_release(consensus_cache_entry_t *ent)
Definition: conscache.c:423
int consensus_cache_get_n_filenames_available(consensus_cache_t *cache)
Definition: conscache.c:489
const char * consensus_cache_entry_get_value(const consensus_cache_entry_t *ent, const char *key)
Definition: conscache.c:329
const struct config_line_t * consensus_cache_entry_get_labels(const consensus_cache_entry_t *ent)
Definition: conscache.c:346
int consensus_cache_may_overallocate(consensus_cache_t *cache)
Definition: conscache.c:125
void consensus_cache_free_(consensus_cache_t *cache)
Definition: conscache.c:195
int consensus_cache_register_with_sandbox(consensus_cache_t *cache, struct sandbox_cfg_elem_t **cfg)
Definition: conscache.c:149
void consensus_cache_filter_list(smartlist_t *lst, const char *key, const char *value)
Definition: conscache.c:305
consensus_cache_t * consensus_cache_open(const char *subdir, int max_entries)
Definition: conscache.c:85
void consensus_cache_entry_mark_for_removal(consensus_cache_entry_t *ent)
Definition: conscache.c:413
void consensus_cache_unmap_lazy(consensus_cache_t *cache, time_t cutoff)
Definition: conscache.c:465
void consensus_cache_entry_decref(consensus_cache_entry_t *ent)
Definition: conscache.c:370
int consensus_cache_entry_get_body(const consensus_cache_entry_t *ent, const uint8_t **body_out, size_t *sz_out)
Definition: conscache.c:437
Macros for C weak-handle implementation.
Definition: conscache.c:32