Commit Graph

3151 Commits

Author SHA1 Message Date
eta 6f787e1e77 Merge branch 'derive-builder-git-fixup' into 'main'
derive_builder: Use git dep everywhere, rather than cargo patch

See merge request tpo/core/arti!477
2022-04-27 14:31:08 +00:00
Ian Jackson a97ad69855 derive_builder: Use git dep everywhere, rather than cargo patch
The `[patch]` approach causes the tree not to build when used as a
dependency, unless the `[patch]` is replicated into the depending
project.

Instead, replace our `derive_builer =` dependencies with a reference
to a specific git commit:

  perl -i~ -pe 'next unless m/^derive_builder/; s#"(0\.11\.2)"#{ version = "$1", git = "https://github.com/ijackson/rust-derive-builder", rev = "ba0c1a5311bd9f93ddf5f5b8ec2a5f6f03b22fbe" }#' crates/*/Cargo.toml

Note that the commitid has changed.  This is because derive_builder is
in fact a workspace of 4 crates.  3 of them are of interest to arti
itself (the 4th exists only for testing).  So the same "add git
revision" treatment had to be done to the `derive_builder` and
`derive_builder_macro` crates.  Each dependency edge involves a new
commit in the derive_builder workspace, since we can't create a git
commit containing its own commitid.  (We want to use commits, rather
than a branch, so that what we are depending on is actually properly
defined, and not subject to the whims of my personal github
namespace.)

There are no actual code changes in derive_builder.
2022-04-27 14:57:59 +01:00
Samanta Navarro 4b9ecc5680 Fix sentences
The arti crate itself is only used in benchmark and testing crate.
I think this sentence does not belong here.

Also extend retry-error description (from Architecture.md).
2022-04-27 13:53:23 +01:00
Samanta Navarro 1d62d92fb9 Fix spacing 2022-04-27 13:52:43 +01:00
Samanta Navarro c53818d496 Fix grammar and typos 2022-04-27 13:52:13 +01:00
eta 8509dbc920 Merge branch 'upgrade_dependencies' into 'main'
Upgrade various dependencies, now that we are MSRV 1.56

Closes #313 and #334

See merge request tpo/core/arti!476
2022-04-27 12:27:28 +00:00
Nick Mathewson 5484bcc21f Merge branch 'download-schedule' into 'main'
DownloadSchedule: Introduce Builder

See merge request tpo/core/arti!473
2022-04-26 18:47:08 +00:00
Ian Jackson 4a32bcd4d3 Make DownloadScheduleBuilder "alternative" defaults pub(crate)
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/473#note_2798464
2022-04-26 19:01:20 +01:00
Nick Mathewson 4643e1dd24 Fix typo in message 2022-04-26 17:40:05 +00:00
Nick Mathewson 0425de104c downgrade_dependencies: Remove "quote" exception.
This is no longer necessary. :)
2022-04-26 12:16:22 -04:00
Nick Mathewson f8dbad941e Bump async_executors to 0.6 2022-04-26 12:16:22 -04:00
Nick Mathewson aaab6f3812 Upgrade to AES 0.8
Now that we require Rust 1.56, we can upgrade to AES 0.8.  This
forces us to have some slight API changes.

We require cipher 0.4.1, not cipher 0.4.0, since 0.4.0 has
compatibility issues with Rust 1.56.
2022-04-26 12:16:22 -04:00
Nick Mathewson 6b5cefcccf Bump to config 0.13 2022-04-26 12:16:22 -04:00
Nick Mathewson fe0e5b4ded Upgrade tracing-journald to 0.3.0 2022-04-26 12:16:22 -04:00
Nick Mathewson 5586f0d039 Upgrade to Postage 0.5.0 2022-04-26 12:16:22 -04:00
Nick Mathewson ae72d21092 Upgrade to rlimit 0.8.3, again.
Now that our MSRV is at 1.56, we can use the latest rlimit.

It has to be 0.8.3 (not "0.8"), since 0.8.2 has compatibility issues
with 1.56.
2022-04-26 12:16:22 -04:00
Nick Mathewson 93e4ab547a Merge branch 'msrv_1_56' into 'main'
Increase our MSRV to 1.56.

See merge request tpo/core/arti!472
2022-04-26 16:15:35 +00:00
Ian Jackson 72eaa9fc30 DirMgrConfig: Remove unnecessary accessors
These fields are pub.

Retain two convenience accessor functions that access sub-fields of
network.
2022-04-26 15:32:20 +01:00
Ian Jackson 20d61dd4d4 DirMgrConfig: Rename two fields that contained a _config
This entire struct is config.  This is otiose.
2022-04-26 15:29:33 +01:00
Ian Jackson d2cc0aa50a Document breaking changes to DownloadSchedule etc. 2022-04-26 15:19:52 +01:00
Ian Jackson ed71858123 DownloadSchedule: Rename field to "attempts"
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.
2022-04-26 15:16:32 +01:00
Ian Jackson cb303cefb3 DownloadSchedule: Abolish accessors in DownloadScheduleConfig
We can just make the fields pub(crate).
2022-04-26 15:16:32 +01:00
Ian Jackson eb35555330 DownloadSchudule: Have NetworkConfig contain Builders
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.)
2022-04-26 15:16:32 +01:00
Ian Jackson f4a1e34bee DownloadSchedule: Abolish new() method
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.
2022-04-26 15:16:32 +01:00
Ian Jackson e1d1fe6569 DownloadSchedule: tests: Do not try to set parallelism to 0
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.
2022-04-26 15:16:03 +01:00
Ian Jackson a720205d35 DownloadSchedule: Provide builder 2022-04-26 15:16:03 +01:00
Nick Mathewson c1ea419477 Merge branch 'main' into 'msrv_1_56'
# Conflicts:
#   crates/tor-config/Cargo.toml
#   crates/tor-dirmgr/src/state.rs
#   doc/semver_status.md
2022-04-26 12:45:16 +00:00
Nick Mathewson ed1f5abe20 Merge branch 'config-sub-list' into 'main'
Introduce macro for ThingListBuilder, and use for AuthorityListBuilder

See merge request tpo/core/arti!471
2022-04-26 12:26:16 +00:00
Ian Jackson c529d6cd06 Merge branch 'abstime-sum' into 'main'
retry-error: Provide AbsRetryTime::from_sub and use it

See merge request tpo/core/arti!470
2022-04-25 18:23:03 +00:00
Ian Jackson 15dd7cbdd3 AbsRetryTime::from_sum: Provide a test case
As requested in
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/470#note_2798015
2022-04-25 18:39:11 +01:00
Ian Jackson 2d9b50540d AbsRetryTime::from_sum: Add missing full stop
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/470#note_2797945
2022-04-25 18:37:14 +01:00
Nick Mathewson d1fcd3eeae Update semver_status to note that all crates have had a breaking change. 2022-04-25 13:31:06 -04:00
Ian Jackson e81d215787 list-builder: Provide tests of all methods
Because the macro output is private, if we miss one out of the tests,
it doesn't fail due to dead code :-).
2022-04-25 18:24:28 +01:00
Ian Jackson c71046294b list_builder: Allow the struct to not be pub
Really, we probably don't want any of these not to be pub, but it
triggers "unreachable pub" in my test cases, and making it not pub by
mistake seems not very serious, and likely to be noticed.

Making the struct private in the test cases has the useful effect of
checking that all the methods are tested.
2022-04-25 18:24:06 +01:00
Ian Jackson 83b9fbea99 list_builder: Use $crate namespaced imports
I don't think we need to bother with things in the prelude,
but doing it for serde and ConfigBuildError seems nice.

Noticed while writing a test case.
2022-04-25 18:23:02 +01:00
Ian Jackson ce877e4421 Document defaults for all the config lists
And add an imprecation in define_list_config_builder's doc comment do
do so in future for other invocations of the macro.

Add add the missing full stops.
2022-04-25 18:22:54 +01:00
Ian Jackson bb81a412ea define_list_config_builder: Provide example of item_build
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/471#note_2798027
2022-04-25 18:20:21 +01:00
Ian Jackson bfd0e48a5c define_list_config_builder: Expand generated docs for methods etc.
Requested in
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/471#note_2798022
2022-04-25 18:20:21 +01:00
Ian Jackson 3f44078227 Add semver note about added macros in tor-condfig 2022-04-25 18:19:03 +01:00
Ian Jackson f6506721ab Add semver notes for AuthorityListBuilder, PredictedPortsListBuilder
These were omitted in the earlier commits.
2022-04-25 18:15:25 +01:00
Ian Jackson 8664766270 Rename macro_first_nonempty (from macro_coalesce_args)
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/471#note_2798026
2022-04-25 18:15:25 +01:00
Ian Jackson 1f215da1a3 Rename ThingListBuilder::replace (from set)
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/471#note_2798024
2022-04-25 18:15:25 +01:00
Nick Mathewson 2f6bc6bdc4 squash! Bump every crate's edition to 2021.
Remove all `use` statements for `TryFrom` and `TryInto`.  These are
now redundant in Rust 2021.
2022-04-25 13:06:26 -04:00
Nick Mathewson b60b0a266a Bump every crate's edition to 2021.
This is an automated change made with a perl one-liner and verified
with grep -L and grep -l.

Some warnings are introduced with this change; they will be removed
in subsequent commits.

See arti#208 for older discussion on this issue.
2022-04-25 13:05:31 -04:00
Nick Mathewson ca05b0904c Add 'rust-version = "1.56"' to every Cargo.toml file.
This change was made automatically with a perl one-liner, and
confirmed with `grep -L`.

The `rust-version` field itself was introduced in 1.56.0.
2022-04-25 13:04:31 -04:00
Nick Mathewson 0069fd2206 Reformat all not-yet-reformatted Cargo.toml files.
There are no semantic changes here; only formatting.  This is in
preparation for other changes (wrt MSRV and edition)
2022-04-25 13:04:31 -04:00
Nick Mathewson 6f3f351140 Increase our MSRV to 1.56.
Our support policy says that we can update to any Rust released at
least 6 months ago; 1.56 came out on 21 October 2021.

This doesn't yet change any code: it just increases the version
we say we need in our README, and the version we test against in
CI.

Our main justification for this change is to be able to upgrade to
newer versions of our dependencies, including `async_executors` >=
0.5, `aes` >= 0.8, and `cipher` >= 0.4.
2022-04-25 13:03:31 -04:00
Ian Jackson dca4f3ede1 Use better syntax for doc comment attribute
As per
  https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/471#note_2798020
2022-04-25 17:05:30 +01:00
Ian Jackson 24518675db Introduce PredictedPortsListBuilder
This means that `NetworkConfig::initial_predicted_ports` is now like
the other list-like things, returning `&mut list_builder` with the same
`set()` and `append()` methods.
2022-04-25 17:05:30 +01:00
Ian Jackson 961f6b527e config list-builder: Allow overriding the per-item build method
This will be useful especially for simple lists where the entry
doesn't need a separate builder type.
2022-04-25 17:04:23 +01:00