tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

desc_store_st.h (1430B)


      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 */
      6 
      7 /**
      8 * @file desc_store_st.h
      9 * @brief Routerinfo/extrainfo storage structure.
     10 **/
     11 
     12 #ifndef DESC_STORE_ST_H
     13 #define DESC_STORE_ST_H
     14 
     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;
     20 
     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;
     30 
     31  tor_mmap_t *mmap; /**< A mmap for the main file in the store. */
     32 
     33  store_type_t type; /**< What's stored in this store? */
     34 
     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;
     42 };
     43 
     44 #endif /* !defined(DESC_STORE_ST_H) */