aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-checkable/src/timed.rs
Commit message (Collapse)AuthorAgeFilesLines
* tor-checkable: Improve/fix a commentIan Jackson2026-07-231-1/+2
| | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/4223#note_3438341
* tor-checkable: Fix punctuation in commentIan Jackson2026-07-231-1/+1
|
* tor-checkable: Fix a doc comment copypastaIan Jackson2026-07-231-1/+1
|
* tor-checkable: Fix two doc comments start/endIan Jackson2026-07-231-2/+2
|
* tor-checkable: TimeBound: Provide new build_intersect APIIan Jackson2026-07-231-0/+121
|
* clippy config: Forbid TimeRangeBound::if_valid_nowIan Jackson2026-07-231-4/+7
|
* tor-checkable: Rename `TimeBound::is_valid_at` to `check_valid_at`Ian Jackson2026-07-231-17/+17
| | | | | I find this names confusing. To my mind "is" implies a function returning `bool`.
* tor-checkable: Rename `TimeBound::check_valid_*` to `if_valid_*`Ian Jackson2026-07-231-7/+7
| | | | | | | I find these names confusing. To my mind "check" implies a function returning `Result<(), _>`. Some other APIs use `unwrap` here but I think `if` is good.
* tor-checkable: Deprecate `TimeBound::check_valid_at_opt`Ian Jackson2026-07-231-8/+11
|
* tor-checkable: TimeBound: Make wrapped type an associated typeIan Jackson2026-07-231-1/+3
| | | | | It wouldn't make much sense for one concrete type to be unwrappable variously as different inner types.
* tor-checkable: TimeBound: Make dangerously_into_parts return TimeRange (fmt)Ian Jackson2026-07-231-3/+1
|
* tor-checkable: TimeBound: Make dangerously_into_parts return TimeRangeIan Jackson2026-07-231-4/+4
| | | | | It is better to return a more cooked type. `TimeRange` aka `TimeRangeBound<()>` is perfect for this.
* tor-checkable: TimeBound: remove Error associated typeIan Jackson2026-07-231-4/+2
| | | | | This was always TimeValidityError. And we want to rely on that so we can do the validity checking more centrally.
* tor-checkable: TimeBound: Add bounds accessorIan Jackson2026-07-231-12/+12
| | | | | | | This makes a `TimeBound` much more convenient to work with, will allow more centralisation. This replaces temporary `bound` inherent method on `TimeRangeBound`.
* tor-checkable: TimeRange: Provide intersect_bounds methodIan Jackson2026-07-231-0/+51
|
* tor-checkable: TimeRange: Provide a more complete APIIan Jackson2026-07-231-0/+57
| | | | | This is our time range type, so it wants a bunch of useful methods and conversions.
* tor-checkable: Introduce TimeRange aliasIan Jackson2026-07-231-0/+8
|
* tor-checkable: TimeRangeBound: Rename extend_tolerance to extend_end_boundIan Jackson2026-07-231-4/+9
| | | | | | | | | It was confusing that one of these functions had "which bound" mentioned in its name, but the other didn't. So add `end` and switch from `tolerance` to `bound` (see previous commit message). *This* commit should deal only in `extend_tolerance` and `end` and shouldn't touch `extend_start_bound` or `extend_pre_tolerance`.
* tor-checkable: TimeRangeBound: Rename extend_pre_tolerance to extend_start_boundIan Jackson2026-07-231-3/+12
| | | | | | | | | | | | | | Although it is often used to apply a tolerance, it doesn't make sense to say that this is extending the "tolerance" of a `TimeRangeBound`. A `TimeRangeBound` doesn't have a tolerance, only bounds. Also we should be consistent in our terminology, and use `start` rather than `pre`. We'll rename the other method too. Doing them one at a time will makes it easier to spot any "pre/start" vs "<nothing>/end" slips: *this* commit should deal only in `pre` and `start` and shouldn't touch `extend_tolerance`.
* tor-checkable: TimeRangeBound: Swap code order of two functionsIan Jackson2026-07-231-10/+10
| | | | | This puts the start bounds extension function before the end one. That makes sense because starts are before ends.
* tor-checkable: TimeRangeBound: Rename bounds to bounds_start_endIan Jackson2026-07-231-2/+14
| | | | | | | | | | This just returns a tuple. We're going to introduce a new method that returns a `TimeRagne` and will want to be called `bounds`. That method will want to be in the `TimeBound` trait, but for now we add it here. Various call sites will be added in forthcoming commits.
* tor-checkable: TimeRangeBound: document lack of well-formedness invariantIan Jackson2026-07-231-0/+3
|
* Apply deferred rustfmt churnIan Jackson2026-07-161-1/+1
|
* Use new TimeRangeBound name throughout the treeIan Jackson2026-07-161-29/+29
|
* tor-checkable: Rename TimerangeBound to TimeRangeBoundIan Jackson2026-07-161-5/+9
| | | | For consistency with the TimeBound trait.
* Use new TimeBound name throughout the treeIan Jackson2026-07-161-3/+3
|
* tor-checkable: TimerangeBound: test edge casesIan Jackson2026-06-101-0/+10
|
* tor-checkable: TimeRangebound: document inclusivityIan Jackson2026-06-101-1/+2
|
* tor-checkable: TimerangeBound: is_valid: Treat bounds as inclusive (fmt)Ian Jackson2026-06-101-2/+6
|
* tor-checkable: TimerangeBound: is_valid: Treat bounds as inclusiveIan Jackson2026-06-101-2/+2
| | | | | | | | | | | | | | | This makes more sense because: * `start_bound` and `end_bound` return `Bound::Included` * It doesn't make sense to say that a document isn't valid at the very start of its validity period. (And we don't want a half-open range.) * NotYetValid(0ns) and Expired(0ns) are rather nonsensical errors. In real timeliness tests it will make no difference since the current time is only equal to the bound for a nanosecond. But tests that like to test corner cases might be affected, and possibly some synthetic situations (where the document's own validity time start is used somehow) might change.
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-091-0/+1
| | | | | | | | | | | | This commit executes maint/add_warning with the just added change to deny string slices except in tests. I recommend auditing this by checking out the previous commit followed by running the script yourself and then verifying that the diff is identical to this commit. This commit makes cargo clippy fail. We will add exceptions in the next commit.
* tor-checkable: Port to web-time-compatNick Mathewson2026-03-261-8/+8
|
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-1/+1
| | | | Run maint/add_warning
* TimerangeBound: Stop using std::ops::Bound.Wesley Aptekar-Cassels2024-11-251-5/+16
| | | | Fixes: #1691
* Run maint/add_warning.Nick Mathewson2024-03-131-0/+1
|
* tor-checkable: Use checked arithmeticTobias Stoeckmann2024-03-051-2/+14
| | | | | | | | | Make sure that arithmetic with SystemTime and Duration fits into SystemTime. If the result does not fit, set the affected boundary to None. After all it implies that this point in time is not reachable on the system. Avoids integer overflow or panic, depending on debug or release build.
* Run maint/add_warning to add lint block everywhereIan Jackson2023-08-231-0/+1
|
* Run maint/add_warning to actually apply new lint allowsIan Jackson2023-07-101-0/+1
|
* netdoc: Use the RangeBoundsExt impl of TimerangeBound.Gabriela Moldovan2023-05-131-71/+0
| | | | | | We can now get rid of the standalone `intersect_bounds` function. Signed-off-by: Gabriela Moldovan <[email protected]>
* tor-checkable: Implement RangeBounds for TimerangeBound.Gabriela Moldovan2023-05-131-4/+17
| | | | | | | | By implementing `RangeBounds` for `TimerangeBound`, we get `RangeBoundsExt` for free. This will enable `parse_decrypt_validate` to easily compute the intersection of the `TimerangeBound`s its layers. Signed-off-by: Gabriela Moldovan <[email protected]>
* tor-checkable: Add a way to compute the intersection of 2 RangeBounds.Gabriela Moldovan2023-05-131-0/+71
| | | | | | | This will be used for computing the final `TimerangeBound` of a `HsDesc` from the `TimerangeBound`s of its inner and outer layers. Signed-off-by: Gabriela Moldovan <[email protected]>
* hsclient: Build cached descriptor TimerangeBounds from descriptor lifetime.Gabriela Moldovan2023-05-131-7/+11
| | | | | | | This makes `descriptor_ensure` refetch the descriptor if it has been cached for longer than `descriptor-lifetime` minutes. Signed-off-by: Gabriela Moldovan <[email protected]>
* TimerangeBound: Provide .as_ref() and .as_deref()Ian Jackson2023-04-031-1/+33
|
* TimerangeBound: derive Debug and Clone, and Eq/PartialEq in testsIan Jackson2023-04-031-0/+2
|
* Use humantime in tor-checkableSaksham Mittal2023-02-271-5/+8
| | | | | | The four values of times taken in a particular test were changed to both be human readable and have comments explaining their significance (they are all important moments after the Unix Epoch for freedom)
* tor-checkable: Add dangerously_map() functions.Nick Mathewson2023-02-071-1/+31
| | | | | | | | | | | These functions consume a checkable wrapper, and return a new checkable wrapper with mapped contents but the same not-yet-checked constraints. As documented, They are "dangerous" because the provided function gets access to the contents before they are checked; the caller has to make sure that the provided function doesn't expose their contents inappropriately.
* 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.
* Merge branch 'test-lints' into 'main'eta2023-01-061-0/+9
|\ | | | | | | | | Add test lint blocks to all "mod test" See merge request tpo/core/arti!937
| * 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.
* | Tackling issue #663 (Use humantime in tests)coral2022-12-121-5/+7
|/