summaryrefslogtreecommitdiff
path: root/crates/tor-memquota
Commit message (Collapse)AuthorAgeFilesLines
...
| * Expose stream_peekJim Newsome2024-08-212-6/+18
| |
| * PeekFuture: implement for all PeekableStreamJim Newsome2024-08-211-5/+6
| |
| * StreamUnobtrusivePeeker: implement PeekableStream and UnobtrusivePeekableStreamJim Newsome2024-08-213-41/+15
| |
* | tor-memquota: IfEnabled: Complete a thought in a commentIan Jackson2024-08-211-1/+3
| | | | | | | | | | Reported at https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2351#note_3062292
* | tor-memquota: Pass EnabledToken to HasMemoryCost methodIan Jackson2024-08-192-17/+29
| |
* | tor-memquota: Pass EnabledToken to IsParticipant methodsIan Jackson2024-08-196-19/+22
| | | | | | | | | | | | | | 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: Put EnabledToken in various structs, including the reclaimerIan Jackson2024-08-193-4/+26
| |
* | tor-memquota: Allow memory tracking to be compiled outIan Jackson2024-08-196-6/+46
| | | | | | | | | | | | | | 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: Support a no-op MemoryQuotaTrackerIan Jackson2024-08-194-51/+168
| | | | | | | | | | | | | | | | | | | | Wrap up most of the structures in IfEnabled. Sadly this diff is very noisy. I experimented with macros for the little enabled check at the start of each function but they didn't really help. We don't test this yet. We'll do a smoke test of this later.
* | tor-memquota: Introduce self_ variables in mtracker.rs (fmt)Ian Jackson2024-08-191-1/+4
| |
* | tor-memquota: Introduce self_ variables in mtracker.rsIan Jackson2024-08-191-48/+69
| | | | | | | | | | | | | | | | We're going to bind self_ to something more complicated, in each of these functions, and that's what all these field references etc. will need to refer to. Do this mechanical change first for clarity.
* | tor-memquota: Introduce IfEnabled and EnabledTokenIan Jackson2024-08-193-0/+84
| | | | | | | | EnabledToken is pub because it's going to appear in public APIs.
* | tor-memquota: find_in_tracker: Allow internal use of non-unit errorsIan Jackson2024-08-191-6/+6
| |
* | tor-memquota: pre-apply rustfmt churnIan Jackson2024-08-192-4/+14
|/ | | | This will make some later diffs easier to read.
* 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-152-3/+8
| | | | | 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-153-18/+18
| | | | | 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: StreamUnobtrusivePeeker: provide as_raw_inner_pin_mutIan Jackson2024-08-151-0/+11
| | | | | | | | This will let us call mpsc::Receiver::close. We have it take Pin, even though we don't really want that for our use case, because if you use StreamUnobtrusivePeeker with a non-Unpin stream you'll ant that.
* 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-152-5/+5
|
* 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-155-5/+507
|
* tor-memquota: Add a Sealed traitIan Jackson2024-08-152-0/+7
| | | | We'll use this in a moment.
* tor-memquota: Provide Participation::new_dangling and WeakAccount::new_danglingIan Jackson2024-08-151-0/+26
| | | | | We're going to want the one for Participation - it saves us an annoying Option. Let's provide the one for WeakAccount too.
* Bump versions for tor- and arti- crates to 0.21.0Nick Mathewson2024-08-011-8/+8
| | | | | | | | | | This is the result of: ``` for crate in $( ./maint/list_crates |grep '^\(tor\|arti-\)' ); do cargo set-version -p $crate 0.21.0 done ```
* tor-memquota: discuss StreamUnobtrusivePeeker nameIan Jackson2024-07-241-7/+8
| | | | | See https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2280#note_3051134
* tor-memquota: Elide a lifetimeIan Jackson2024-07-241-1/+1
| | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2280#note_3051270
* tor-memquota: Fix a wrong commentIan Jackson2024-07-241-3/+1
| | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2280#note_3051268
* tor-memquota: Provide StreamUnobtrusivePeeker (tests)Ian Jackson2024-07-241-0/+163
|
* tor-memquota: Provide StreamUnobtrusivePeekerIan Jackson2024-07-245-2/+377
| | | | | | I'm not particularly pleased with this name. We need names for both the type, and the trait we'll almost certainly want to introduce in the future.
* Merge branch 'memquota-typed' into 'main'Ian Jackson2024-07-246-38/+469
|\ | | | | | | | | tor-memquota: HasMemoryCost trait, and type-safe methods See merge request tpo/core/arti!2282
| * tor-memquota: Test Debug, Display and HasKind impls for errorsIan Jackson2024-07-241-0/+72
| |
| * tor-memquota: impl HasKind for StartupError and ReclaimCrashedIan Jackson2024-07-241-0/+19
| | | | | | | | | | Trying to write comprehensive tests for the errors showed that these impls were missing.
| * tor-memquota: impl HasKind for ReclaimedErrorInnerIan Jackson2024-07-241-1/+7
| | | | | | | | This will make testing easier.
| * tor-memquota: Fix Display impl for Error::TrackerCorruptedIan Jackson2024-07-241-1/+1
| | | | | | | | | | Bug found in review: https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2282#note_3051101
| * tor-memquota: memory_cost: Introduce try_claim (tests)Ian Jackson2024-07-241-0/+31
| |
| * tor-memquota: memory_cost: Introduce try_claimIan Jackson2024-07-241-0/+38
| | | | | | | | | | Our stream wrapper is going to want this. It's fiddly enough that doing it as a standalone facility seems sensible.
| * tor-memquota: memory_cost: New trait and typed wrappers (tests)Ian Jackson2024-07-241-0/+69
| |
| * tor-memquota: memory_cost: New trait and typed wrappersIan Jackson2024-07-243-0/+158
| |
| * tor-memquota: Expose some test utilities for the rest of the crateIan Jackson2024-07-242-5/+8
| |
| * tor-memquota: Improve register_participant_with (fmt)Ian Jackson2024-07-241-18/+24
| |
| * tor-memquota: Improve register_participant_withIan Jackson2024-07-242-13/+16
| | | | | | | | | | Now the constructor is able to return other data to the caller, passing it through the mtracker machinery.