summaryrefslogtreecommitdiff
path: root/crates/tor-dirmgr/src/retry.rs
Commit message (Collapse)AuthorAgeFilesLines
* Allow clippy::unchecked_duration_subtraction in testsNick Mathewson2023-01-271-0/+1
| | | | | This panics on error, and we're fine with a panic on misbehavior in tests.
* test lint blocks: Add many many automaticallyIan Jackson2022-12-121-0/+9
| | | | | This is precisely the result of running the rune in maint/adhoc-add-lint-blocks.
* impl_standard_builder: Use for tor_dirmgr::DownloadScheduleIan Jackson2022-06-161-14/+3
|
* Add some missing `serde(default)` to uses of humantime_serde::optionIan Jackson2022-06-161-1/+1
| | | | | Without this, if the substructure is provided, these fields are mandatory within it.
* Use testing_rng() in tests throughout our crates.Nick Mathewson2022-06-021-1/+2
| | | | | | This only affects uses of thread_rng(), and affects them all more or less indiscriminately. One test does not work with ARTI_TEST_PRNG=deterministic; the next commit will fix it.
* config derive attrs: Make builders serde, and validated structs notIan Jackson2022-05-051-12/+3
| | | | | | | | | | | | | | | * Builders additionally derive: Debug, Serialize, Deserialize. * Validated structs no longer derive: Serialize, Deserialize and all related attributes deleted. * As a consequence, all the `#[serde(deny_unknown_fields)]` are gone. That means that right now unknown fields are totally ignored. This is good for compatibility but poor for useability. Doing something better here is arti#417, in progress. * As a consequence, delete tor_dirmgr::retry::default_parallelism. (The default value was already duplicated into a builder attr.)
* Merge branch 'download-schedule' into 'main'Nick Mathewson2022-04-261-38/+77
|\ | | | | | | | | DownloadSchedule: Introduce Builder See merge request tpo/core/arti!473
| * Make DownloadScheduleBuilder "alternative" defaults pub(crate)Ian Jackson2022-04-261-2/+2
| | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/473#note_2798464
| * Fix typo in messageNick Mathewson2022-04-261-1/+1
| |
| * DownloadSchedule: Rename field to "attempts"Ian Jackson2022-04-261-8/+8
| | | | | | | | | | | | | | This is actually a number of *attempts* not a number of *retries*. The setter method was already called "attempts". This chnages the deserialisation of the config.
| * DownloadSchudule: Have NetworkConfig contain BuildersIan Jackson2022-04-261-0/+21
| | | | | | | | | | | | | | | | | | | | | | Use sub_builder. We must do something special for defaults. This involves moving the actual default values for retry_bootstrap and retry_microdescs into config.rs, since they need to access the fields of the un-built version of the structure. (An alternative would be to generate "weak setters" which do not override previous settings, but derive_builder does not offer to generate them and that seems overkill.)
| * DownloadSchedule: Abolish new() methodIan Jackson2022-04-261-24/+3
| | | | | | | | | | | | | | | | | | | | Instead, everyone should use DownloadScheduleBuilder. The new() method would in any case be useless in a moment, since we're going to embed DownloadScheduleBuilder in the NetworkConfig, not DownloadSchedule. The call sites in the tests are all about to change again.
| * DownloadSchedule: tests: Do not try to set parallelism to 0Ian Jackson2022-04-261-11/+9
| | | | | | | | | | | | | | | | The current behaviour is to treat 0 as indicating "use the default", which is quite strange. We are going to get rid of that. The new way will be to reject zero, during DownloadScheduleBuilder::build, Add a test case for that.
| * DownloadSchedule: Provide builderIan Jackson2022-04-261-1/+42
| |
* | squash! Bump every crate's edition to 2021.Nick Mathewson2022-04-251-1/+0
|/ | | | | Remove all `use` statements for `TryFrom` and `TryInto`. These are now redundant in Rust 2021.
* 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.
* Add basic tests for high-level buildersNick Mathewson2021-11-251-0/+1
| | | | | Make sure that we can change elements, and we can reconstruct builders that give us the same thing.
* Rename RetryConfig to DownloadSchedule, fold in parallelism.Nick Mathewson2021-11-181-16/+41
|
* More tests on tor-dirmgr::stateNick Mathewson2021-11-081-1/+1
| | | | | These test our download schedules, resetting to the original state, and storing downloaded objects.
* Move all crates into a `crates` subdirectory.Nick Mathewson2021-08-271-0/+237
This will cause some pain for now, but now is really the best time to do this kind of thing.