Tor  0.4.6.0-alpha-dev
conscache.h
Go to the documentation of this file.
1 /* Copyright (c) 2017-2020, 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 
12 #include "lib/container/handles.h"
13 
16 
17 struct config_line_t;
18 
19 HANDLE_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 
24 consensus_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))
28 struct sandbox_cfg_elem_t;
31  struct sandbox_cfg_elem_t **cfg);
32 void 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
70 int consensus_cache_entry_is_mapped(consensus_cache_entry_t *ent);
71 #endif
72 
73 #endif /* !defined(TOR_CONSCACHE_H) */
consensus_cache_entry_incref
void consensus_cache_entry_incref(consensus_cache_entry_t *ent)
Definition: conscache.c:355
consensus_cache_find_first
consensus_cache_entry_t * consensus_cache_find_first(consensus_cache_t *cache, const char *key, const char *value)
Definition: conscache.c:255
consensus_cache_may_overallocate
int consensus_cache_may_overallocate(consensus_cache_t *cache)
Definition: conscache.c:125
consensus_cache_entry_mark_for_aggressive_release
void consensus_cache_entry_mark_for_aggressive_release(consensus_cache_entry_t *ent)
Definition: conscache.c:423
consensus_cache_unmap_lazy
void consensus_cache_unmap_lazy(consensus_cache_t *cache, time_t cutoff)
Definition: conscache.c:465
consensus_cache_entry_get_value
const char * consensus_cache_entry_get_value(const consensus_cache_entry_t *ent, const char *key)
Definition: conscache.c:329
consensus_cache_free_
void consensus_cache_free_(consensus_cache_t *cache)
Definition: conscache.c:195
consensus_cache_entry_decref
void consensus_cache_entry_decref(consensus_cache_entry_t *ent)
Definition: conscache.c:370
consensus_cache_t
Definition: conscache.c:62
consensus_cache_delete_pending
void consensus_cache_delete_pending(consensus_cache_t *cache, int force)
Definition: conscache.c:509
consensus_cache_find_all
void consensus_cache_find_all(smartlist_t *out, consensus_cache_t *cache, const char *key, const char *value)
Definition: conscache.c:277
consensus_cache_get_n_filenames_available
int consensus_cache_get_n_filenames_available(consensus_cache_t *cache)
Definition: conscache.c:489
handles.h
Macros for C weak-handle implementation.
consensus_cache_entry_t
Definition: conscache.c:32
consensus_cache_entry_get_body
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
consensus_cache_register_with_sandbox
int consensus_cache_register_with_sandbox(consensus_cache_t *cache, struct sandbox_cfg_elem_t **cfg)
Definition: conscache.c:149
config_line_t
Definition: confline.h:29
consensus_cache_filter_list
void consensus_cache_filter_list(smartlist_t *lst, const char *key, const char *value)
Definition: conscache.c:305
consensus_cache_add
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
consensus_cache_entry_get_labels
const struct config_line_t * consensus_cache_entry_get_labels(const consensus_cache_entry_t *ent)
Definition: conscache.c:346
consensus_cache_entry_mark_for_removal
void consensus_cache_entry_mark_for_removal(consensus_cache_entry_t *ent)
Definition: conscache.c:413
smartlist_t
Definition: smartlist_core.h:26
consensus_cache_open
consensus_cache_t * consensus_cache_open(const char *subdir, int max_entries)
Definition: conscache.c:85