summaryrefslogtreecommitdiff
path: root/crates/tor-dirmgr/src/event.rs
Commit message (Collapse)AuthorAgeFilesLines
* tor-dirmgr: impl Default for FlagPublisherIan Jackson2022-10-271-0/+6
|
* tor-dirmgr: impl FlagEvent for BridgeDescEventIan Jackson2022-10-271-0/+6
|
* FlagEvent trait: Implement using macrosIan Jackson2022-10-251-14/+59
| | | | | | | | | | | The explicit list of variant names, that needs to be kept in sync, and is a test failure semver break hazard, is now gone. All the necessary code is now generated automatically, and cannot be wrong. I want this because I find myself wanting to add a second implementation of FlagEvent, for another type.
* Merge branch 'dirmgr' into 'main'Nick Mathewson2022-06-241-53/+49
|\ | | | | | | | | | | | | dirmgr: followups to !587, mostly using iterators Closes #468 See merge request tpo/core/arti!599
| * dirmgr: Use ... .find().is_none() rather than clippy's suggestionIan Jackson2022-06-231-2/+4
| |
| * dirmgr: DirBootstrapStatus: Refactor mut_status_for using entries_mutIan Jackson2022-06-221-27/+25
| | | | | | | | IMO this is rather less confusing.
| * dirmgr: Use new statuses() helper methodIan Jackson2022-06-221-21/+6
| | | | | | | | The two call sites become clearer, IMO.
| * dirmgr: DirBootstrapStatus: Provide statuses and entries_mutIan Jackson2022-06-221-3/+18
| | | | | | | | | | | | | | We're going to use these in a moment. One returns entries and the other statuses simply because that's what's actually going to be wanted.
| * dirmgr: Remove a TODO commentIan Jackson2022-06-221-4/+0
| | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/587#note_2815945
* | Fix a couple of typos in rustdoc comments.Nick Mathewson2022-06-241-1/+1
|/
* Refactor DirStatus data structures.Nick Mathewson2022-06-211-74/+186
| | | | | | | AttemptId is now linked to DirStatus in StatusEntry. DirBootstrapStatus now has an inner enum to make invalid status unrepresentable.
* Make display formats work with older derive_more.Nick Mathewson2022-06-141-1/+1
|
* tor-dirmgr: Make DirStatus non-public.Nick Mathewson2022-06-141-3/+1
| | | | | I believe this type was made public in error: No other crate uses it, and no API exposes it.
* Add a blockage-reporting mechanism to tor-dirmgr.Nick Mathewson2022-06-141-0/+96
| | | | | | | | | The `DirBootstrapStatus` type now exposes a blockage() method to return an `Option<DirBlockage>`. The blockage types reported are more low-level than I'd like, but they are IMO good enough for now: we'll want to get experience with actual vs hypothetical problems before we refine them.
* Add a couple of TODO items.Nick Mathewson2022-06-141-0/+7
|
* DirMgr: Track errors, stalls, and resets as part of status.Nick Mathewson2022-06-131-2/+47
| | | | | | | | | | | | | | A "reset" happens whenever we have to start a download attempt over -- either because we ran out of retries, or we found something wrong with the consensus after fetching certificates. An "error" happens when we have a recoverable error from one or more directory sources. A "stall" happens whenever a round of downloads or cache loads leads to no change in the status. We don't yet use this as part of our status reporting.
* Refactor our logic for distinguishing download attemptsNick Mathewson2022-06-131-67/+56
| | | | | | | | | | | | | Previously we used the "if-modified-since" time associated with the consensus download, and/or the "valid-after" time in the consensus attempt, to put multiple attempts into sequence, and to tell one from another. But that approach was always a kludge, and will soon get more unreliable as the DirStatus logic gets a bit more complex. With this commit, we change separate download attempts to be identified with an AttemptId that increments whenever we decide to get a different directory from the one we have. IMO this new code is _much_ cleaner.
* Refactor most DirStatus users to use DirProgress.Nick Mathewson2022-06-131-48/+41
| | | | This is all crate-internal APIs, fortunately.
* Move `at_least_as_new_as` to DirProgress.Nick Mathewson2022-06-131-4/+18
|
* Turn the DirProgress in DirStatus into a named field.Nick Mathewson2022-06-131-52/+73
|
* Rename DirStatusInner to DirProgress.Nick Mathewson2022-06-131-34/+34
| | | | | | This is about to become only a _part_ of what defines a DirStatus: a DirStatus will also include a reset count, and some kind of info about how long we've gone without progress.
* tor-dirmgr: update status reporting to consider skew toleranceNick Mathewson2022-05-111-23/+66
| | | | | | In our status reporting code, we consider an expired-but-still-usable directory still bootstrapped, but not 100% bootstrapped.
* Merge branch 'disallowed_lint' into 'main'eta2022-03-301-1/+0
|\ | | | | | | | | Remove allow(clippy::disallowed_methods) lint flag. See merge request tpo/core/arti!437
| * Remove allow(clippy::disallowed_methods) lint.Nick Mathewson2022-03-301-1/+0
| |
* | Make daemon tasks self-contained; introduce NetDirProvidereta2022-03-301-20/+3
|/ | | | | | | | | | | | | | | The various background daemon tasks that `arti-client` used to spawn are now handled inside their respective crates instead, with functions provided to spawn them that return `TaskHandle`s. This required introducing a new trait, `NetDirProvider`, which steals some functionality from the `DirProvider` trait to enable `tor-circmgr` to depend on it (`tor-circmgr` is a dependency of `tor-dirmgr`, so it can't depend on `DirProvider` directly). While we're at it, we also make some of the tasks wait for events from the `NetDirProvider` instead of sleeping, slightly increasing efficiency.
* Merge branch 'no-system-time' into 'main'eta2022-03-301-0/+1
|\ | | | | | | | | | | | | Don't use SystemTime::now() Closes #306 See merge request tpo/core/arti!365
| * use wallclock where possible in teststrinity-1686a2022-02-261-0/+1
| |
* | 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 impl with educe+std in tor-dirmgrIan Jackson2022-03-021-8/+4
| |
* | Replace manual Debug impl with educe in tor-dirmgrIan Jackson2022-03-021-8/+5
|/
* tor-dirmgr: Create a bootstrap-status exporting mechanism.Nick Mathewson2022-01-181-4/+465
| | | | | | | | | | | | | | | | | | | | | | The interface is similar to the one exposed by `arti-client`: it internally uses postage::watch to give a series of events showing when a bootstrap status is changing. Thanks to the existing state/driver separation in the DirMgr design we don't need much new logic: each download state needs to expose (internally) how far along it is in its download, which the bootstrap code passes to the DirMgr if it has changed. I believe that in the long run, we'll probably want to expose more (or different) information here, and we'll want to process it differently. With that in mind, I've made the API for `DirBootstrapStatus` deliberately narrow, so that we can change its of its internal later on without breaking code that depends on it. (The information exposed by this commit is not yet summarized in `arti-client`.) Part of #96.
* Refactor directory events to use a FlagPublisher mechanism.Nick Mathewson2021-12-141-86/+327
| | | | | | | | This approach tries to preserve the current interface, but uses a counter-based event backend to implement a coalescing stream of events that can be represented as small integers. The advantage here is that publishing events no longer needs to be a blocking operation, since there is no queue to fill up.
* add semicolons if nothing returnedDaniel Eades2021-11-251-1/+1
|
* Notify guard manager on network change and state flush.Nick Mathewson2021-10-101-0/+3
|
* Move all crates into a `crates` subdirectory.Nick Mathewson2021-08-271-0/+118
This will cause some pain for now, but now is really the best time to do this kind of thing.