summaryrefslogtreecommitdiff
path: root/crates/arti-client/src
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | Abolish filter::DynFilter in favour of transparent DirFilterIan Jackson2022-03-251-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are two reasons why the DynFilter newtype might be needed: 1. To impl Default. But we don't need it to impl Default since we can have an accessor which does the defaulting. 2. To hide the API. But this is usrely an unstable API. Just writing Arc<dyn> gets rid of a lot of unnecessary boilerplate and conversion code.
| * | | Make DirFilter be Debug + Send + SyncIan Jackson2022-03-251-1/+1
| | | | | | | | | | | | | | | | | | | | Abolish the handwritten Debug impl for DynFilter, which is no longer needed.
| * | | Expose DirFilter from arti-client.Nick Mathewson2022-03-242-1/+34
| | | | | | | | | | | | | | | | | | | | This will make it possible to implement a directory-munging mechanism in arti-testing for #397.
| * | | dirmgr: Initial DirFilter code.Nick Mathewson2022-03-241-0/+1
| |/ / | | | | | | | | | | | | | | | This code sits behind a feature flag, and can be used to modify directories before storing them. This is part of the implementation for #397.
* | | Merge branch 'task-scheduler-2' into 'main'eta2022-03-252-36/+112
|\ \ \ | |/ / |/| | | | | | | | Implement a periodic task scheduler, and a basic dormant mode See merge request tpo/core/arti!429
| * | Implement a periodic task scheduler, and a basic dormant modeeta2022-03-232-36/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a revised version of !397; it implements a scheduling system for periodic tasks that can be externally controlled, and then uses the external control aspect to implement a basic dormant mode (#90). More technically, the scheduling system consists of a `Stream` that periodic tasks are expected to embed in a `while` loop or similar, a way for tasks themselves to choose how long to wait until the stream next yields a result, and a handle to control this outside of the task.
* | | Move SystemConfig to arti::cfgIan Jackson2022-03-211-48/+0
|/ / | | | | | | Fixes #314, #418.
* | Alternative API for set_isolation_group().Nick Mathewson2022-03-171-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | Instead of requiring a `Box<dyn Isolation>`, it now takes either a `Box<dyn Isolation>`, or an arbitrary `T` that implements `Isolation`. This API still allows the user to pass in a `Box<dyn Isolation>` if that's what they have, but it doesn't require them to Box the isolation on their own. Part of #414.
* | Merge branch 'test-isolation' into 'main'Nick Mathewson2022-03-172-17/+19
|\ \ | | | | | | | | | | | | new api for isolation See merge request tpo/core/arti!377
| * | replace TODOs with documentationtrinity-1686a2022-03-161-2/+1
| | |
| * | accept boxed isolation in StreamPref::set_isolation_grouptrinity-1686a2022-03-161-2/+2
| | |
| * | add tests on Isolation and fix conditional compilation issuestrinity-1686a2022-03-161-1/+0
| | | | | | | | | | | | | | | | | | it seems I added conditional compilation without noticing it?? and there was some errors when choosing a prefered runtime depending on feature flags
| * | replace IsolationMap with new Isolation traittrinity-1686a2022-03-161-0/+1
| | |
| * | replace Arc with Box and use dyn-clonetrinity-1686a2022-03-161-52/+37
| | | | | | | | | | | | this also removes JoinResult
| * | replace result with eithertrinity-1686a2022-03-161-5/+6
| | |
| * | testing new api for isolationTrinity Pointard2022-03-161-36/+53
| | |
* | | Merge branch 'config-partials-transparent' into 'main'Ian Jackson2022-03-172-34/+37
|\ \ \ | |/ / |/| | | | | | | | Absolish builders for CircMgrConfig and DirMgrConfig See merge request tpo/core/arti!417
| * | DirMgrConfig: abolish builder; make it transparent and exhaustiveIan Jackson2022-03-162-15/+18
| | | | | | | | | | | | See rationale in the comment.
| * | Make CircMgrConfig transparent (and make it a trait)Ian Jackson2022-03-162-19/+14
| | | | | | | | | | | | See commentary for the rationale.
| * | Change type of TorClientConfig::override_net_paramsIan Jackson2022-03-161-3/+7
| | | | | | | | | | | | | | | | | | | | | Now we use NetParams. That implies making its constructor public, which I think it fine. This is related to #413 but is far from completing that ticket.
| * | Actually honour preemptive circuits configurationIan Jackson2022-03-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This handwritten conversion function omitted a field. There was nothing to spot this mistake. IMO this shows why these particular types ought not to use builders, but instead, should cause API breaks when things change. Adding this line here to explicitly fix the bug, although we are about to abolish this function completely almost right away.
* | | derive_builder: Switch to upstream 0.11Ian Jackson2022-03-161-3/+3
|/ / | | | | | | | | | | | | | | | | 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
* | actually add DNS supporttrinity-1686a2022-03-141-1/+1
| |
* | Use new upstream humantime_serde_option featureIan Jackson2022-03-141-4/+3
| | | | | | | | Replace all uses of our copy of this code.
* | rustfmtIan Jackson2022-03-111-2/+1
| |
* | Make TorClientConfigBuilder DeserializeIan Jackson2022-03-111-0/+11
| | | | | | | | As per #371
* | Drop remaining conversion from FooConfig to FooConfigBuilderIan Jackson2022-03-071-66/+0
| |
* | Have ArtiConfig contain a TorClientConfig, and drop builder retconIan Jackson2022-03-071-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace the recapitulation of TorClientConfig fields in ArtiConfig and instead just have it contain one. This is part of #374. The conversions from ArtiConfig back to ArtiConfigBuilder and TorClientConfigBuilder would need to change, but, since we don't want them anyway, No longer impl Deserialize for ArtiConfig. (As per #371 this will want to become a private type.) No longer impl From<ArtiConfig> for ArtiConfigBuilder and TorClientConfigBuilder. And abolish tests of that code. (This all has to be in one commit, because previously ArtiConfig::tor_client_config used the validated-to-builder config retcon.)
* | Derive Deserialize for derive-builder-generated config buildersIan Jackson2022-03-071-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge branch 'educe-traits' into 'main'Ian Jackson2022-03-042-23/+12
|\ \ | | | | | | | | | | | | 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-041-1/+1
| | | | | | | | | | | | | | | | | | | | | Code motion and the minimal mechanical changes. As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/375#note_2783078
| * | Replace manual Default impls on enums with educe in arti-clientIan Jackson2022-03-021-14/+7
| | |
| * | Replace manual Debug impl with educe in arti-clientIan Jackson2022-03-021-9/+5
| | |
* | | arti-client: Make dirmgr() and circmgr() return &Arc<..>Nick Mathewson2022-03-031-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously they returned an Arc, which wasn't necessary unless the client actually _wanted_ a new Arc. This would be an API break, except that these functions are marked 'experimental-api', so semver does not apply; nonetheless I've noted the break in semver_status.md, just in case we care. Closes #369
* | | Merge branch 'dir-provider-redux' into 'main'Ian Jackson2022-03-025-26/+95
|\ \ \ | |/ / |/| | | | | | | | Alternative DirProvider setup See merge request tpo/core/arti!347
| * | Have caller of dirmgr_builder() provide Arc.Nick Mathewson2022-03-021-2/+2
| | |
| * | DirProvider: Fix infinite recursion bugNick Mathewson2022-02-251-1/+1
| | |
| * | Add a builder function for replacing a DirProvider.Nick Mathewson2022-02-235-21/+86
| | | | | | | | | | | | Put it behind experimental_api.
| * | Un-parameterize DirProvider.Nick Mathewson2022-02-231-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-6/+12
| | |
* | | 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.
* | | Fix rustdoc errors.Nick Mathewson2022-03-011-8/+9
| | |
* | | Run rustfmt.Nick Mathewson2022-03-011-1/+0
| | |
* | | Merge remote-tracking branch 'origin/mr/371'Nick Mathewson2022-03-011-0/+9
|\ \ \
| * | | arti-client: Add stability warning to config moduleIan Jackson2022-03-011-0/+9
| | | |
* | | | Merge branch '010_docs'Nick Mathewson2022-03-012-7/+20
|\| | |
| * | | Update our stability warning on arti-client.Nick Mathewson2022-02-281-5/+12
| | | |
| * | | Add warnings about configuration stability.Nick Mathewson2022-02-281-2/+8
| | | |
* | | | Merge branch 'main'Ian Jackson2022-03-011-2/+6
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed conflict in crates/arti-client/src/lib.rs as per tree from https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/364/#note_2782166 ie 13e55b8d7c22c26e55ba75823409b477f1bce66b