This PR adds four new configuration options for the HTTP client used by the
json unit.
These are http-root-certs for additional TLS root certificates,
http-user-agent for setting a custom user agent, http-client-addr to specify
a local address to bind to, and http-proxies to add HTTP proxies. The last
option is only available if the socks feature is enabled which it is by
default.
This PR revises how updates are dispatched. Instead of having separate
status and payload updates, these are now merged into one with a payload
update implying a status change to healthy. This should avoid the potential
for strange races between setting the status back to healthy and updating
the data.
A resulting limitation is that if a unit wants to change from stalled to
healthy it has to submit a payload update, but in practice this health
status change is pretty much always triggered by a new payload update
becoming available, so this should be fine.
This is a breaking change.
This PR changes some aspect of the communication module to deal with startup
and shutdown of units.
In order to allow a unit or target that is started after an upstream unit
and misses updates to gain access to the last update, a gate will store the
last update and include it in its response to the subscription request. A
consequence of this is that the last update of every unit will be kept
around. In most cases, they need to be kept around, anyway – the rtr unit
needs it for diffing, the any unit needs to keep the updates for all its
sources so it can seamlessly switch –, so this shouldn’t have too much of an
impact in practice.
The PR also fixes an issue when shutting down units. In this case, the link
goes into a “gone” state. Querying the link was immediately returning with
the gone state. If the unit owning the link was looping over this link
query, it would just end up in an endless, uninterrupted loop which would
take over one of the threads of the Tokio runtime. This is fixed by having
Link::query not return in case the status is “gone” but rather just remain
in pending state forever.
In addition, the PR does a change the the handling of suspending a link.
Earlier, querying the link would un-suspend it (or rather, that was the
intention, I believe it didn’t actually do that). Now suspending and
unsuspending is just a state change communicated to the gate which then can
in turn report this to its unit for further consideration.
Finally, the PR adds both a test unit and a test target as well as changes
the manager to allow setting up a unit graph programmatically. This way,
test cases with unit graphs can be written and their behaviour asserted.
This PR removes the serial number and optional diff from payload::Update.
The serial number was never actually used anywhere so has always been
unnecessary. However, it did provide a sort of safety net for using the
optional diff in case an update was missed somehow. This, however, only ever
happened with the RTR target, so dropping the diff and re-calculating is
probably acceptable both from a performance and reliability perspective.
This PR fixes a race in the slurm unit that caused exceptions not processed
if loading the files took too long. As a side-effect, the unit’s output will
now be updated immediately when an update to the files has been detected
rather than only be considered when the next update from the unit’s source
comes in.
---------
Co-authored-by: Luuk Hendriks <mail@luukhendriks.eu>
This PR upgrades Rust to the 2021 edition and the minimal Rust version to
1.70. It also upgrades all dependencies to their latest version and fixes
all resulting issue. Finally, it includes a number of Clippy-suggested code
fixes.
This does not yet upgrade toml since it has changed in a rather breaking
way.