aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-memquota/src/mq_queue.rs
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Fix word duplicate typosTobias Stoeckmann2026-03-151-1/+1
|
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-1/+1
| | | | Run maint/add_warning
* Migrate to waker noopdisha2025-09-221-1/+1
|
* Fix warnings and errors from edition 2024.Nick Mathewson2025-08-071-3/+2
| | | | | | | | | | The two main causes of errors were: - Since some of the lifetime rules have changed, we no longer need to do as many "bind a variable and immediately return it" patterns, and so clippy now warns about them. - We needed to adjust the explicit captures (`use<...>`) in a couple of our RPIT instances.
* memquota: suppress clippy::single_match warning.Nick Mathewson2024-10-171-0/+1
| | | | | "Suppress" rather than "fix": this pattern is intentional, and makes it clear that we're doing an exhaustive match.
* Introduce mpsc_channel_no_memquota and use it in the places it's wantedIan Jackson2024-10-151-1/+1
| | | | | These are the call sites where using this fucntion is correct. (Outside tor-rtmock, which we'll do separately.)
* Merge branch 'mq-doc' into 'main'Ian Jackson2024-10-091-24/+0
|\ | | | | | | | | | | | | memquota architecture documentation Closes #1660 See merge request tpo/core/arti!2509
| * mq docs: Move arti queues text to tor_proto::memquotaIan Jackson2024-10-071-24/+0
| |
* | tor-memquota: miri: disable tests that use coarsetimeIan Jackson2024-10-081-1/+3
|/
* Merge branch 'close-channel-2' into 'main'Nick Mathewson2024-10-021-1/+12
|\ | | | | | | | | Provide and implement SinkCloseChannel See merge request tpo/core/arti!2485
| * tor-memquota: Implement SinkChannelClose for mq_queueIan Jackson2024-10-011-1/+12
| |
* | tor-memquota: Test error handling paths in try_send implIan Jackson2024-10-021-0/+54
| |
* | tor-memquota: Prepare for SinkTrySend testsIan Jackson2024-10-021-3/+24
| | | | | | | | | | | | Implement SinkTrySend for BustedSink. Implement SinkTrySendError for BustedError. Add an is_disconnected field (so we can test different error paths).
* | tor-memquota: Make BustedSink contain the BustedError to yield (fmt)Ian Jackson2024-10-021-1/+3
| |
* | tor-memquota: Make BustedSink contain the BustedError to yieldIan Jackson2024-10-021-8/+14
|/ | | | This will let us test different errors.
* tor-memquota: Implement SinkTrySend for mq_queue::SenderIan Jackson2024-10-011-0/+31
| | | | Plumbing.
* Merge branch 'dyn-time' into 'main'Ian Jackson2024-10-011-13/+33
|\ | | | | | | | | Provide a type-erased SleepProvider + CoarseTimeProvider and use it for memquota queues See merge request tpo/core/arti!2460
| * tor-memquota: mq_queue: Provide Sender::time_provider accessorIan Jackson2024-09-261-0/+14
| | | | | | | | Nothing uses this yet, but we will do so.
| * tor-memquota: Erase the CoarseTimeProvider from mq_queue::Sender (fmt)Ian Jackson2024-09-261-1/+6
| |
| * tor-memquota: Erase the CoarseTimeProvider from mq_queue::SenderIan Jackson2024-09-261-13/+14
| | | | | | | | | | | | | | | | | | | | Use tor_rtcompat::DynTimeProvider instead. Ultimately, we're going to want one of these in Channel etc. The CoarseTimeProvider generic argument then becomes pervasive. Instead, erase it. This will involve an indirect function call each time an item is inserted. I think that can't be helped.
| * tor-memquota: mq_queue: Take Account by referenceIan Jackson2024-09-261-5/+5
| | | | | | | | | | | | It doesn't need an owned value here. (clippy's note about this was defeated by this being a trait method.)
* | tor-memquota: Clarify that mq isn't the accountholderIan Jackson2024-09-261-0/+4
| |
* | tor-memquota: impl FusedStream for Receiver, where appropriateIan Jackson2024-09-261-0/+12
|/
* tor-memquota: queue plan: Clean up intent and make into a doc commentIan Jackson2024-09-101-32/+24
| | | | Remove extraneous text, wrap it, and change to a more declarative style.
* tor-memquota: queue plan: Copy from !1997 discussionIan Jackson2024-09-101-0/+32
|
* tor-memquota: Use clippy::arithmetic_side_effects, against panicsIan Jackson2024-09-101-0/+1
| | | | | | This detect possibly-panicking operations. Empirically this lint seems rather better now.
* tor-memquota: Rework optionality configurationIan Jackson2024-09-041-1/+1
| | | | | | | | | | | | | | | | | | Allow a `Config` to represent "this is supposed to be disabled". This involves wrapping the actual built configuration in an IfEnabled. We treat max = usize::MAX, or max being unspecified, as "disable". We can now reporting an error during config building if max is set but we're compiling the feature out. Conversely, we can now make `MemoryQuotaTracker::new()` unconditional, since enabled confiogurations are uninhabited when the feature is compiled out. We change how we derive the setters, deriving them from the Builder. I chose to abolish the use of derive_builder. See the new comment on ConfigBuilder.
* Remove NoopWaker; use futures::task::noop_waker_ref insteadJim Newsome2024-08-271-3/+2
|
* Merge branch 'peekable-poll-set' into 'main'Jim Newsome2024-08-211-0/+2
|\ | | | | | | | | Add and use `PeekableStream` and `UnobtrusivePeekableStream` See merge request tpo/core/arti!2345
| * StreamUnobtrusivePeeker: implement PeekableStream and UnobtrusivePeekableStreamJim Newsome2024-08-211-0/+2
| |
* | tor-memquota: Pass EnabledToken to HasMemoryCost methodIan Jackson2024-08-191-7/+9
| |
* | tor-memquota: Pass EnabledToken to IsParticipant methodsIan Jackson2024-08-191-2/+2
| | | | | | | | | | | | | | This will hopefully allow much caller code to be compiled out. The users (IsParticipant impls) don't generally need to bother with it - they can just ignore it.
* | tor-memquota: Allow memory tracking to be compiled outIan Jackson2024-08-191-2/+9
|/ | | | | | | Now if we run doctests without the feature enabled, we test that a no-op MemoryQuotaTracker works. Those tests aren't currently run in CI, but they will be after !2350.
* tor-memquota: mq_queue: tests: Replace eprintln with debugIan Jackson2024-08-151-1/+1
| | | | We use `debug!` (tracing logging) everywhere else. Use it here too.
* tor-memquota: mq_queue: tests: fill_and_empty: check balanceIan Jackson2024-08-151-0/+3
|
* tor-memquota: mq_queue: tests: break out check_zero_claimed and fix bugIan Jackson2024-08-151-1/+17
| | | | | | | | | | | Each queue has two `Participation`s, not just one. This didn't matter in the `lifecycle` test, because one of the two Participations was never touched since it was cloned, and a fresh clone starts out with a cache of zero. But we're about to reuse this code in a context where both Participations end up with a cache.
* tor-memquota: mq_queue: impl Default for MpscUnboundedSpecIan Jackson2024-08-151-1/+1
|
* tor-memquota: mq_queue: Provide `new` constructors for SpecsIan Jackson2024-08-151-2/+7
| | | | | Discussed here https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2292#note_3059928
* tor-memquota: mq_queue: Fix doc for `MpscSpec`Ian Jackson2024-08-151-2/+2
| | | | It's not a unit. It's `MpscUnboundedSpec` that's a unit
* tor-memquota: mq_queue: Rename Mpsc to MpscSpecIan Jackson2024-08-151-12/+12
| | | | | | | And MpscUnboundedSpec too. As discussed in https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2292#note_3059516
* tor-memquota: mq_queue: Add a caveat about faithfulness/accuracyIan Jackson2024-08-151-0/+14
| | | | | Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2292#note_3059543
* tor-memquota: Rename mby test helper fn to mbytesIan Jackson2024-08-151-1/+1
| | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2292#note_3059520
* tor-memquota: mq_queue: Call mpsc::Receiver::close in our rx DropIan Jackson2024-08-151-0/+27
| | | | | Fixes the livelock possibility discussed here https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2292#note_3059519
* tor-memquota: mq_queue: Add fill_and_empty testIan Jackson2024-08-151-0/+23
| | | | | Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2292#note_3059518
* tor-memquota: Add blank lines before fns except in testsIan Jackson2024-08-151-0/+6
| | | | | Requested by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2292#note_3059517
* tor-memquota: Fix typosIan Jackson2024-08-151-3/+3
|
* tor-memquota: Add mq_queue, memory-quota-tracking (MPSC) queue (tests)Ian Jackson2024-08-151-0/+179
|
* tor-memquota: Add mq_queue, memory-quota-tracking (MPSC) queueIan Jackson2024-08-151-0/+500