Skip to content
Snippets Groups Projects
  1. May 10, 2022
    • eta's avatar
      tor-dirmgr/state.rs: remove WriteNetDir, use filters directly · 7b5fad31
      eta authored
      - The only purpose of WriteNetDir was to provide a filter, which isn't
        necessary any more. Refactor to provide the filter directly.
      7b5fad31
    • eta's avatar
      tor-dirmgr/state.rs: use the NetDirChange API instead of WriteNetDir · 8b016697
      eta authored
      - GetMicrodescsState now uses the NetDirChange API to propagate netdir
        changes, instead of modifying the netdir directly.
      - PendingNetDir was refactored in order to support this use case.
      - As a result, the netdir-related methods in WriteNetDir can be removed,
        leaving only the DirFilter for now.
      - add_from_cache() no longer takes a store, because nothing uses it.
      - (bodge: apply_netdir_changes() was put in a few places missed
        previously)
      8b016697
    • eta's avatar
      tor-dirmgr/state.rs: add new NetDirChange API, consume it · 7a52e77e
      eta authored
      - The new DirState::get_netdir_change() API lets the state machine
        export a NetDirChange: a request to either replace the current netdir,
        or add microdescs to it.
      - bootstrap.rs now consumes this new API, even though nothing implements
        it yet.
      - This will let us implement GetMicrodescsState without having to
        directly mutate the netdir. The calling code also handles checking the
        netdir against the circmgr for sufficiency, and updating the consensus
        metadata in the store, meaning the revised GetMicrodescsState will not
        have to perform these tasks.
      7a52e77e
    • eta's avatar
      tor-dirmgr/state.rs: feed through additional parameters, use them · cad815e3
      eta authored
      - The additional parameters passed to GetConsensusState are now passed
        through all the states, and used as well.
      - WriteNetDir doesn't have a now() or config() method any more, since
        the states now get this from the runtime or the config parameters.
      - This required modifying the tests to make a mocked runtime and custom
        config directly, instead of using DirRcv for this purpose.
      - Additionally, because we don't have to upgrade a weak reference for
        DirState::dl_config(), that function no longer wraps its return value
        in Result.
      - (A bunch of the FIXMEs from the previous commit that introduced the
        additional parameters have now been rectified as a result.)
      cad815e3
    • eta's avatar
      tor-rtcompat: make CompoundRuntime handle SleepProviders properly · f0739e46
      eta authored
      Previously, CompoundRuntime would use the default implementations of
      SleepProvider::now() and ::wallclock(), instead of using its wrapped
      SleepProvider. This mildly embarrassing omission has been rectified.
      f0739e46
    • eta's avatar
      tor-dirmgr/state.rs: refactor GetConsensusState::new · a9bae9ad
      eta authored
      - GetConsensusState::new now takes a set of parameters matching what it
        actually needs, instead of just taking a writedir. (It still *does*
        take a writedir, and indeed still uses it for basically everything,
        but that will eventually go away.)
      - Its call sites were updated.
        - Some tests now need to take a runtime, and got indented a lot as a
          result.
        - Resetting was made non-functional, because we need to thread through
          the parameters passed to GetConsensusState to all of the other
          states, too. This will happen in a later commit.
      a9bae9ad
    • eta's avatar
      tor-dirmgr: move DirState to state.rs · 62ece0ea
      eta authored
      - Given that this is effectively an implementation detail, it doesn't
        really make sense to have it be in the crate root...
      - (also, we're going to change it a bunch now)
      62ece0ea
    • eta's avatar
      tor-dirmgr/bootstrap.rs: refactor fetch_single · 72ea9e34
      eta authored
      - fetch_single now takes what it needs, instead of an Arc<DirMgr<R>>.
      - This required refactoring the CANNED_RESPONSE mechanism, given the
        test would otherwise fail due to not having a CircMgr to pass to
        fetch_single.
      72ea9e34
    • eta's avatar
      tor-dirmgr: make note_request_* functions standalone · 2fd03564
      eta authored
      - DirMgr::note_request_outcome and friends are now just standalone
        functions, taking a CircMgr.
      2fd03564
    • eta's avatar
      tor-dirmgr/bootstrap.rs: refactor query_into_requests, make it used · 8b44569b
      eta authored
      - query_into_requests is now called make_requests_for_documents, and
        does the &[DocId] -> DocQuery conversion internally instead.
      - DirMgr::make_consensus_request and DirMgr::query_into_requests are now
        gone. The tests use the new functions, as does fetch_multiple.
      8b44569b
    • eta's avatar
      tor-dirmgr: move query_into_requests into bootstrap.rs · 4a98ed13
      eta authored
      - There's no good reason these functions needed to be part of the
        dirmgr, apart from needing a runtime and a store.
      - However, we can just add those as arguments and copy them over. This
        commit does that.
      4a98ed13
    • eta's avatar
      tor-dirmgr/bootstrap.rs: refactor load_all -> load_documents_from_store · 13446ac6
      eta authored
      - Function renamed & docs tidied up a bit
      - Function signature now takes what it needs (immutable &dyn Store
        instead of mutex, slice instead of Vec) and nothing more
      - DocQuery::load_documents_into was also renamed
        DocQuery::load_from_store_into and given similar treatment
      13446ac6
    • eta's avatar
      tor-dirmgr/storage.rs: impl Store for Box<dyn Store> · 0dfac008
      eta authored
      Annoyingly, Rust doesn't automatically generate this sort of `impl` for
      you, and I'd like to reduce the usage of Mutex<DynStore> everywhere else
      in favour of either &dyn Store or &mut dyn Store.
      
      (This is for two reasons: firstly, we might have a Store implementation
      that doesn't use a mutex as above, or similar refactors; secondly,
      passing the raw trait object reference lets us encode mutability into
      the function signature, which I believe is quite valuable.)
      0dfac008
    • eta's avatar
      tor-dirmgr/lib.rs: move DirMgr::load_documents_into to DocQuery · d7f2718a
      eta authored
      Move the function out of DirMgr, giving it a new &Mutex<DynStore>
      argument instead.
      d7f2718a
    • eta's avatar
      Merge branch 'tinystr_nicknames' into 'main' · b4f4b18a
      eta authored
      netdoc: add a new type for Nicknames
      
      See merge request tpo/core/arti!405
      b4f4b18a
  2. May 09, 2022
  3. May 06, 2022
Loading