Update copyrights to 2021, using "make update-copyright"
[tor.git] / src / feature / nodelist / desc_store_st.h
blobfd1d36fa6ec4f1125cc0fc6ee13bf58667add877
1 /* Copyright (c) 2001 Matej Pfajfar.
2 * Copyright (c) 2001-2004, Roger Dingledine.
3 * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
4 * Copyright (c) 2007-2021, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
7 /**
8 * @file desc_store_st.h
9 * @brief Routerinfo/extrainfo storage structure.
10 **/
12 #ifndef DESC_STORE_ST_H
13 #define DESC_STORE_ST_H
15 /** Allowable types of desc_store_t. */
16 typedef enum store_type_t {
17 ROUTER_STORE = 0,
18 EXTRAINFO_STORE = 1
19 } store_type_t;
21 /** A 'store' is a set of descriptors saved on disk, with accompanying
22 * journal, mmaped as needed, rebuilt as needed. */
23 struct desc_store_t {
24 /** Filename (within DataDir) for the store. We append .tmp to this
25 * filename for a temporary file when rebuilding the store, and .new to this
26 * filename for the journal. */
27 const char *fname_base;
28 /** Human-readable description of what this store contains. */
29 const char *description;
31 tor_mmap_t *mmap; /**< A mmap for the main file in the store. */
33 store_type_t type; /**< What's stored in this store? */
35 /** The size of the router log, in bytes. */
36 size_t journal_len;
37 /** The size of the router store, in bytes. */
38 size_t store_len;
39 /** Total bytes dropped since last rebuild: this is space currently
40 * used in the cache and the journal that could be freed by a rebuild. */
41 size_t bytes_dropped;
44 #endif /* !defined(DESC_STORE_ST_H) */