summaryrefslogtreecommitdiff
path: root/crates/tor-dirmgr
Commit message (Collapse)AuthorAgeFilesLines
...
* | Merge branch 'md_allocation' into 'main'Nick Mathewson2022-03-171-20/+54
|\ \ | | | | | | | | | | | | | | | | | | Use less space in hashtables for microdescriptors Closes #386 See merge request tpo/core/arti!415
| * | Run rustfmtIan Jackson2022-03-171-5/+6
| | |
| * | GetMicrodescsState: Abolish separate n_missing field inIan Jackson2022-03-171-12/+12
| | |
| * | GetMicrodescsState: Break out with_mdreceiver_for_missingIan Jackson2022-03-171-13/+23
| | |
| * | GetMicrodescsState: Dedupe slightlyIan Jackson2022-03-171-8/+9
| | |
| * | tor-dirmgr: Remove redundant hashtable.Nick Mathewson2022-03-161-22/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | We were using a hashtable to keep track of missing microdescriptor digests. But this information is redundant with the NetDir state, and there's now no longer any performance benefit to keeping a separate copy. Part of #386.
* | | Merge branch 'config-partials-transparent' into 'main'Ian Jackson2022-03-173-67/+43
|\ \ \ | | | | | | | | | | | | | | | | Absolish builders for CircMgrConfig and DirMgrConfig See merge request tpo/core/arti!417
| * | | DirMgrConfig: abolish builder; make it transparent and exhaustiveIan Jackson2022-03-163-67/+43
| | | | | | | | | | | | | | | | See rationale in the comment.
* | | | Merge branch 'always-ims' into 'main'eta2022-03-161-10/+49
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dirmgr: Always send if-modified-since on consensus documents. Closes #403 See merge request tpo/core/arti!412
| * | | | dirmgr: Always send if-modified-since on consensus documents.Nick Mathewson2022-03-161-10/+49
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We never want a consensus document that's super-old, since we would reject it immediately for being too old. Also, never send an if-modified-since that's so old that we'd reject the response. Closes #403
* | | | Merge branch 'derive-builder' into 'main'Ian Jackson2022-03-161-1/+1
|\ \ \ \ | |_|/ / |/| | | | | | | | | | | derive_builder: Switch to upstream 0.11 See merge request tpo/core/arti!414
| * | | derive_builder: Switch to upstream 0.11Ian Jackson2022-03-161-1/+1
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | This has the different syntax for builder field attributes than what I originally proposed in my MR, and which therefore is in the pinned branch. My upstream MR for the field attributes feature was morged: https://github.com/colin-kiegel/rust-derive-builder/issues/239
* | | RetryDelay: remove accessors.Nick Mathewson2022-03-161-7/+9
| | | | | | | | | | | | Instead, check initial_delay in dirmgr directly.
* | | Remove re-export of retry-schedule in tor-dirmgr.Nick Mathewson2022-03-161-1/+1
| | | | | | | | | | | | It wasn't necessary.
* | | Fix up documentation on RetryDelay.Nick Mathewson2022-03-161-6/+3
| | | | | | | | | | | | | | | It's no longer about downloads; it's about whatever you need to retry.
* | | Move RetryDelay from dirmgr to basic-utils.Nick Mathewson2022-03-161-155/+1
| | | | | | | | | | | | | | | This (almost) a pure code-movement commit: it also makes one public function private in order to suppress a warning.
* | | RetryDelay: add accessors for stateNick Mathewson2022-03-161-5/+22
|/ / | | | | | | | | We'll need these for our unit tests in tor-dirmgr once we move RetryDelay into tor-basic-utils.
* | Merge branch 'missing_shrink_to_fit' into 'main'eta2022-03-141-0/+7
|\ \ | | | | | | | | | | | | | | | | | | dirmgr: Call shrink_to_fit on missing-microdesc hashtable Closes #388 See merge request tpo/core/arti!399
| * | dirmgr: Call shrink_to_fit on missing-microdesc hashtableNick Mathewson2022-03-101-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This hashtable starts out pretty large, but it can spend most of our runtime (when we aren't downloading) being small. To avoid doing too much work, I've made it so we only call shrink_to_fit twice per consensus: once when we're no longer pending, and once when we're complete. Closes #388.
* | | humantime: Update to humantime-serde 1.1.1Ian Jackson2022-03-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | This has the humantime_serde::option module, which we have upstreamed and are about to switch to. The remaining dependency with version = "1" is going to be removed in a moment.
* | | Follow-up from arti!318Nick Mathewson2022-03-112-2/+11
| | | | | | | | | | | | Make update_config only conditionally exported; add semver-status update.
* | | Merge branch 'add-flatfile-dirmgr' into 'main'Nick Mathewson2022-03-114-12/+23
|\ \ \ | | | | | | | | | | | | | | | | Add flatfile DirMgr See merge request tpo/core/arti!318
| * | | Expose APIs for external DirProviderChristian Grigis2022-03-114-12/+23
| |/ /
* | | Drop remaining conversion from FooConfig to FooConfigBuilderIan Jackson2022-03-071-22/+0
| | |
* | | Derive Deserialize for derive-builder-generated config buildersIan Jackson2022-03-072-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I used git-grep -P '\#\[serde\((?!default|deny_unknown)' to find places where I needed to add additional attributes on the builder method fields. This is currently a bit duplicative, but when #371 is completely done, the validated (non-builder) configs won't need to be Deserialize any more. This is part of #371 and #372.
* | | Use git source for derive_builder for now, for attrs featureIan Jackson2022-03-071-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | We are going to want to specify custom attributes on fields of the builder struct. This feature was missing from derive_builder. This commitid is the current head of my MR branch https://github.com/colin-kiegel/rust-derive-builder/pull/237 https://github.com/ijackson/rust-derive-builder/tree/builder-field-attrs Using the commitid prevents surprises if that branch is updated. We will require this newer version of derive_builder. The version will need to be bumped again later, assuming the upstream MR is merged and upstream do a release containing the needed changes.
* | Merge branch 'errors-for-dirprovider' into 'main'Nick Mathewson2022-03-041-0/+12
|\ \ | | | | | | | | | | | | | | | | | | Errors for dirprovider Closes #370 See merge request tpo/core/arti!385
| * | Provide an error variant for external directory providersIan Jackson2022-03-041-0/+12
| | |
* | | Merge branch 'educe-traits' into 'main'Ian Jackson2022-03-043-26/+16
|\ \ \ | |/ / |/| | | | | | | | Replace many manual trait impls with use of educe See merge request tpo/core/arti!375
| * | Move skip_fmt into tor-basic-utilsIan Jackson2022-03-042-2/+2
| | | | | | | | | | | | | | | | | | | | | Code motion and the minimal mechanical changes. As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/375#note_2783078
| * | Replace manual Default impl with educe in tor-dirmgrIan Jackson2022-03-021-10/+5
| | |
| * | Replace manual Default impl with educe+std in tor-dirmgrIan Jackson2022-03-021-8/+4
| | |
| * | Replace manual Debug impl with educe in tor-dirmgrIan Jackson2022-03-022-8/+7
| | |
* | | Use RsaIdentity::from_hex() and hex::decode_to_slice in more placesNick Mathewson2022-03-044-16/+8
| | | | | | | | | | | | These aren't critical-path, but they do make the code a little nicer.
* | | Merge branch 'dir-provider-redux' into 'main'Ian Jackson2022-03-021-1/+63
|\ \ \ | |/ / |/| | | | | | | | Alternative DirProvider setup See merge request tpo/core/arti!347
| * | DirProvider: Fix infinite recursion bugNick Mathewson2022-02-251-4/+4
| | |
| * | Un-parameterize DirProvider.Nick Mathewson2022-02-231-15/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes the EventStream associated type and the Runtime parameter. The Runtime parameter wasn't actually used for anything, and the EventStream was easy enough to replace with a BoxStream in this case. Also replaced DirBootstrapEvents with a BoxStream to avoid tying anything to our backend.
| * | Add basic DirProvider trait, use it in clientChristian Grigis2022-02-231-0/+68
| | |
* | | Merge branch 'clippy-allow-arc-clone' into 'main'Nick Mathewson2022-03-011-1/+0
|\ \ \ | | | | | | | | | | | | | | | | Disable clippy::clone_on_ref_ptr See merge request tpo/core/arti!352
| * | | Disable clippy::clone_on_ref_ptrIan Jackson2022-02-241-1/+0
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This lint is IMO inherently ill-conceived. I have looked for the reasons why this might be thought to be a good idea and there were basically two (and they are sort of contradictory): I. "Calling ‘.clone()` on an Rc, Arc, or Weak can obscure the fact that only the pointer is being cloned, not the underlying data." This is the wording from https://rust-lang.github.io/rust-clippy/v0.0.212/#clone_on_ref_ptr It is a bit terse; we are left to infer why it is a bad idea to obscure this fact. It seems to me that if it is bad to obscure some fact, that must be because the fact is a hazard. But why would it be a hazard to not copy the underlying data ? In other languages, faliing to copy the underlying data is a serious correctness hazard. There is a whose class of bugs where things were not copied, and then mutated and/or reused in multiple places in ways that were not what the programmer intended. In my experience, this is a very common bug when writing Python and Javascript. I'm told it's common in golang too. But in Rust this bug is much much harder to write. The data inside an Arc is immutable. To have this bug you'd have use interior mutability - ie mess around with Mutex or RefCell. That provides a good barrier to these kind of accidents. II. "The reason for writing Rc::clone and Arc::clone [is] to make it clear that only the pointer is being cloned, as opposed to the underlying data. The former is always fast, while the latter can be very expensive depending on what is being cloned." This is the reasoning found here https://github.com/rust-lang/rust-clippy/issues/2048 This is saying that *not* using Arc::clone is hazardous. Specifically, that a deep clone is a performance hazard. But for this argument, the lint is precisely backwards. It's linting the "good" case and asking for it to be written in a more explicit way; while the supposedly bad case can be written conveniently. Also, many objects (in our codebase, and in all the libraries we use) that are Clone are in fact simply handles. They contain Arc(s) (or similar) and are cheap to clone. Indeed, that is the usual case. It does not make sense to distinguish in the syntax we use to clone such a handle, whether the handle is a transparent Arc, or an opaque struct containing one or more other handles. Forcing Arc::clone to be written as such makes for code churn when a type is changed from Arc<Something> to Something: Clone, or vice versa.
* / | Bump all crates to 0.1.0arti-v0.1.0Nick Mathewson2022-03-011-13/+13
|/ /
* | dirmgr::Store.expire_all takes configtharvik2022-02-233-26/+47
| |
* | dirmgr: add Store traittharvik2022-02-236-278/+310
|/
* Rename TorConnectionFailed to TorAccessFailedNick Mathewson2022-02-221-1/+1
|
* Rename TorShuttingDown to ArtiShuttingDownNick Mathewson2022-02-221-1/+1
|
* dirclient: Remove HttpStatus error variantNick Mathewson2022-02-171-2/+11
| | | | | | | Getting a non-200 status is no longer a failure condition; it's just a different kind of answer. Closes #349.
* Merge branch 'remaining-errors'Nick Mathewson2022-02-176-59/+170
|\
| * Use TorConnectionFailed for failure to download directory.Nick Mathewson2022-02-171-1/+1
| |
| * tor-dirmgr: Use Bug type for sqlite-detected bugsIan Jackson2022-02-171-1/+9
| | | | | | | | So we get a stack trace
| * tor-dirmgr: Make sqlite_error_kind take rusqlite::ErrorIan Jackson2022-02-171-32/+34
| | | | | | | | | | We're about to reuse this and we'll want it to take the higher-level type. Also it seems more proper like this.