desc_store_st.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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-2018, The Tor Project, Inc. */
  5. /* See LICENSE for licensing information */
  6. #ifndef DESC_STORE_ST_H
  7. #define DESC_STORE_ST_H
  8. /** Allowable types of desc_store_t. */
  9. typedef enum store_type_t {
  10. ROUTER_STORE = 0,
  11. EXTRAINFO_STORE = 1
  12. } store_type_t;
  13. /** A 'store' is a set of descriptors saved on disk, with accompanying
  14. * journal, mmaped as needed, rebuilt as needed. */
  15. struct desc_store_t {
  16. /** Filename (within DataDir) for the store. We append .tmp to this
  17. * filename for a temporary file when rebuilding the store, and .new to this
  18. * filename for the journal. */
  19. const char *fname_base;
  20. /** Human-readable description of what this store contains. */
  21. const char *description;
  22. tor_mmap_t *mmap; /**< A mmap for the main file in the store. */
  23. store_type_t type; /**< What's stored in this store? */
  24. /** The size of the router log, in bytes. */
  25. size_t journal_len;
  26. /** The size of the router store, in bytes. */
  27. size_t store_len;
  28. /** Total bytes dropped since last rebuild: this is space currently
  29. * used in the cache and the journal that could be freed by a rebuild. */
  30. size_t bytes_dropped;
  31. };
  32. #endif