diff options
author | Nick Mathewson <nickm@torproject.org> | 2017-04-16 17:47:28 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-05-04 08:37:41 -0400 |
commit | a32083bd03625c1d99a32971c1c1a574d7e6e014 (patch) | |
tree | d7ec16b4ccde6496a7fc9b3657b77571155ff5dc /src/or/dirserv.h | |
parent | 24ba1864d8caa89ee220f6c790b0dd76b466bf4a (diff) | |
download | tor-a32083bd03625c1d99a32971c1c1a574d7e6e014.tar.gz tor-a32083bd03625c1d99a32971c1c1a574d7e6e014.zip |
Add consensus_cache_entry spooling support to spooled_resource_t
Diffstat (limited to 'src/or/dirserv.h')
-rw-r--r-- | src/or/dirserv.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/or/dirserv.h b/src/or/dirserv.h index f707237ed1..4b09f87909 100644 --- a/src/or/dirserv.h +++ b/src/or/dirserv.h @@ -38,6 +38,7 @@ typedef enum dir_spool_source_t { DIR_SPOOL_EXTRA_BY_DIGEST, DIR_SPOOL_EXTRA_BY_FP, DIR_SPOOL_MICRODESC, DIR_SPOOL_NETWORKSTATUS, + DIR_SPOOL_CONSENSUS_CACHE_ENTRY, } dir_spool_source_t; #define dir_spool_source_bitfield_t ENUM_BF(dir_spool_source_t) @@ -74,8 +75,15 @@ typedef struct spooled_resource_t { */ struct cached_dir_t *cached_dir_ref; /** - * The current offset into cached_dir. Only used when spool_eagerly is - * false */ + * A different kind of large object that we might be spooling. Also + * reference-counted. Also only used when spool_eagerly is false. + */ + struct consensus_cache_entry_t *consensus_cache_entry; + const uint8_t *cce_body; + size_t cce_len; + /** + * The current offset into cached_dir or cce_body. Only used when + * spool_eagerly is false */ off_t cached_dir_offset; } spooled_resource_t; @@ -184,6 +192,8 @@ int dirserv_read_guardfraction_file(const char *fname, spooled_resource_t *spooled_resource_new(dir_spool_source_t source, const uint8_t *digest, size_t digestlen); +spooled_resource_t *spooled_resource_new_from_cache_entry( + struct consensus_cache_entry_t *entry); void spooled_resource_free(spooled_resource_t *spooled); void dirserv_spool_remove_missing_and_guess_size(dir_connection_t *conn, time_t cutoff, |